Skip to content

Commit 3f224f4

Browse files
committed
sh: provide generic arch_debugfs_dir.
While sh previously had its own debugfs root, there now exists a common arch_debugfs_dir prototype, so we switch everything over to that. Presumably once more architectures start making use of this we'll be able to just kill off the stub kdebugfs wrapper. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent a234ca0 commit 3f224f4

8 files changed

Lines changed: 24 additions & 40 deletions

File tree

‎arch/sh/include/asm/system.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ extern unsigned int instruction_size(unsigned int insn);
140140
extern unsigned long cached_to_uncached;
141141
extern unsigned long uncached_size;
142142

143-
extern struct dentry *sh_debugfs_root;
144-
145143
void per_cpu_trap_init(void);
146144
void default_idle(void);
147145
void cpu_idle_wait(void);

‎arch/sh/kernel/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ endif
1212
CFLAGS_REMOVE_return_address.o = -pg
1313

1414
obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \
15-
idle.o io.o irq.o \
16-
irq_$(BITS).o machvec.o nmi_debug.o process.o \
15+
idle.o io.o irq.o irq_$(BITS).o kdebugfs.o \
16+
machvec.o nmi_debug.o process.o \
1717
process_$(BITS).o ptrace.o ptrace_$(BITS).o \
1818
reboot.o return_address.o \
1919
setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o \

‎arch/sh/kernel/kdebugfs.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <linux/module.h>
2+
#include <linux/init.h>
3+
#include <linux/debugfs.h>
4+
5+
struct dentry *arch_debugfs_dir;
6+
EXPORT_SYMBOL(arch_debugfs_dir);
7+
8+
static int __init arch_kdebugfs_init(void)
9+
{
10+
arch_debugfs_dir = debugfs_create_dir("sh", NULL);
11+
if (!arch_debugfs_dir)
12+
return -ENOMEM;
13+
14+
return 0;
15+
}
16+
arch_initcall(arch_kdebugfs_init);

‎arch/sh/kernel/setup.c‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <linux/module.h>
2525
#include <linux/smp.h>
2626
#include <linux/err.h>
27-
#include <linux/debugfs.h>
2827
#include <linux/crash_dump.h>
2928
#include <linux/mmzone.h>
3029
#include <linux/clk.h>
@@ -458,17 +457,3 @@ const struct seq_operations cpuinfo_op = {
458457
.show = show_cpuinfo,
459458
};
460459
#endif /* CONFIG_PROC_FS */
461-
462-
struct dentry *sh_debugfs_root;
463-
464-
static int __init sh_debugfs_init(void)
465-
{
466-
sh_debugfs_root = debugfs_create_dir("sh", NULL);
467-
if (!sh_debugfs_root)
468-
return -ENOMEM;
469-
if (IS_ERR(sh_debugfs_root))
470-
return PTR_ERR(sh_debugfs_root);
471-
472-
return 0;
473-
}
474-
arch_initcall(sh_debugfs_init);

‎arch/sh/mm/asids-debugfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static int __init asids_debugfs_init(void)
6363
{
6464
struct dentry *asids_dentry;
6565

66-
asids_dentry = debugfs_create_file("asids", S_IRUSR, sh_debugfs_root,
66+
asids_dentry = debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir,
6767
NULL, &asids_debugfs_fops);
6868
if (!asids_dentry)
6969
return -ENOMEM;

‎arch/sh/mm/cache-debugfs.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,19 @@ static int __init cache_debugfs_init(void)
126126
{
127127
struct dentry *dcache_dentry, *icache_dentry;
128128

129-
dcache_dentry = debugfs_create_file("dcache", S_IRUSR, sh_debugfs_root,
129+
dcache_dentry = debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir,
130130
(unsigned int *)CACHE_TYPE_DCACHE,
131131
&cache_debugfs_fops);
132132
if (!dcache_dentry)
133133
return -ENOMEM;
134-
if (IS_ERR(dcache_dentry))
135-
return PTR_ERR(dcache_dentry);
136134

137-
icache_dentry = debugfs_create_file("icache", S_IRUSR, sh_debugfs_root,
135+
icache_dentry = debugfs_create_file("icache", S_IRUSR, arch_debugfs_dir,
138136
(unsigned int *)CACHE_TYPE_ICACHE,
139137
&cache_debugfs_fops);
140138
if (!icache_dentry) {
141139
debugfs_remove(dcache_dentry);
142140
return -ENOMEM;
143141
}
144-
if (IS_ERR(icache_dentry)) {
145-
debugfs_remove(dcache_dentry);
146-
return PTR_ERR(icache_dentry);
147-
}
148142

149143
return 0;
150144
}

‎arch/sh/mm/pmb.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,11 +866,9 @@ static int __init pmb_debugfs_init(void)
866866
struct dentry *dentry;
867867

868868
dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO,
869-
sh_debugfs_root, NULL, &pmb_debugfs_fops);
869+
arch_debugfs_dir, NULL, &pmb_debugfs_fops);
870870
if (!dentry)
871871
return -ENOMEM;
872-
if (IS_ERR(dentry))
873-
return PTR_ERR(dentry);
874872

875873
return 0;
876874
}

‎arch/sh/mm/tlb-debugfs.c‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,27 +151,20 @@ static int __init tlb_debugfs_init(void)
151151
{
152152
struct dentry *itlb, *utlb;
153153

154-
itlb = debugfs_create_file("itlb", S_IRUSR, sh_debugfs_root,
154+
itlb = debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir,
155155
(unsigned int *)TLB_TYPE_ITLB,
156156
&tlb_debugfs_fops);
157157
if (unlikely(!itlb))
158158
return -ENOMEM;
159-
if (IS_ERR(itlb))
160-
return PTR_ERR(itlb);
161159

162-
utlb = debugfs_create_file("utlb", S_IRUSR, sh_debugfs_root,
160+
utlb = debugfs_create_file("utlb", S_IRUSR, arch_debugfs_dir,
163161
(unsigned int *)TLB_TYPE_UTLB,
164162
&tlb_debugfs_fops);
165163
if (unlikely(!utlb)) {
166164
debugfs_remove(itlb);
167165
return -ENOMEM;
168166
}
169167

170-
if (IS_ERR(utlb)) {
171-
debugfs_remove(itlb);
172-
return PTR_ERR(utlb);
173-
}
174-
175168
return 0;
176169
}
177170
module_init(tlb_debugfs_init);

0 commit comments

Comments
 (0)