aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-05-15 09:57:23 -0400
committerChristoph Hellwig <hch@lst.de>2018-05-16 01:23:35 -0400
commit3f3942aca6da351a12543aa776467791b63b3a78 (patch)
tree31030e086ea36920e07078ea2289b9b72c0b2939
parent44414d82cfe0f68cb59d0a42f599ccd893ae0032 (diff)
proc: introduce proc_create_single{,_data}
Variants of proc_create{,_data} that directly take a seq_file show callback and drastically reduces the boilerplate code in the callers. All trivial callers converted over. Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--arch/arm/kernel/dma.c14
-rw-r--r--arch/arm/kernel/swp_emulate.c15
-rw-r--r--arch/arm/mach-rpc/ecard.c16
-rw-r--r--arch/ia64/kernel/palinfo.c16
-rw-r--r--arch/ia64/kernel/salinfo.c42
-rw-r--r--arch/ia64/sn/kernel/sn2/prominfo_proc.c32
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c62
-rw-r--r--arch/m68k/kernel/setup_mm.c14
-rw-r--r--arch/mips/pci/ops-pmcmsp.c28
-rw-r--r--arch/mips/sibyte/common/bus_watcher.c16
-rw-r--r--arch/parisc/kernel/pci-dma.c17
-rw-r--r--arch/parisc/kernel/pdc_chassis.c14
-rw-r--r--arch/powerpc/kernel/eeh.c14
-rw-r--r--arch/powerpc/kernel/rtas-proc.c32
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c14
-rw-r--r--arch/s390/kernel/sysinfo.c14
-rw-r--r--arch/sh/drivers/dma/dma-api.c14
-rw-r--r--arch/sparc/kernel/ioport.c19
-rw-r--r--arch/um/drivers/ubd_kern.c16
-rw-r--r--arch/x86/kernel/apm_32.c15
-rw-r--r--drivers/acpi/ac.c21
-rw-r--r--drivers/acpi/button.c19
-rw-r--r--drivers/block/DAC960.c49
-rw-r--r--drivers/block/pktcdvd.c14
-rw-r--r--drivers/block/ps3vram.c17
-rw-r--r--drivers/char/apm-emulation.c15
-rw-r--r--drivers/char/ds1620.c14
-rw-r--r--drivers/char/efirtc.c15
-rw-r--r--drivers/char/nvram.c15
-rw-r--r--drivers/char/rtc.c19
-rw-r--r--drivers/char/toshiba.c15
-rw-r--r--drivers/connector/connector.c15
-rw-r--r--drivers/input/misc/hp_sdc_rtc.c14
-rw-r--r--drivers/isdn/capi/capi.c30
-rw-r--r--drivers/isdn/capi/capidrv.c15
-rw-r--r--drivers/isdn/hardware/eicon/diva_didd.c17
-rw-r--r--drivers/isdn/hardware/eicon/divasi.c17
-rw-r--r--drivers/macintosh/via-pmu.c57
-rw-r--r--drivers/media/pci/saa7164/saa7164-core.c14
-rw-r--r--drivers/media/pci/zoran/videocodec.c16
-rw-r--r--drivers/message/fusion/mptbase.c57
-rw-r--r--drivers/mtd/mtdcore.c14
-rw-r--r--drivers/net/wireless/atmel/atmel.c15
-rw-r--r--drivers/net/wireless/intersil/hostap/hostap_ap.c16
-rw-r--r--drivers/net/wireless/ray_cs.c15
-rw-r--r--drivers/nubus/proc.c51
-rw-r--r--drivers/parisc/ccio-dma.c34
-rw-r--r--drivers/parisc/sba_iommu.c32
-rw-r--r--drivers/platform/x86/toshiba_acpi.c17
-rw-r--r--drivers/pnp/pnpbios/proc.c78
-rw-r--r--drivers/staging/comedi/proc.c18
-rw-r--r--drivers/usb/gadget/udc/at91_udc.c16
-rw-r--r--drivers/usb/gadget/udc/fsl_udc_core.c18
-rw-r--r--drivers/usb/gadget/udc/goku_udc.c18
-rw-r--r--drivers/usb/gadget/udc/omap_udc.c15
-rw-r--r--drivers/video/fbdev/via/viafbdev.c17
-rw-r--r--fs/cifs/cifs_debug.c15
-rw-r--r--fs/f2fs/sysfs.c29
-rw-r--r--fs/filesystems.c14
-rw-r--r--fs/fscache/internal.h2
-rw-r--r--fs/fscache/proc.c4
-rw-r--r--fs/fscache/stats.c17
-rw-r--r--fs/proc/cmdline.c14
-rw-r--r--fs/proc/generic.c29
-rw-r--r--fs/proc/internal.h5
-rw-r--r--fs/proc/loadavg.c14
-rw-r--r--fs/proc/meminfo.c14
-rw-r--r--fs/proc/softirqs.c14
-rw-r--r--fs/proc/uptime.c14
-rw-r--r--fs/proc/version.c14
-rw-r--r--fs/reiserfs/procfs.c16
-rw-r--r--fs/xfs/xfs_stats.c31
-rw-r--r--include/linux/proc_fs.h10
-rw-r--r--kernel/cgroup/cgroup-internal.h2
-rw-r--r--kernel/cgroup/cgroup-v1.c14
-rw-r--r--kernel/cgroup/cgroup.c2
-rw-r--r--kernel/dma.c14
-rw-r--r--kernel/exec_domain.c14
-rw-r--r--kernel/irq/proc.c82
-rw-r--r--kernel/locking/lockdep_proc.c16
-rw-r--r--net/8021q/vlanproc.c21
-rw-r--r--net/ipv4/ipconfig.c14
-rw-r--r--net/ipv4/route.c15
-rw-r--r--net/ipv6/proc.c17
-rw-r--r--net/sched/sch_api.c14
85 files changed, 235 insertions, 1509 deletions
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index e651c4d0a0d9..6739d37c2bc5 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -276,21 +276,9 @@ static int proc_dma_show(struct seq_file *m, void *v)
276 return 0; 276 return 0;
277} 277}
278 278
279static int proc_dma_open(struct inode *inode, struct file *file)
280{
281 return single_open(file, proc_dma_show, NULL);
282}
283
284static const struct file_operations proc_dma_operations = {
285 .open = proc_dma_open,
286 .read = seq_read,
287 .llseek = seq_lseek,
288 .release = single_release,
289};
290
291static int __init proc_dma_init(void) 279static int __init proc_dma_init(void)
292{ 280{
293 proc_create("dma", 0, NULL, &proc_dma_operations); 281 proc_create_single("dma", 0, NULL, proc_dma_show);
294 return 0; 282 return 0;
295} 283}
296 284
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c
index 3bda08bee674..6e971e114879 100644
--- a/arch/arm/kernel/swp_emulate.c
+++ b/arch/arm/kernel/swp_emulate.c
@@ -91,18 +91,6 @@ static int proc_status_show(struct seq_file *m, void *v)
91 seq_printf(m, "Last process:\t\t%d\n", previous_pid); 91 seq_printf(m, "Last process:\t\t%d\n", previous_pid);
92 return 0; 92 return 0;
93} 93}
94
95static int proc_status_open(struct inode *inode, struct file *file)
96{
97 return single_open(file, proc_status_show, PDE_DATA(inode));
98}
99
100static const struct file_operations proc_status_fops = {
101 .open = proc_status_open,
102 .read = seq_read,
103 .llseek = seq_lseek,
104 .release = single_release,
105};
106#endif 94#endif
107 95
108/* 96/*
@@ -260,7 +248,8 @@ static int __init swp_emulation_init(void)
260 return 0; 248 return 0;
261 249
262#ifdef CONFIG_PROC_FS 250#ifdef CONFIG_PROC_FS
263 if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops)) 251 if (!proc_create_single("cpu/swp_emulation", S_IRUGO, NULL,
252 proc_status_show))
264 return -ENOMEM; 253 return -ENOMEM;
265#endif /* CONFIG_PROC_FS */ 254#endif /* CONFIG_PROC_FS */
266 255
diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index bdb5ec1cf560..39aef4876ed4 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -657,25 +657,13 @@ static int ecard_devices_proc_show(struct seq_file *m, void *v)
657 return 0; 657 return 0;
658} 658}
659 659
660static int ecard_devices_proc_open(struct inode *inode, struct file *file)
661{
662 return single_open(file, ecard_devices_proc_show, NULL);
663}
664
665static const struct file_operations bus_ecard_proc_fops = {
666 .owner = THIS_MODULE,
667 .open = ecard_devices_proc_open,
668 .read = seq_read,
669 .llseek = seq_lseek,
670 .release = single_release,
671};
672
673static struct proc_dir_entry *proc_bus_ecard_dir = NULL; 660static struct proc_dir_entry *proc_bus_ecard_dir = NULL;
674 661
675static void ecard_proc_init(void) 662static void ecard_proc_init(void)
676{ 663{
677 proc_bus_ecard_dir = proc_mkdir("bus/ecard", NULL); 664 proc_bus_ecard_dir = proc_mkdir("bus/ecard", NULL);
678 proc_create("devices", 0, proc_bus_ecard_dir, &bus_ecard_proc_fops); 665 proc_create_single("devices", 0, proc_bus_ecard_dir,
666 ecard_devices_proc_show);
679} 667}
680 668
681#define ec_set_resource(ec,nr,st,sz) \ 669#define ec_set_resource(ec,nr,st,sz) \
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index b6e597860888..f4a94241265c 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -920,18 +920,6 @@ static int proc_palinfo_show(struct seq_file *m, void *v)
920 return 0; 920 return 0;
921} 921}
922 922
923static int proc_palinfo_open(struct inode *inode, struct file *file)
924{
925 return single_open(file, proc_palinfo_show, PDE_DATA(inode));
926}
927
928static const struct file_operations proc_palinfo_fops = {
929 .open = proc_palinfo_open,
930 .read = seq_read,
931 .llseek = seq_lseek,
932 .release = single_release,
933};
934
935static int palinfo_add_proc(unsigned int cpu) 923static int palinfo_add_proc(unsigned int cpu)
936{ 924{
937 pal_func_cpu_u_t f; 925 pal_func_cpu_u_t f;
@@ -948,8 +936,8 @@ static int palinfo_add_proc(unsigned int cpu)
948 936
949 for (j=0; j < NR_PALINFO_ENTRIES; j++) { 937 for (j=0; j < NR_PALINFO_ENTRIES; j++) {
950 f.func_id = j; 938 f.func_id = j;
951 proc_create_data(palinfo_entries[j].name, 0, cpu_dir, 939 proc_create_single_data(palinfo_entries[j].name, 0, cpu_dir,
952 &proc_palinfo_fops, (void *)f.value); 940 proc_palinfo_show, (void *)f.value);
953 } 941 }
954 return 0; 942 return 0;
955} 943}
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index 52c404b08904..aba1f463a8dd 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -54,8 +54,6 @@ MODULE_AUTHOR("Jesse Barnes <jbarnes@sgi.com>");
54MODULE_DESCRIPTION("/proc interface to IA-64 SAL features"); 54MODULE_DESCRIPTION("/proc interface to IA-64 SAL features");
55MODULE_LICENSE("GPL"); 55MODULE_LICENSE("GPL");
56 56
57static const struct file_operations proc_salinfo_fops;
58
59typedef struct { 57typedef struct {
60 const char *name; /* name of the proc entry */ 58 const char *name; /* name of the proc entry */
61 unsigned long feature; /* feature bit */ 59 unsigned long feature; /* feature bit */
@@ -578,6 +576,17 @@ static int salinfo_cpu_pre_down(unsigned int cpu)
578 return 0; 576 return 0;
579} 577}
580 578
579/*
580 * 'data' contains an integer that corresponds to the feature we're
581 * testing
582 */
583static int proc_salinfo_show(struct seq_file *m, void *v)
584{
585 unsigned long data = (unsigned long)v;
586 seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n");
587 return 0;
588}
589
581static int __init 590static int __init
582salinfo_init(void) 591salinfo_init(void)
583{ 592{
@@ -593,9 +602,9 @@ salinfo_init(void)
593 602
594 for (i=0; i < NR_SALINFO_ENTRIES; i++) { 603 for (i=0; i < NR_SALINFO_ENTRIES; i++) {
595 /* pass the feature bit in question as misc data */ 604 /* pass the feature bit in question as misc data */
596 *sdir++ = proc_create_data(salinfo_entries[i].name, 0, salinfo_dir, 605 *sdir++ = proc_create_single_data(salinfo_entries[i].name, 0,
597 &proc_salinfo_fops, 606 salinfo_dir, proc_salinfo_show,
598 (void *)salinfo_entries[i].feature); 607 (void *)salinfo_entries[i].feature);
599 } 608 }
600 609
601 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { 610 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
@@ -633,27 +642,4 @@ salinfo_init(void)
633 return 0; 642 return 0;
634} 643}
635 644
636/*
637 * 'data' contains an integer that corresponds to the feature we're
638 * testing
639 */
640static int proc_salinfo_show(struct seq_file *m, void *v)
641{
642 unsigned long data = (unsigned long)v;
643 seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n");
644 return 0;
645}
646
647static int proc_salinfo_open(struct inode *inode, struct file *file)
648{
649 return single_open(file, proc_salinfo_show, PDE_DATA(inode));
650}
651
652static const struct file_operations proc_salinfo_fops = {
653 .open = proc_salinfo_open,
654 .read = seq_read,
655 .llseek = seq_lseek,
656 .release = single_release,
657};
658
659module_init(salinfo_init); 645module_init(salinfo_init);
diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
index ec4de2b09653..e15457bf21ac 100644
--- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c
+++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
@@ -140,18 +140,6 @@ static int proc_fit_show(struct seq_file *m, void *v)
140 return 0; 140 return 0;
141} 141}
142 142
143static int proc_fit_open(struct inode *inode, struct file *file)
144{
145 return single_open(file, proc_fit_show, PDE_DATA(inode));
146}
147
148static const struct file_operations proc_fit_fops = {
149 .open = proc_fit_open,
150 .read = seq_read,
151 .llseek = seq_lseek,
152 .release = single_release,
153};
154
155static int proc_version_show(struct seq_file *m, void *v) 143static int proc_version_show(struct seq_file *m, void *v)
156{ 144{
157 unsigned long nasid = (unsigned long)m->private; 145 unsigned long nasid = (unsigned long)m->private;
@@ -174,18 +162,6 @@ static int proc_version_show(struct seq_file *m, void *v)
174 return 0; 162 return 0;
175} 163}
176 164
177static int proc_version_open(struct inode *inode, struct file *file)
178{
179 return single_open(file, proc_version_show, PDE_DATA(inode));
180}
181
182static const struct file_operations proc_version_fops = {
183 .open = proc_version_open,
184 .read = seq_read,
185 .llseek = seq_lseek,
186 .release = single_release,
187};
188
189/* module entry points */ 165/* module entry points */
190int __init prominfo_init(void); 166int __init prominfo_init(void);
191void __exit prominfo_exit(void); 167void __exit prominfo_exit(void);
@@ -217,10 +193,10 @@ int __init prominfo_init(void)
217 if (!dir) 193 if (!dir)
218 continue; 194 continue;
219 nasid = cnodeid_to_nasid(cnodeid); 195 nasid = cnodeid_to_nasid(cnodeid);
220 proc_create_data("fit", 0, dir, 196 proc_create_single_data("fit", 0, dir, proc_fit_show,
221 &proc_fit_fops, (void *)nasid); 197 (void *)nasid);
222 proc_create_data("version", 0, dir, 198 proc_create_single_data("version", 0, dir, proc_version_show,
223 &proc_version_fops, (void *)nasid); 199 (void *)nasid);
224 } 200 }
225 return 0; 201 return 0;
226} 202}
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index 29cf8f8c08e9..c2a4d84297b0 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -18,33 +18,18 @@ static int partition_id_show(struct seq_file *s, void *p)
18 return 0; 18 return 0;
19} 19}
20 20
21static int partition_id_open(struct inode *inode, struct file *file)
22{
23 return single_open(file, partition_id_show, NULL);
24}
25
26static int system_serial_number_show(struct seq_file *s, void *p) 21static int system_serial_number_show(struct seq_file *s, void *p)
27{ 22{
28 seq_printf(s, "%s\n", sn_system_serial_number()); 23 seq_printf(s, "%s\n", sn_system_serial_number());
29 return 0; 24 return 0;
30} 25}
31 26
32static int system_serial_number_open(struct inode *inode, struct file *file)
33{
34 return single_open(file, system_serial_number_show, NULL);
35}
36
37static int licenseID_show(struct seq_file *s, void *p) 27static int licenseID_show(struct seq_file *s, void *p)
38{ 28{
39 seq_printf(s, "0x%llx\n", sn_partition_serial_number_val()); 29 seq_printf(s, "0x%llx\n", sn_partition_serial_number_val());
40 return 0; 30 return 0;
41} 31}
42 32
43static int licenseID_open(struct inode *inode, struct file *file)
44{
45 return single_open(file, licenseID_show, NULL);
46}
47
48static int coherence_id_show(struct seq_file *s, void *p) 33static int coherence_id_show(struct seq_file *s, void *p)
49{ 34{
50 seq_printf(s, "%d\n", partition_coherence_id()); 35 seq_printf(s, "%d\n", partition_coherence_id());
@@ -52,43 +37,10 @@ static int coherence_id_show(struct seq_file *s, void *p)
52 return 0; 37 return 0;
53} 38}
54 39
55static int coherence_id_open(struct inode *inode, struct file *file)
56{
57 return single_open(file, coherence_id_show, NULL);
58}
59
60/* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ 40/* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */
61extern int sn_topology_open(struct inode *, struct file *); 41extern int sn_topology_open(struct inode *, struct file *);
62extern int sn_topology_release(struct inode *, struct file *); 42extern int sn_topology_release(struct inode *, struct file *);
63 43
64static const struct file_operations proc_partition_id_fops = {
65 .open = partition_id_open,
66 .read = seq_read,
67 .llseek = seq_lseek,
68 .release = single_release,
69};
70
71static const struct file_operations proc_system_sn_fops = {
72 .open = system_serial_number_open,
73 .read = seq_read,
74 .llseek = seq_lseek,
75 .release = single_release,
76};
77
78static const struct file_operations proc_license_id_fops = {
79 .open = licenseID_open,
80 .read = seq_read,
81 .llseek = seq_lseek,
82 .release = single_release,
83};
84
85static const struct file_operations proc_coherence_id_fops = {
86 .open = coherence_id_open,
87 .read = seq_read,
88 .llseek = seq_lseek,
89 .release = single_release,
90};
91
92static const struct file_operations proc_sn_topo_fops = { 44static const struct file_operations proc_sn_topo_fops = {
93 .open = sn_topology_open, 45 .open = sn_topology_open,
94 .read = seq_read, 46 .read = seq_read,
@@ -104,13 +56,13 @@ void register_sn_procfs(void)
104 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) 56 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL)))
105 return; 57 return;
106 58
107 proc_create("partition_id", 0444, sgi_proc_dir, 59 proc_create_single("partition_id", 0444, sgi_proc_dir,
108 &proc_partition_id_fops); 60 partition_id_show);
109 proc_create("system_serial_number", 0444, sgi_proc_dir, 61 proc_create_single("system_serial_number", 0444, sgi_proc_dir,
110 &proc_system_sn_fops); 62 system_serial_number_show);
111 proc_create("licenseID", 0444, sgi_proc_dir, &proc_license_id_fops); 63 proc_create_single("licenseID", 0444, sgi_proc_dir, licenseID_show);
112 proc_create("coherence_id", 0444, sgi_proc_dir, 64 proc_create_single("coherence_id", 0444, sgi_proc_dir,
113 &proc_coherence_id_fops); 65 coherence_id_show);
114 proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops); 66 proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops);
115} 67}
116 68
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index dd25bfc22fb4..f35e3ebd6331 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -527,21 +527,9 @@ static int hardware_proc_show(struct seq_file *m, void *v)
527 return 0; 527 return 0;
528} 528}
529 529
530static int hardware_proc_open(struct inode *inode, struct file *file)
531{
532 return single_open(file, hardware_proc_show, NULL);
533}
534
535static const struct file_operations hardware_proc_fops = {
536 .open = hardware_proc_open,
537 .read = seq_read,
538 .llseek = seq_lseek,
539 .release = single_release,
540};
541
542static int __init proc_hardware_init(void) 530static int __init proc_hardware_init(void)
543{ 531{
544 proc_create("hardware", 0, NULL, &hardware_proc_fops); 532 proc_create_single("hardware", 0, NULL, hardware_proc_show);
545 return 0; 533 return 0;
546} 534}
547module_init(proc_hardware_init); 535module_init(proc_hardware_init);
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c
index dd2d9f7e9412..7649372103af 100644
--- a/arch/mips/pci/ops-pmcmsp.c
+++ b/arch/mips/pci/ops-pmcmsp.c
@@ -83,18 +83,6 @@ static int show_msp_pci_counts(struct seq_file *m, void *v)
83 return 0; 83 return 0;
84} 84}
85 85
86static int msp_pci_rd_cnt_open(struct inode *inode, struct file *file)
87{
88 return single_open(file, show_msp_pci_counts, NULL);
89}
90
91static const struct file_operations msp_pci_rd_cnt_fops = {
92 .open = msp_pci_rd_cnt_open,
93 .read = seq_read,
94 .llseek = seq_lseek,
95 .release = single_release,
96};
97
98/***************************************************************************** 86/*****************************************************************************
99 * 87 *
100 * FUNCTION: gen_pci_cfg_wr_show 88 * FUNCTION: gen_pci_cfg_wr_show
@@ -160,18 +148,6 @@ static int gen_pci_cfg_wr_show(struct seq_file *m, void *v)
160 return 0; 148 return 0;
161} 149}
162 150
163static int gen_pci_cfg_wr_open(struct inode *inode, struct file *file)
164{
165 return single_open(file, gen_pci_cfg_wr_show, NULL);
166}
167
168static const struct file_operations gen_pci_cfg_wr_fops = {
169 .open = gen_pci_cfg_wr_open,
170 .read = seq_read,
171 .llseek = seq_lseek,
172 .release = single_release,
173};
174
175/***************************************************************************** 151/*****************************************************************************
176 * 152 *
177 * FUNCTION: pci_proc_init 153 * FUNCTION: pci_proc_init
@@ -188,8 +164,8 @@ static const struct file_operations gen_pci_cfg_wr_fops = {
188 ****************************************************************************/ 164 ****************************************************************************/
189static void pci_proc_init(void) 165static void pci_proc_init(void)
190{ 166{
191 proc_create("pmc_msp_pci_rd_cnt", 0, NULL, &msp_pci_rd_cnt_fops); 167 proc_create_single("pmc_msp_pci_rd_cnt", 0, NULL, show_msp_pci_counts);
192 proc_create("pmc_msp_pci_cfg_wr", 0, NULL, &gen_pci_cfg_wr_fops); 168 proc_create_single("pmc_msp_pci_cfg_wr", 0, NULL, gen_pci_cfg_wr_show);
193} 169}
194#endif /* CONFIG_PROC_FS && PCI_COUNTERS */ 170#endif /* CONFIG_PROC_FS && PCI_COUNTERS */
195 171
diff --git a/arch/mips/sibyte/common/bus_watcher.c b/arch/mips/sibyte/common/bus_watcher.c
index a4e55999ecb4..4bb85de9229b 100644
--- a/arch/mips/sibyte/common/bus_watcher.c
+++ b/arch/mips/sibyte/common/bus_watcher.c
@@ -142,24 +142,12 @@ static int bw_proc_show(struct seq_file *m, void *v)
142 return 0; 142 return 0;
143} 143}
144 144
145static int bw_proc_open(struct inode *inode, struct file *file)
146{
147 return single_open(file, bw_proc_show, PDE_DATA(inode));
148}
149
150static const struct file_operations bw_proc_fops = {
151 .open = bw_proc_open,
152 .read = seq_read,
153 .llseek = seq_lseek,
154 .release = single_release,
155};
156
157static void create_proc_decoder(struct bw_stats_struct *stats) 145static void create_proc_decoder(struct bw_stats_struct *stats)
158{ 146{
159 struct proc_dir_entry *ent; 147 struct proc_dir_entry *ent;
160 148
161 ent = proc_create_data("bus_watcher", S_IWUSR | S_IRUGO, NULL, 149 ent = proc_create_single_data("bus_watcher", S_IWUSR | S_IRUGO, NULL,
162 &bw_proc_fops, stats); 150 bw_proc_show, stats);
163 if (!ent) { 151 if (!ent) {
164 printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n"); 152 printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n");
165 return; 153 return;
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 91bc0cac03a1..6df07ce4f3c2 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -367,19 +367,6 @@ static int proc_pcxl_dma_show(struct seq_file *m, void *v)
367 return 0; 367 return 0;
368} 368}
369 369
370static int proc_pcxl_dma_open(struct inode *inode, struct file *file)
371{
372 return single_open(file, proc_pcxl_dma_show, NULL);
373}
374
375static const struct file_operations proc_pcxl_dma_ops = {
376 .owner = THIS_MODULE,
377 .open = proc_pcxl_dma_open,
378 .read = seq_read,
379 .llseek = seq_lseek,
380 .release = single_release,
381};
382
383static int __init 370static int __init
384pcxl_dma_init(void) 371pcxl_dma_init(void)
385{ 372{
@@ -397,8 +384,8 @@ pcxl_dma_init(void)
397 "pcxl_dma_init: Unable to create gsc /proc dir entry\n"); 384 "pcxl_dma_init: Unable to create gsc /proc dir entry\n");
398 else { 385 else {
399 struct proc_dir_entry* ent; 386 struct proc_dir_entry* ent;
400 ent = proc_create("pcxl_dma", 0, proc_gsc_root, 387 ent = proc_create_single("pcxl_dma", 0, proc_gsc_root,
401 &proc_pcxl_dma_ops); 388 proc_pcxl_dma_show);
402 if (!ent) 389 if (!ent)
403 printk(KERN_WARNING 390 printk(KERN_WARNING
404 "pci-dma.c: Unable to create pcxl_dma /proc entry.\n"); 391 "pci-dma.c: Unable to create pcxl_dma /proc entry.\n");
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c
index 3e04242de5a7..28e07482b0f1 100644
--- a/arch/parisc/kernel/pdc_chassis.c
+++ b/arch/parisc/kernel/pdc_chassis.c
@@ -266,18 +266,6 @@ static int pdc_chassis_warn_show(struct seq_file *m, void *v)
266 return 0; 266 return 0;
267} 267}
268 268
269static int pdc_chassis_warn_open(struct inode *inode, struct file *file)
270{
271 return single_open(file, pdc_chassis_warn_show, NULL);
272}
273
274static const struct file_operations pdc_chassis_warn_fops = {
275 .open = pdc_chassis_warn_open,
276 .read = seq_read,
277 .llseek = seq_lseek,
278 .release = single_release,
279};
280
281static int __init pdc_chassis_create_procfs(void) 269static int __init pdc_chassis_create_procfs(void)
282{ 270{
283 unsigned long test; 271 unsigned long test;
@@ -292,7 +280,7 @@ static int __init pdc_chassis_create_procfs(void)
292 280
293 printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n", 281 printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n",
294 PDC_CHASSIS_VER); 282 PDC_CHASSIS_VER);
295 proc_create("chassis", 0400, NULL, &pdc_chassis_warn_fops); 283 proc_create_single("chassis", 0400, NULL, pdc_chassis_warn_show);
296 return 0; 284 return 0;
297} 285}
298 286
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index bc640e4c5ca5..90bb39b1a23c 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1775,18 +1775,6 @@ static int proc_eeh_show(struct seq_file *m, void *v)
1775 return 0; 1775 return 0;
1776} 1776}
1777 1777
1778static int proc_eeh_open(struct inode *inode, struct file *file)
1779{
1780 return single_open(file, proc_eeh_show, NULL);
1781}
1782
1783static const struct file_operations proc_eeh_operations = {
1784 .open = proc_eeh_open,
1785 .read = seq_read,
1786 .llseek = seq_lseek,
1787 .release = single_release,
1788};
1789
1790#ifdef CONFIG_DEBUG_FS 1778#ifdef CONFIG_DEBUG_FS
1791static int eeh_enable_dbgfs_set(void *data, u64 val) 1779static int eeh_enable_dbgfs_set(void *data, u64 val)
1792{ 1780{
@@ -1828,7 +1816,7 @@ DEFINE_SIMPLE_ATTRIBUTE(eeh_freeze_dbgfs_ops, eeh_freeze_dbgfs_get,
1828static int __init eeh_init_proc(void) 1816static int __init eeh_init_proc(void)
1829{ 1817{
1830 if (machine_is(pseries) || machine_is(powernv)) { 1818 if (machine_is(pseries) || machine_is(powernv)) {
1831 proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations); 1819 proc_create_single("powerpc/eeh", 0, NULL, proc_eeh_show);
1832#ifdef CONFIG_DEBUG_FS 1820#ifdef CONFIG_DEBUG_FS
1833 debugfs_create_file("eeh_enable", 0600, 1821 debugfs_create_file("eeh_enable", 0600,
1834 powerpc_debugfs_root, NULL, 1822 powerpc_debugfs_root, NULL,
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index fb070d8cad07..d49063d0baa4 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -154,18 +154,6 @@ static ssize_t ppc_rtas_tone_volume_write(struct file *file,
154static int ppc_rtas_tone_volume_show(struct seq_file *m, void *v); 154static int ppc_rtas_tone_volume_show(struct seq_file *m, void *v);
155static int ppc_rtas_rmo_buf_show(struct seq_file *m, void *v); 155static int ppc_rtas_rmo_buf_show(struct seq_file *m, void *v);
156 156
157static int sensors_open(struct inode *inode, struct file *file)
158{
159 return single_open(file, ppc_rtas_sensors_show, NULL);
160}
161
162static const struct file_operations ppc_rtas_sensors_operations = {
163 .open = sensors_open,
164 .read = seq_read,
165 .llseek = seq_lseek,
166 .release = single_release,
167};
168
169static int poweron_open(struct inode *inode, struct file *file) 157static int poweron_open(struct inode *inode, struct file *file)
170{ 158{
171 return single_open(file, ppc_rtas_poweron_show, NULL); 159 return single_open(file, ppc_rtas_poweron_show, NULL);
@@ -231,18 +219,6 @@ static const struct file_operations ppc_rtas_tone_volume_operations = {
231 .release = single_release, 219 .release = single_release,
232}; 220};
233 221
234static int rmo_buf_open(struct inode *inode, struct file *file)
235{
236 return single_open(file, ppc_rtas_rmo_buf_show, NULL);
237}
238
239static const struct file_operations ppc_rtas_rmo_buf_ops = {
240 .open = rmo_buf_open,
241 .read = seq_read,
242 .llseek = seq_lseek,
243 .release = single_release,
244};
245
246static int ppc_rtas_find_all_sensors(void); 222static int ppc_rtas_find_all_sensors(void);
247static void ppc_rtas_process_sensor(struct seq_file *m, 223static void ppc_rtas_process_sensor(struct seq_file *m,
248 struct individual_sensor *s, int state, int error, const char *loc); 224 struct individual_sensor *s, int state, int error, const char *loc);
@@ -267,14 +243,14 @@ static int __init proc_rtas_init(void)
267 &ppc_rtas_clock_operations); 243 &ppc_rtas_clock_operations);
268 proc_create("powerpc/rtas/poweron", 0644, NULL, 244 proc_create("powerpc/rtas/poweron", 0644, NULL,
269 &ppc_rtas_poweron_operations); 245 &ppc_rtas_poweron_operations);
270 proc_create("powerpc/rtas/sensors", 0444, NULL, 246 proc_create_single("powerpc/rtas/sensors", 0444, NULL,
271 &ppc_rtas_sensors_operations); 247 ppc_rtas_sensors_show);
272 proc_create("powerpc/rtas/frequency", 0644, NULL, 248 proc_create("powerpc/rtas/frequency", 0644, NULL,
273 &ppc_rtas_tone_freq_operations); 249 &ppc_rtas_tone_freq_operations);
274 proc_create("powerpc/rtas/volume", 0644, NULL, 250 proc_create("powerpc/rtas/volume", 0644, NULL,
275 &ppc_rtas_tone_volume_operations); 251 &ppc_rtas_tone_volume_operations);
276 proc_create("powerpc/rtas/rmo_buffer", 0400, NULL, 252 proc_create_single("powerpc/rtas/rmo_buffer", 0400, NULL,
277 &ppc_rtas_rmo_buf_ops); 253 ppc_rtas_rmo_buf_show);
278 return 0; 254 return 0;
279} 255}
280 256
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index ccc421503363..c9ef3c532169 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -1095,18 +1095,6 @@ static int show_spu_loadavg(struct seq_file *s, void *private)
1095 atomic_read(&nr_spu_contexts), 1095 atomic_read(&nr_spu_contexts),
1096 idr_get_cursor(&task_active_pid_ns(current)->idr) - 1); 1096 idr_get_cursor(&task_active_pid_ns(current)->idr) - 1);
1097 return 0; 1097 return 0;
1098}
1099
1100static int spu_loadavg_open(struct inode *inode, struct file *file)
1101{
1102 return single_open(file, show_spu_loadavg, NULL);
1103}
1104
1105static const struct file_operations spu_loadavg_fops = {
1106 .open = spu_loadavg_open,
1107 .read = seq_read,
1108 .llseek = seq_lseek,
1109 .release = single_release,
1110}; 1098};
1111 1099
1112int __init spu_sched_init(void) 1100int __init spu_sched_init(void)
@@ -1135,7 +1123,7 @@ int __init spu_sched_init(void)
1135 1123
1136 mod_timer(&spuloadavg_timer, 0); 1124 mod_timer(&spuloadavg_timer, 0);
1137 1125
1138 entry = proc_create("spu_loadavg", 0, NULL, &spu_loadavg_fops); 1126 entry = proc_create_single("spu_loadavg", 0, NULL, show_spu_loadavg);
1139 if (!entry) 1127 if (!entry)
1140 goto out_stop_kthread; 1128 goto out_stop_kthread;
1141 1129
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
index fed49601f06d..54f5496913fa 100644
--- a/arch/s390/kernel/sysinfo.c
+++ b/arch/s390/kernel/sysinfo.c
@@ -294,21 +294,9 @@ static int sysinfo_show(struct seq_file *m, void *v)
294 return 0; 294 return 0;
295} 295}
296 296
297static int sysinfo_open(struct inode *inode, struct file *file)
298{
299 return single_open(file, sysinfo_show, NULL);
300}
301
302static const struct file_operations sysinfo_fops = {
303 .open = sysinfo_open,
304 .read = seq_read,
305 .llseek = seq_lseek,
306 .release = single_release,
307};
308
309static int __init sysinfo_create_proc(void) 297static int __init sysinfo_create_proc(void)
310{ 298{
311 proc_create("sysinfo", 0444, NULL, &sysinfo_fops); 299 proc_create_single("sysinfo", 0444, NULL, sysinfo_show);
312 return 0; 300 return 0;
313} 301}
314device_initcall(sysinfo_create_proc); 302device_initcall(sysinfo_create_proc);
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index c0eec08d8f95..b05be597b19f 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -339,18 +339,6 @@ static int dma_proc_show(struct seq_file *m, void *v)
339 return 0; 339 return 0;
340} 340}
341 341
342static int dma_proc_open(struct inode *inode, struct file *file)
343{
344 return single_open(file, dma_proc_show, NULL);
345}
346
347static const struct file_operations dma_proc_fops = {
348 .open = dma_proc_open,
349 .read = seq_read,
350 .llseek = seq_lseek,
351 .release = single_release,
352};
353
354int register_dmac(struct dma_info *info) 342int register_dmac(struct dma_info *info)
355{ 343{
356 unsigned int total_channels, i; 344 unsigned int total_channels, i;
@@ -423,7 +411,7 @@ EXPORT_SYMBOL(unregister_dmac);
423static int __init dma_api_init(void) 411static int __init dma_api_init(void)
424{ 412{
425 printk(KERN_NOTICE "DMA: Registering DMA API.\n"); 413 printk(KERN_NOTICE "DMA: Registering DMA API.\n");
426 return proc_create("dma", 0, NULL, &dma_proc_fops) ? 0 : -ENOMEM; 414 return proc_create_single("dma", 0, NULL, dma_proc_show) ? 0 : -ENOMEM;
427} 415}
428subsys_initcall(dma_api_init); 416subsys_initcall(dma_api_init);
429 417
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 3bcef9ce74df..cca9134cfa7d 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -678,25 +678,14 @@ static int sparc_io_proc_show(struct seq_file *m, void *v)
678 678
679 return 0; 679 return 0;
680} 680}
681
682static int sparc_io_proc_open(struct inode *inode, struct file *file)
683{
684 return single_open(file, sparc_io_proc_show, PDE_DATA(inode));
685}
686
687static const struct file_operations sparc_io_proc_fops = {
688 .owner = THIS_MODULE,
689 .open = sparc_io_proc_open,
690 .read = seq_read,
691 .llseek = seq_lseek,
692 .release = single_release,
693};
694#endif /* CONFIG_PROC_FS */ 681#endif /* CONFIG_PROC_FS */
695 682
696static void register_proc_sparc_ioport(void) 683static void register_proc_sparc_ioport(void)
697{ 684{
698#ifdef CONFIG_PROC_FS 685#ifdef CONFIG_PROC_FS
699 proc_create_data("io_map", 0, NULL, &sparc_io_proc_fops, &sparc_iomap); 686 proc_create_single_data("io_map", 0, NULL, sparc_io_proc_show,
700 proc_create_data("dvma_map", 0, NULL, &sparc_io_proc_fops, &_sparc_dvma); 687 &sparc_iomap);
688 proc_create_single_data("dvma_map", 0, NULL, sparc_io_proc_show,
689 &_sparc_dvma);
701#endif 690#endif
702} 691}
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index d4e8c497ae86..dcf5ea28a281 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -208,19 +208,6 @@ static int fake_ide_media_proc_show(struct seq_file *m, void *v)
208 return 0; 208 return 0;
209} 209}
210 210
211static int fake_ide_media_proc_open(struct inode *inode, struct file *file)
212{
213 return single_open(file, fake_ide_media_proc_show, NULL);
214}
215
216static const struct file_operations fake_ide_media_proc_fops = {
217 .owner = THIS_MODULE,
218 .open = fake_ide_media_proc_open,
219 .read = seq_read,
220 .llseek = seq_lseek,
221 .release = single_release,
222};
223
224static void make_ide_entries(const char *dev_name) 211static void make_ide_entries(const char *dev_name)
225{ 212{
226 struct proc_dir_entry *dir, *ent; 213 struct proc_dir_entry *dir, *ent;
@@ -231,7 +218,8 @@ static void make_ide_entries(const char *dev_name)
231 dir = proc_mkdir(dev_name, proc_ide); 218 dir = proc_mkdir(dev_name, proc_ide);
232 if(!dir) return; 219 if(!dir) return;
233 220
234 ent = proc_create("media", S_IRUGO, dir, &fake_ide_media_proc_fops); 221 ent = proc_create_single("media", S_IRUGO, dir,
222 fake_ide_media_proc_show);
235 if(!ent) return; 223 if(!ent) return;
236 snprintf(name, sizeof(name), "ide0/%s", dev_name); 224 snprintf(name, sizeof(name), "ide0/%s", dev_name);
237 proc_symlink(dev_name, proc_ide_root, name); 225 proc_symlink(dev_name, proc_ide_root, name);
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index dfcbe6924eaf..cadeafabf167 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -1715,19 +1715,6 @@ static int proc_apm_show(struct seq_file *m, void *v)
1715 return 0; 1715 return 0;
1716} 1716}
1717 1717
1718static int proc_apm_open(struct inode *inode, struct file *file)
1719{
1720 return single_open(file, proc_apm_show, NULL);
1721}
1722
1723static const struct file_operations apm_file_ops = {
1724 .owner = THIS_MODULE,
1725 .open = proc_apm_open,
1726 .read = seq_read,
1727 .llseek = seq_lseek,
1728 .release = single_release,
1729};
1730
1731static int apm(void *unused) 1718static int apm(void *unused)
1732{ 1719{
1733 unsigned short bx; 1720 unsigned short bx;
@@ -2360,7 +2347,7 @@ static int __init apm_init(void)
2360 set_desc_base(&gdt[APM_DS >> 3], 2347 set_desc_base(&gdt[APM_DS >> 3],
2361 (unsigned long)__va((unsigned long)apm_info.bios.dseg << 4)); 2348 (unsigned long)__va((unsigned long)apm_info.bios.dseg << 4));
2362 2349
2363 proc_create("apm", 0, NULL, &apm_file_ops); 2350 proc_create_single("apm", 0, NULL, proc_apm_show);
2364 2351
2365 kapmd_task = kthread_create(apm, NULL, "kapmd"); 2352 kapmd_task = kthread_create(apm, NULL, "kapmd");
2366 if (IS_ERR(kapmd_task)) { 2353 if (IS_ERR(kapmd_task)) {
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 2d8de2f8c1ed..84fdfa70920a 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -82,7 +82,6 @@ static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
82#ifdef CONFIG_ACPI_PROCFS_POWER 82#ifdef CONFIG_ACPI_PROCFS_POWER
83extern struct proc_dir_entry *acpi_lock_ac_dir(void); 83extern struct proc_dir_entry *acpi_lock_ac_dir(void);
84extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); 84extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
85static int acpi_ac_open_fs(struct inode *inode, struct file *file);
86#endif 85#endif
87 86
88 87
@@ -111,16 +110,6 @@ struct acpi_ac {
111 110
112#define to_acpi_ac(x) power_supply_get_drvdata(x) 111#define to_acpi_ac(x) power_supply_get_drvdata(x)
113 112
114#ifdef CONFIG_ACPI_PROCFS_POWER
115static const struct file_operations acpi_ac_fops = {
116 .owner = THIS_MODULE,
117 .open = acpi_ac_open_fs,
118 .read = seq_read,
119 .llseek = seq_lseek,
120 .release = single_release,
121};
122#endif
123
124/* -------------------------------------------------------------------------- 113/* --------------------------------------------------------------------------
125 AC Adapter Management 114 AC Adapter Management
126 -------------------------------------------------------------------------- */ 115 -------------------------------------------------------------------------- */
@@ -209,11 +198,6 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
209 return 0; 198 return 0;
210} 199}
211 200
212static int acpi_ac_open_fs(struct inode *inode, struct file *file)
213{
214 return single_open(file, acpi_ac_seq_show, PDE_DATA(inode));
215}
216
217static int acpi_ac_add_fs(struct acpi_ac *ac) 201static int acpi_ac_add_fs(struct acpi_ac *ac)
218{ 202{
219 struct proc_dir_entry *entry = NULL; 203 struct proc_dir_entry *entry = NULL;
@@ -228,9 +212,8 @@ static int acpi_ac_add_fs(struct acpi_ac *ac)
228 } 212 }
229 213
230 /* 'state' [R] */ 214 /* 'state' [R] */
231 entry = proc_create_data(ACPI_AC_FILE_STATE, 215 entry = proc_create_single_data(ACPI_AC_FILE_STATE, S_IRUGO,
232 S_IRUGO, acpi_device_dir(ac->device), 216 acpi_device_dir(ac->device), acpi_ac_seq_show, ac);
233 &acpi_ac_fops, ac);
234 if (!entry) 217 if (!entry)
235 return -ENODEV; 218 return -ENODEV;
236 return 0; 219 return 0;
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index f1cc4f9d31cd..2345a5ee2dbb 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -263,19 +263,6 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
263 return 0; 263 return 0;
264} 264}
265 265
266static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
267{
268 return single_open(file, acpi_button_state_seq_show, PDE_DATA(inode));
269}
270
271static const struct file_operations acpi_button_state_fops = {
272 .owner = THIS_MODULE,
273 .open = acpi_button_state_open_fs,
274 .read = seq_read,
275 .llseek = seq_lseek,
276 .release = single_release,
277};
278
279static int acpi_button_add_fs(struct acpi_device *device) 266static int acpi_button_add_fs(struct acpi_device *device)
280{ 267{
281 struct acpi_button *button = acpi_driver_data(device); 268 struct acpi_button *button = acpi_driver_data(device);
@@ -311,9 +298,9 @@ static int acpi_button_add_fs(struct acpi_device *device)
311 } 298 }
312 299
313 /* create /proc/acpi/button/lid/LID/state */ 300 /* create /proc/acpi/button/lid/LID/state */
314 entry = proc_create_data(ACPI_BUTTON_FILE_STATE, 301 entry = proc_create_single_data(ACPI_BUTTON_FILE_STATE, S_IRUGO,
315 S_IRUGO, acpi_device_dir(device), 302 acpi_device_dir(device), acpi_button_state_seq_show,
316 &acpi_button_state_fops, device); 303 device);
317 if (!entry) { 304 if (!entry) {
318 ret = -ENODEV; 305 ret = -ENODEV;
319 goto remove_dev_dir; 306 goto remove_dev_dir;
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index f781eff7d23e..6918c3d9482e 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -6451,19 +6451,6 @@ static int dac960_proc_show(struct seq_file *m, void *v)
6451 return 0; 6451 return 0;
6452} 6452}
6453 6453
6454static int dac960_proc_open(struct inode *inode, struct file *file)
6455{
6456 return single_open(file, dac960_proc_show, NULL);
6457}
6458
6459static const struct file_operations dac960_proc_fops = {
6460 .owner = THIS_MODULE,
6461 .open = dac960_proc_open,
6462 .read = seq_read,
6463 .llseek = seq_lseek,
6464 .release = single_release,
6465};
6466
6467static int dac960_initial_status_proc_show(struct seq_file *m, void *v) 6454static int dac960_initial_status_proc_show(struct seq_file *m, void *v)
6468{ 6455{
6469 DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private; 6456 DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private;
@@ -6471,19 +6458,6 @@ static int dac960_initial_status_proc_show(struct seq_file *m, void *v)
6471 return 0; 6458 return 0;
6472} 6459}
6473 6460
6474static int dac960_initial_status_proc_open(struct inode *inode, struct file *file)
6475{
6476 return single_open(file, dac960_initial_status_proc_show, PDE_DATA(inode));
6477}
6478
6479static const struct file_operations dac960_initial_status_proc_fops = {
6480 .owner = THIS_MODULE,
6481 .open = dac960_initial_status_proc_open,
6482 .read = seq_read,
6483 .llseek = seq_lseek,
6484 .release = single_release,
6485};
6486
6487static int dac960_current_status_proc_show(struct seq_file *m, void *v) 6461static int dac960_current_status_proc_show(struct seq_file *m, void *v)
6488{ 6462{
6489 DAC960_Controller_T *Controller = (DAC960_Controller_T *) m->private; 6463 DAC960_Controller_T *Controller = (DAC960_Controller_T *) m->private;
@@ -6517,19 +6491,6 @@ static int dac960_current_status_proc_show(struct seq_file *m, void *v)
6517 return 0; 6491 return 0;
6518} 6492}
6519 6493
6520static int dac960_current_status_proc_open(struct inode *inode, struct file *file)
6521{
6522 return single_open(file, dac960_current_status_proc_show, PDE_DATA(inode));
6523}
6524
6525static const struct file_operations dac960_current_status_proc_fops = {
6526 .owner = THIS_MODULE,
6527 .open = dac960_current_status_proc_open,
6528 .read = seq_read,
6529 .llseek = seq_lseek,
6530 .release = single_release,
6531};
6532
6533static int dac960_user_command_proc_show(struct seq_file *m, void *v) 6494static int dac960_user_command_proc_show(struct seq_file *m, void *v)
6534{ 6495{
6535 DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private; 6496 DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private;
@@ -6584,16 +6545,18 @@ static void DAC960_CreateProcEntries(DAC960_Controller_T *Controller)
6584 6545
6585 if (DAC960_ProcDirectoryEntry == NULL) { 6546 if (DAC960_ProcDirectoryEntry == NULL) {
6586 DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL); 6547 DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL);
6587 proc_create("status", 0, DAC960_ProcDirectoryEntry, 6548 proc_create_single("status", 0, DAC960_ProcDirectoryEntry,
6588 &dac960_proc_fops); 6549 dac960_proc_show);
6589 } 6550 }
6590 6551
6591 snprintf(Controller->ControllerName, sizeof(Controller->ControllerName), 6552 snprintf(Controller->ControllerName, sizeof(Controller->ControllerName),
6592 "c%d", Controller->ControllerNumber); 6553 "c%d", Controller->ControllerNumber);
6593 ControllerProcEntry = proc_mkdir(Controller->ControllerName, 6554 ControllerProcEntry = proc_mkdir(Controller->ControllerName,
6594 DAC960_ProcDirectoryEntry); 6555 DAC960_ProcDirectoryEntry);
6595 proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller); 6556 proc_create_single_data("initial_status", 0, ControllerProcEntry,
6596 proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller); 6557 dac960_initial_status_proc_show, Controller);
6558 proc_create_single_data("current_status", 0, ControllerProcEntry,
6559 dac960_current_status_proc_show, Controller);
6597 proc_create_data("user_command", S_IWUSR | S_IRUSR, ControllerProcEntry, &dac960_user_command_proc_fops, Controller); 6560 proc_create_data("user_command", S_IWUSR | S_IRUSR, ControllerProcEntry, &dac960_user_command_proc_fops, Controller);
6598 Controller->ControllerProcEntry = ControllerProcEntry; 6561 Controller->ControllerProcEntry = ControllerProcEntry;
6599} 6562}
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index c61d20c9f3f8..8dce5c04dbf2 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2538,18 +2538,6 @@ static int pkt_seq_show(struct seq_file *m, void *p)
2538 return 0; 2538 return 0;
2539} 2539}
2540 2540
2541static int pkt_seq_open(struct inode *inode, struct file *file)
2542{
2543 return single_open(file, pkt_seq_show, PDE_DATA(inode));
2544}
2545
2546static const struct file_operations pkt_proc_fops = {
2547 .open = pkt_seq_open,
2548 .read = seq_read,
2549 .llseek = seq_lseek,
2550 .release = single_release
2551};
2552
2553static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) 2541static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
2554{ 2542{
2555 int i; 2543 int i;
@@ -2604,7 +2592,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
2604 goto out_mem; 2592 goto out_mem;
2605 } 2593 }
2606 2594
2607 proc_create_data(pd->name, 0, pkt_proc, &pkt_proc_fops, pd); 2595 proc_create_single_data(pd->name, 0, pkt_proc, pkt_seq_show, pd);
2608 pkt_dbg(1, pd, "writer mapped to %s\n", bdevname(bdev, b)); 2596 pkt_dbg(1, pd, "writer mapped to %s\n", bdevname(bdev, b));
2609 return 0; 2597 return 0;
2610 2598
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index 6a55959cbf78..8fa4533a1249 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -521,26 +521,13 @@ static int ps3vram_proc_show(struct seq_file *m, void *v)
521 return 0; 521 return 0;
522} 522}
523 523
524static int ps3vram_proc_open(struct inode *inode, struct file *file)
525{
526 return single_open(file, ps3vram_proc_show, PDE_DATA(inode));
527}
528
529static const struct file_operations ps3vram_proc_fops = {
530 .owner = THIS_MODULE,
531 .open = ps3vram_proc_open,
532 .read = seq_read,
533 .llseek = seq_lseek,
534 .release = single_release,
535};
536
537static void ps3vram_proc_init(struct ps3_system_bus_device *dev) 524static void ps3vram_proc_init(struct ps3_system_bus_device *dev)
538{ 525{
539 struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev); 526 struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev);
540 struct proc_dir_entry *pde; 527 struct proc_dir_entry *pde;
541 528
542 pde = proc_create_data(DEVICE_NAME, 0444, NULL, &ps3vram_proc_fops, 529 pde = proc_create_single_data(DEVICE_NAME, 0444, NULL,
543 priv); 530 ps3vram_proc_show, priv);
544 if (!pde) 531 if (!pde)
545 dev_warn(&dev->core, "failed to create /proc entry\n"); 532 dev_warn(&dev->core, "failed to create /proc entry\n");
546} 533}
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c
index a5e2f9e557ea..53436c03dbce 100644
--- a/drivers/char/apm-emulation.c
+++ b/drivers/char/apm-emulation.c
@@ -461,19 +461,6 @@ static int proc_apm_show(struct seq_file *m, void *v)
461 461
462 return 0; 462 return 0;
463} 463}
464
465static int proc_apm_open(struct inode *inode, struct file *file)
466{
467 return single_open(file, proc_apm_show, NULL);
468}
469
470static const struct file_operations apm_proc_fops = {
471 .owner = THIS_MODULE,
472 .open = proc_apm_open,
473 .read = seq_read,
474 .llseek = seq_lseek,
475 .release = single_release,
476};
477#endif 464#endif
478 465
479static int kapmd(void *arg) 466static int kapmd(void *arg)
@@ -657,7 +644,7 @@ static int __init apm_init(void)
657 wake_up_process(kapmd_tsk); 644 wake_up_process(kapmd_tsk);
658 645
659#ifdef CONFIG_PROC_FS 646#ifdef CONFIG_PROC_FS
660 proc_create("apm", 0, NULL, &apm_proc_fops); 647 proc_create_single("apm", 0, NULL, proc_apm_show);
661#endif 648#endif
662 649
663 ret = misc_register(&apm_device); 650 ret = misc_register(&apm_device);
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c
index eb53cbadb68f..a5ecf6dae02e 100644
--- a/drivers/char/ds1620.c
+++ b/drivers/char/ds1620.c
@@ -345,18 +345,6 @@ static int ds1620_proc_therm_show(struct seq_file *m, void *v)
345 fan_state[netwinder_get_fan()]); 345 fan_state[netwinder_get_fan()]);
346 return 0; 346 return 0;
347} 347}
348
349static int ds1620_proc_therm_open(struct inode *inode, struct file *file)
350{
351 return single_open(file, ds1620_proc_therm_show, NULL);
352}
353
354static const struct file_operations ds1620_proc_therm_fops = {
355 .open = ds1620_proc_therm_open,
356 .read = seq_read,
357 .llseek = seq_lseek,
358 .release = single_release,
359};
360#endif 348#endif
361 349
362static const struct file_operations ds1620_fops = { 350static const struct file_operations ds1620_fops = {
@@ -404,7 +392,7 @@ static int __init ds1620_init(void)
404 return ret; 392 return ret;
405 393
406#ifdef THERM_USE_PROC 394#ifdef THERM_USE_PROC
407 if (!proc_create("therm", 0, NULL, &ds1620_proc_therm_fops)) 395 if (!proc_create_single("therm", 0, NULL, ds1620_proc_therm_show))
408 printk(KERN_ERR "therm: unable to register /proc/therm\n"); 396 printk(KERN_ERR "therm: unable to register /proc/therm\n");
409#endif 397#endif
410 398
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c
index dc62568b7dde..d9aab643997e 100644
--- a/drivers/char/efirtc.c
+++ b/drivers/char/efirtc.c
@@ -358,19 +358,6 @@ static int efi_rtc_proc_show(struct seq_file *m, void *v)
358 358
359 return 0; 359 return 0;
360} 360}
361
362static int efi_rtc_proc_open(struct inode *inode, struct file *file)
363{
364 return single_open(file, efi_rtc_proc_show, NULL);
365}
366
367static const struct file_operations efi_rtc_proc_fops = {
368 .open = efi_rtc_proc_open,
369 .read = seq_read,
370 .llseek = seq_lseek,
371 .release = single_release,
372};
373
374static int __init 361static int __init
375efi_rtc_init(void) 362efi_rtc_init(void)
376{ 363{
@@ -386,7 +373,7 @@ efi_rtc_init(void)
386 return ret; 373 return ret;
387 } 374 }
388 375
389 dir = proc_create("driver/efirtc", 0, NULL, &efi_rtc_proc_fops); 376 dir = proc_create_single("driver/efirtc", 0, NULL, efi_rtc_proc_show);
390 if (dir == NULL) { 377 if (dir == NULL) {
391 printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n"); 378 printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n");
392 misc_deregister(&efi_rtc_dev); 379 misc_deregister(&efi_rtc_dev);
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 678fa97e41fb..25264d65e716 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -389,22 +389,9 @@ static int nvram_proc_read(struct seq_file *seq, void *offset)
389 return 0; 389 return 0;
390} 390}
391 391
392static int nvram_proc_open(struct inode *inode, struct file *file)
393{
394 return single_open(file, nvram_proc_read, NULL);
395}
396
397static const struct file_operations nvram_proc_fops = {
398 .owner = THIS_MODULE,
399 .open = nvram_proc_open,
400 .read = seq_read,
401 .llseek = seq_lseek,
402 .release = single_release,
403};
404
405static int nvram_add_proc_fs(void) 392static int nvram_add_proc_fs(void)
406{ 393{
407 if (!proc_create("driver/nvram", 0, NULL, &nvram_proc_fops)) 394 if (!proc_create_single("driver/nvram", 0, NULL, nvram_proc_read))
408 return -ENOMEM; 395 return -ENOMEM;
409 return 0; 396 return 0;
410} 397}
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 57dc546628b5..94fedeeec035 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -171,7 +171,7 @@ static void mask_rtc_irq_bit(unsigned char bit)
171#endif 171#endif
172 172
173#ifdef CONFIG_PROC_FS 173#ifdef CONFIG_PROC_FS
174static int rtc_proc_open(struct inode *inode, struct file *file); 174static int rtc_proc_show(struct seq_file *seq, void *v);
175#endif 175#endif
176 176
177/* 177/*
@@ -832,16 +832,6 @@ static struct miscdevice rtc_dev = {
832 .fops = &rtc_fops, 832 .fops = &rtc_fops,
833}; 833};
834 834
835#ifdef CONFIG_PROC_FS
836static const struct file_operations rtc_proc_fops = {
837 .owner = THIS_MODULE,
838 .open = rtc_proc_open,
839 .read = seq_read,
840 .llseek = seq_lseek,
841 .release = single_release,
842};
843#endif
844
845static resource_size_t rtc_size; 835static resource_size_t rtc_size;
846 836
847static struct resource * __init rtc_request_region(resource_size_t size) 837static struct resource * __init rtc_request_region(resource_size_t size)
@@ -982,7 +972,7 @@ no_irq:
982 } 972 }
983 973
984#ifdef CONFIG_PROC_FS 974#ifdef CONFIG_PROC_FS
985 ent = proc_create("driver/rtc", 0, NULL, &rtc_proc_fops); 975 ent = proc_create_single("driver/rtc", 0, NULL, rtc_proc_show);
986 if (!ent) 976 if (!ent)
987 printk(KERN_WARNING "rtc: Failed to register with procfs.\n"); 977 printk(KERN_WARNING "rtc: Failed to register with procfs.\n");
988#endif 978#endif
@@ -1201,11 +1191,6 @@ static int rtc_proc_show(struct seq_file *seq, void *v)
1201#undef YN 1191#undef YN
1202#undef NY 1192#undef NY
1203} 1193}
1204
1205static int rtc_proc_open(struct inode *inode, struct file *file)
1206{
1207 return single_open(file, rtc_proc_show, NULL);
1208}
1209#endif 1194#endif
1210 1195
1211static void rtc_get_rtc_time(struct rtc_time *rtc_tm) 1196static void rtc_get_rtc_time(struct rtc_time *rtc_tm)
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 5488516da8ea..802376fe851a 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -326,19 +326,6 @@ static int proc_toshiba_show(struct seq_file *m, void *v)
326 key); 326 key);
327 return 0; 327 return 0;
328} 328}
329
330static int proc_toshiba_open(struct inode *inode, struct file *file)
331{
332 return single_open(file, proc_toshiba_show, NULL);
333}
334
335static const struct file_operations proc_toshiba_fops = {
336 .owner = THIS_MODULE,
337 .open = proc_toshiba_open,
338 .read = seq_read,
339 .llseek = seq_lseek,
340 .release = single_release,
341};
342#endif 329#endif
343 330
344 331
@@ -524,7 +511,7 @@ static int __init toshiba_init(void)
524 { 511 {
525 struct proc_dir_entry *pde; 512 struct proc_dir_entry *pde;
526 513
527 pde = proc_create("toshiba", 0, NULL, &proc_toshiba_fops); 514 pde = proc_create_single("toshiba", 0, NULL, proc_toshiba_show);
528 if (!pde) { 515 if (!pde) {
529 misc_deregister(&tosh_device); 516 misc_deregister(&tosh_device);
530 return -ENOMEM; 517 return -ENOMEM;
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 8615594bd065..e718b8c69a56 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -260,19 +260,6 @@ static int cn_proc_show(struct seq_file *m, void *v)
260 return 0; 260 return 0;
261} 261}
262 262
263static int cn_proc_open(struct inode *inode, struct file *file)
264{
265 return single_open(file, cn_proc_show, NULL);
266}
267
268static const struct file_operations cn_file_ops = {
269 .owner = THIS_MODULE,
270 .open = cn_proc_open,
271 .read = seq_read,
272 .llseek = seq_lseek,
273 .release = single_release
274};
275
276static struct cn_dev cdev = { 263static struct cn_dev cdev = {
277 .input = cn_rx_skb, 264 .input = cn_rx_skb,
278}; 265};
@@ -297,7 +284,7 @@ static int cn_init(void)
297 284
298 cn_already_initialized = 1; 285 cn_already_initialized = 1;
299 286
300 proc_create("connector", S_IRUGO, init_net.proc_net, &cn_file_ops); 287 proc_create_single("connector", S_IRUGO, init_net.proc_net, cn_proc_show);
301 288
302 return 0; 289 return 0;
303} 290}
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c
index 49b34de0aed4..47eb8ca729fe 100644
--- a/drivers/input/misc/hp_sdc_rtc.c
+++ b/drivers/input/misc/hp_sdc_rtc.c
@@ -509,18 +509,6 @@ static int hp_sdc_rtc_proc_show(struct seq_file *m, void *v)
509#undef NY 509#undef NY
510} 510}
511 511
512static int hp_sdc_rtc_proc_open(struct inode *inode, struct file *file)
513{
514 return single_open(file, hp_sdc_rtc_proc_show, NULL);
515}
516
517static const struct file_operations hp_sdc_rtc_proc_fops = {
518 .open = hp_sdc_rtc_proc_open,
519 .read = seq_read,
520 .llseek = seq_lseek,
521 .release = single_release,
522};
523
524static int hp_sdc_rtc_ioctl(struct file *file, 512static int hp_sdc_rtc_ioctl(struct file *file,
525 unsigned int cmd, unsigned long arg) 513 unsigned int cmd, unsigned long arg)
526{ 514{
@@ -713,7 +701,7 @@ static int __init hp_sdc_rtc_init(void)
713 if (misc_register(&hp_sdc_rtc_dev) != 0) 701 if (misc_register(&hp_sdc_rtc_dev) != 0)
714 printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n"); 702 printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n");
715 703
716 proc_create("driver/rtc", 0, NULL, &hp_sdc_rtc_proc_fops); 704 proc_create_single("driver/rtc", 0, NULL, hp_sdc_rtc_proc_show);
717 705
718 printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded " 706 printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded "
719 "(RTC v " RTC_VERSION ")\n"); 707 "(RTC v " RTC_VERSION ")\n");
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 19cd93783c87..baa1ee2bc2ac 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1340,19 +1340,6 @@ static int capi20_proc_show(struct seq_file *m, void *v)
1340 return 0; 1340 return 0;
1341} 1341}
1342 1342
1343static int capi20_proc_open(struct inode *inode, struct file *file)
1344{
1345 return single_open(file, capi20_proc_show, NULL);
1346}
1347
1348static const struct file_operations capi20_proc_fops = {
1349 .owner = THIS_MODULE,
1350 .open = capi20_proc_open,
1351 .read = seq_read,
1352 .llseek = seq_lseek,
1353 .release = single_release,
1354};
1355
1356/* 1343/*
1357 * /proc/capi/capi20ncci: 1344 * /proc/capi/capi20ncci:
1358 * applid ncci 1345 * applid ncci
@@ -1373,23 +1360,10 @@ static int capi20ncci_proc_show(struct seq_file *m, void *v)
1373 return 0; 1360 return 0;
1374} 1361}
1375 1362
1376static int capi20ncci_proc_open(struct inode *inode, struct file *file)
1377{
1378 return single_open(file, capi20ncci_proc_show, NULL);
1379}
1380
1381static const struct file_operations capi20ncci_proc_fops = {
1382 .owner = THIS_MODULE,
1383 .open = capi20ncci_proc_open,
1384 .read = seq_read,
1385 .llseek = seq_lseek,
1386 .release = single_release,
1387};
1388
1389static void __init proc_init(void) 1363static void __init proc_init(void)
1390{ 1364{
1391 proc_create("capi/capi20", 0, NULL, &capi20_proc_fops); 1365 proc_create_single("capi/capi20", 0, NULL, capi20_proc_show);
1392 proc_create("capi/capi20ncci", 0, NULL, &capi20ncci_proc_fops); 1366 proc_create_single("capi/capi20ncci", 0, NULL, capi20ncci_proc_show);
1393} 1367}
1394 1368
1395static void __exit proc_exit(void) 1369static void __exit proc_exit(void)
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 49fef08858c5..7ac51798949d 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -2460,22 +2460,9 @@ static int capidrv_proc_show(struct seq_file *m, void *v)
2460 return 0; 2460 return 0;
2461} 2461}
2462 2462
2463static int capidrv_proc_open(struct inode *inode, struct file *file)
2464{
2465 return single_open(file, capidrv_proc_show, NULL);
2466}
2467
2468static const struct file_operations capidrv_proc_fops = {
2469 .owner = THIS_MODULE,
2470 .open = capidrv_proc_open,
2471 .read = seq_read,
2472 .llseek = seq_lseek,
2473 .release = single_release,
2474};
2475
2476static void __init proc_init(void) 2463static void __init proc_init(void)
2477{ 2464{
2478 proc_create("capi/capidrv", 0, NULL, &capidrv_proc_fops); 2465 proc_create_single("capi/capidrv", 0, NULL, capidrv_proc_show);
2479} 2466}
2480 2467
2481static void __exit proc_exit(void) 2468static void __exit proc_exit(void)
diff --git a/drivers/isdn/hardware/eicon/diva_didd.c b/drivers/isdn/hardware/eicon/diva_didd.c
index fab6ccfb00d5..60e79257dd5f 100644
--- a/drivers/isdn/hardware/eicon/diva_didd.c
+++ b/drivers/isdn/hardware/eicon/diva_didd.c
@@ -78,26 +78,13 @@ static int divadidd_proc_show(struct seq_file *m, void *v)
78 return 0; 78 return 0;
79} 79}
80 80
81static int divadidd_proc_open(struct inode *inode, struct file *file)
82{
83 return single_open(file, divadidd_proc_show, NULL);
84}
85
86static const struct file_operations divadidd_proc_fops = {
87 .owner = THIS_MODULE,
88 .open = divadidd_proc_open,
89 .read = seq_read,
90 .llseek = seq_lseek,
91 .release = single_release,
92};
93
94static int __init create_proc(void) 81static int __init create_proc(void)
95{ 82{
96 proc_net_eicon = proc_mkdir("eicon", init_net.proc_net); 83 proc_net_eicon = proc_mkdir("eicon", init_net.proc_net);
97 84
98 if (proc_net_eicon) { 85 if (proc_net_eicon) {
99 proc_didd = proc_create(DRIVERLNAME, S_IRUGO, proc_net_eicon, 86 proc_didd = proc_create_single(DRIVERLNAME, S_IRUGO,
100 &divadidd_proc_fops); 87 proc_net_eicon, divadidd_proc_show);
101 return (1); 88 return (1);
102 } 89 }
103 return (0); 90 return (0);
diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c
index 525518c945fe..e7081e0c0e35 100644
--- a/drivers/isdn/hardware/eicon/divasi.c
+++ b/drivers/isdn/hardware/eicon/divasi.c
@@ -101,23 +101,10 @@ static int um_idi_proc_show(struct seq_file *m, void *v)
101 return 0; 101 return 0;
102} 102}
103 103
104static int um_idi_proc_open(struct inode *inode, struct file *file)
105{
106 return single_open(file, um_idi_proc_show, NULL);
107}
108
109static const struct file_operations um_idi_proc_fops = {
110 .owner = THIS_MODULE,
111 .open = um_idi_proc_open,
112 .read = seq_read,
113 .llseek = seq_lseek,
114 .release = single_release,
115};
116
117static int __init create_um_idi_proc(void) 104static int __init create_um_idi_proc(void)
118{ 105{
119 um_idi_proc_entry = proc_create(DRIVERLNAME, S_IRUGO, proc_net_eicon, 106 um_idi_proc_entry = proc_create_single(DRIVERLNAME, S_IRUGO,
120 &um_idi_proc_fops); 107 proc_net_eicon, um_idi_proc_show);
121 if (!um_idi_proc_entry) 108 if (!um_idi_proc_entry)
122 return (0); 109 return (0);
123 return (1); 110 return (1);
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 433dbeddfcf9..6663893f41c4 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -191,10 +191,10 @@ static int init_pmu(void);
191static void pmu_start(void); 191static void pmu_start(void);
192static irqreturn_t via_pmu_interrupt(int irq, void *arg); 192static irqreturn_t via_pmu_interrupt(int irq, void *arg);
193static irqreturn_t gpio1_interrupt(int irq, void *arg); 193static irqreturn_t gpio1_interrupt(int irq, void *arg);
194static const struct file_operations pmu_info_proc_fops; 194static int pmu_info_proc_show(struct seq_file *m, void *v);
195static const struct file_operations pmu_irqstats_proc_fops; 195static int pmu_irqstats_proc_show(struct seq_file *m, void *v);
196static int pmu_battery_proc_show(struct seq_file *m, void *v);
196static void pmu_pass_intr(unsigned char *data, int len); 197static void pmu_pass_intr(unsigned char *data, int len);
197static const struct file_operations pmu_battery_proc_fops;
198static const struct file_operations pmu_options_proc_fops; 198static const struct file_operations pmu_options_proc_fops;
199 199
200#ifdef CONFIG_ADB 200#ifdef CONFIG_ADB
@@ -511,13 +511,15 @@ static int __init via_pmu_dev_init(void)
511 for (i=0; i<pmu_battery_count; i++) { 511 for (i=0; i<pmu_battery_count; i++) {
512 char title[16]; 512 char title[16];
513 sprintf(title, "battery_%ld", i); 513 sprintf(title, "battery_%ld", i);
514 proc_pmu_batt[i] = proc_create_data(title, 0, proc_pmu_root, 514 proc_pmu_batt[i] = proc_create_single_data(title, 0,
515 &pmu_battery_proc_fops, (void *)i); 515 proc_pmu_root, pmu_battery_proc_show,
516 (void *)i);
516 } 517 }
517 518
518 proc_pmu_info = proc_create("info", 0, proc_pmu_root, &pmu_info_proc_fops); 519 proc_pmu_info = proc_create_single("info", 0, proc_pmu_root,
519 proc_pmu_irqstats = proc_create("interrupts", 0, proc_pmu_root, 520 pmu_info_proc_show);
520 &pmu_irqstats_proc_fops); 521 proc_pmu_irqstats = proc_create_single("interrupts", 0,
522 proc_pmu_root, pmu_irqstats_proc_show);
521 proc_pmu_options = proc_create("options", 0600, proc_pmu_root, 523 proc_pmu_options = proc_create("options", 0600, proc_pmu_root,
522 &pmu_options_proc_fops); 524 &pmu_options_proc_fops);
523 } 525 }
@@ -811,19 +813,6 @@ static int pmu_info_proc_show(struct seq_file *m, void *v)
811 return 0; 813 return 0;
812} 814}
813 815
814static int pmu_info_proc_open(struct inode *inode, struct file *file)
815{
816 return single_open(file, pmu_info_proc_show, NULL);
817}
818
819static const struct file_operations pmu_info_proc_fops = {
820 .owner = THIS_MODULE,
821 .open = pmu_info_proc_open,
822 .read = seq_read,
823 .llseek = seq_lseek,
824 .release = single_release,
825};
826
827static int pmu_irqstats_proc_show(struct seq_file *m, void *v) 816static int pmu_irqstats_proc_show(struct seq_file *m, void *v)
828{ 817{
829 int i; 818 int i;
@@ -848,19 +837,6 @@ static int pmu_irqstats_proc_show(struct seq_file *m, void *v)
848 return 0; 837 return 0;
849} 838}
850 839
851static int pmu_irqstats_proc_open(struct inode *inode, struct file *file)
852{
853 return single_open(file, pmu_irqstats_proc_show, NULL);
854}
855
856static const struct file_operations pmu_irqstats_proc_fops = {
857 .owner = THIS_MODULE,
858 .open = pmu_irqstats_proc_open,
859 .read = seq_read,
860 .llseek = seq_lseek,
861 .release = single_release,
862};
863
864static int pmu_battery_proc_show(struct seq_file *m, void *v) 840static int pmu_battery_proc_show(struct seq_file *m, void *v)
865{ 841{
866 long batnum = (long)m->private; 842 long batnum = (long)m->private;
@@ -875,19 +851,6 @@ static int pmu_battery_proc_show(struct seq_file *m, void *v)
875 return 0; 851 return 0;
876} 852}
877 853
878static int pmu_battery_proc_open(struct inode *inode, struct file *file)
879{
880 return single_open(file, pmu_battery_proc_show, PDE_DATA(inode));
881}
882
883static const struct file_operations pmu_battery_proc_fops = {
884 .owner = THIS_MODULE,
885 .open = pmu_battery_proc_open,
886 .read = seq_read,
887 .llseek = seq_lseek,
888 .release = single_release,
889};
890
891static int pmu_options_proc_show(struct seq_file *m, void *v) 854static int pmu_options_proc_show(struct seq_file *m, void *v)
892{ 855{
893#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) 856#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
diff --git a/drivers/media/pci/saa7164/saa7164-core.c b/drivers/media/pci/saa7164/saa7164-core.c
index fca36a4910c2..d697e1ad929c 100644
--- a/drivers/media/pci/saa7164/saa7164-core.c
+++ b/drivers/media/pci/saa7164/saa7164-core.c
@@ -1122,23 +1122,11 @@ static int saa7164_proc_show(struct seq_file *m, void *v)
1122 return 0; 1122 return 0;
1123} 1123}
1124 1124
1125static int saa7164_proc_open(struct inode *inode, struct file *filp)
1126{
1127 return single_open(filp, saa7164_proc_show, NULL);
1128}
1129
1130static const struct file_operations saa7164_proc_fops = {
1131 .open = saa7164_proc_open,
1132 .read = seq_read,
1133 .llseek = seq_lseek,
1134 .release = single_release,
1135};
1136
1137static int saa7164_proc_create(void) 1125static int saa7164_proc_create(void)
1138{ 1126{
1139 struct proc_dir_entry *pe; 1127 struct proc_dir_entry *pe;
1140 1128
1141 pe = proc_create("saa7164", S_IRUGO, NULL, &saa7164_proc_fops); 1129 pe = proc_create_single("saa7164", S_IRUGO, NULL, saa7164_proc_show);
1142 if (!pe) 1130 if (!pe)
1143 return -ENOMEM; 1131 return -ENOMEM;
1144 1132
diff --git a/drivers/media/pci/zoran/videocodec.c b/drivers/media/pci/zoran/videocodec.c
index 5ff23ef89215..4427ae7126e2 100644
--- a/drivers/media/pci/zoran/videocodec.c
+++ b/drivers/media/pci/zoran/videocodec.c
@@ -344,19 +344,6 @@ static int proc_videocodecs_show(struct seq_file *m, void *v)
344 344
345 return 0; 345 return 0;
346} 346}
347
348static int proc_videocodecs_open(struct inode *inode, struct file *file)
349{
350 return single_open(file, proc_videocodecs_show, NULL);
351}
352
353static const struct file_operations videocodecs_proc_fops = {
354 .owner = THIS_MODULE,
355 .open = proc_videocodecs_open,
356 .read = seq_read,
357 .llseek = seq_lseek,
358 .release = single_release,
359};
360#endif 347#endif
361 348
362/* ===================== */ 349/* ===================== */
@@ -373,7 +360,8 @@ videocodec_init (void)
373 VIDEOCODEC_VERSION); 360 VIDEOCODEC_VERSION);
374 361
375#ifdef CONFIG_PROC_FS 362#ifdef CONFIG_PROC_FS
376 videocodec_proc_entry = proc_create("videocodecs", 0, NULL, &videocodecs_proc_fops); 363 videocodec_proc_entry = proc_create_single("videocodecs", 0, NULL,
364 proc_videocodecs_show);
377 if (!videocodec_proc_entry) { 365 if (!videocodec_proc_entry) {
378 dprintk(1, KERN_ERR "videocodec: can't init procfs.\n"); 366 dprintk(1, KERN_ERR "videocodec: can't init procfs.\n");
379 } 367 }
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 51eb1b027963..a746ccdd630a 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -197,9 +197,9 @@ static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_valu
197static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init); 197static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init);
198 198
199#ifdef CONFIG_PROC_FS 199#ifdef CONFIG_PROC_FS
200static const struct file_operations mpt_summary_proc_fops; 200static int mpt_summary_proc_show(struct seq_file *m, void *v);
201static const struct file_operations mpt_version_proc_fops; 201static int mpt_version_proc_show(struct seq_file *m, void *v);
202static const struct file_operations mpt_iocinfo_proc_fops; 202static int mpt_iocinfo_proc_show(struct seq_file *m, void *v);
203#endif 203#endif
204static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); 204static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc);
205 205
@@ -2040,8 +2040,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
2040 */ 2040 */
2041 dent = proc_mkdir(ioc->name, mpt_proc_root_dir); 2041 dent = proc_mkdir(ioc->name, mpt_proc_root_dir);
2042 if (dent) { 2042 if (dent) {
2043 proc_create_data("info", S_IRUGO, dent, &mpt_iocinfo_proc_fops, ioc); 2043 proc_create_single_data("info", S_IRUGO, dent,
2044 proc_create_data("summary", S_IRUGO, dent, &mpt_summary_proc_fops, ioc); 2044 mpt_iocinfo_proc_show, ioc);
2045 proc_create_single_data("summary", S_IRUGO, dent,
2046 mpt_summary_proc_show, ioc);
2045 } 2047 }
2046#endif 2048#endif
2047 2049
@@ -6606,8 +6608,10 @@ procmpt_create(void)
6606 if (mpt_proc_root_dir == NULL) 6608 if (mpt_proc_root_dir == NULL)
6607 return -ENOTDIR; 6609 return -ENOTDIR;
6608 6610
6609 proc_create("summary", S_IRUGO, mpt_proc_root_dir, &mpt_summary_proc_fops); 6611 proc_create_single("summary", S_IRUGO, mpt_proc_root_dir,
6610 proc_create("version", S_IRUGO, mpt_proc_root_dir, &mpt_version_proc_fops); 6612 mpt_summary_proc_show);
6613 proc_create_single("version", S_IRUGO, mpt_proc_root_dir,
6614 mpt_version_proc_show);
6611 return 0; 6615 return 0;
6612} 6616}
6613 6617
@@ -6646,19 +6650,6 @@ static int mpt_summary_proc_show(struct seq_file *m, void *v)
6646 return 0; 6650 return 0;
6647} 6651}
6648 6652
6649static int mpt_summary_proc_open(struct inode *inode, struct file *file)
6650{
6651 return single_open(file, mpt_summary_proc_show, PDE_DATA(inode));
6652}
6653
6654static const struct file_operations mpt_summary_proc_fops = {
6655 .owner = THIS_MODULE,
6656 .open = mpt_summary_proc_open,
6657 .read = seq_read,
6658 .llseek = seq_lseek,
6659 .release = single_release,
6660};
6661
6662static int mpt_version_proc_show(struct seq_file *m, void *v) 6653static int mpt_version_proc_show(struct seq_file *m, void *v)
6663{ 6654{
6664 u8 cb_idx; 6655 u8 cb_idx;
@@ -6701,19 +6692,6 @@ static int mpt_version_proc_show(struct seq_file *m, void *v)
6701 return 0; 6692 return 0;
6702} 6693}
6703 6694
6704static int mpt_version_proc_open(struct inode *inode, struct file *file)
6705{
6706 return single_open(file, mpt_version_proc_show, NULL);
6707}
6708
6709static const struct file_operations mpt_version_proc_fops = {
6710 .owner = THIS_MODULE,
6711 .open = mpt_version_proc_open,
6712 .read = seq_read,
6713 .llseek = seq_lseek,
6714 .release = single_release,
6715};
6716
6717static int mpt_iocinfo_proc_show(struct seq_file *m, void *v) 6695static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
6718{ 6696{
6719 MPT_ADAPTER *ioc = m->private; 6697 MPT_ADAPTER *ioc = m->private;
@@ -6793,19 +6771,6 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
6793 6771
6794 return 0; 6772 return 0;
6795} 6773}
6796
6797static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file)
6798{
6799 return single_open(file, mpt_iocinfo_proc_show, PDE_DATA(inode));
6800}
6801
6802static const struct file_operations mpt_iocinfo_proc_fops = {
6803 .owner = THIS_MODULE,
6804 .open = mpt_iocinfo_proc_open,
6805 .read = seq_read,
6806 .llseek = seq_lseek,
6807 .release = single_release,
6808};
6809#endif /* CONFIG_PROC_FS } */ 6774#endif /* CONFIG_PROC_FS } */
6810 6775
6811/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6776/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 807d17d863b3..64a1fcaafd9a 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -1829,18 +1829,6 @@ static int mtd_proc_show(struct seq_file *m, void *v)
1829 mutex_unlock(&mtd_table_mutex); 1829 mutex_unlock(&mtd_table_mutex);
1830 return 0; 1830 return 0;
1831} 1831}
1832
1833static int mtd_proc_open(struct inode *inode, struct file *file)
1834{
1835 return single_open(file, mtd_proc_show, NULL);
1836}
1837
1838static const struct file_operations mtd_proc_ops = {
1839 .open = mtd_proc_open,
1840 .read = seq_read,
1841 .llseek = seq_lseek,
1842 .release = single_release,
1843};
1844#endif /* CONFIG_PROC_FS */ 1832#endif /* CONFIG_PROC_FS */
1845 1833
1846/*====================================================================*/ 1834/*====================================================================*/
@@ -1883,7 +1871,7 @@ static int __init init_mtd(void)
1883 goto err_bdi; 1871 goto err_bdi;
1884 } 1872 }
1885 1873
1886 proc_mtd = proc_create("mtd", 0, NULL, &mtd_proc_ops); 1874 proc_mtd = proc_create_single("mtd", 0, NULL, mtd_proc_show);
1887 1875
1888 ret = init_mtdchar(); 1876 ret = init_mtdchar();
1889 if (ret) 1877 if (ret)
diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c
index d122386c382b..b01dc34d55af 100644
--- a/drivers/net/wireless/atmel/atmel.c
+++ b/drivers/net/wireless/atmel/atmel.c
@@ -1482,18 +1482,6 @@ static int atmel_proc_show(struct seq_file *m, void *v)
1482 return 0; 1482 return 0;
1483} 1483}
1484 1484
1485static int atmel_proc_open(struct inode *inode, struct file *file)
1486{
1487 return single_open(file, atmel_proc_show, PDE_DATA(inode));
1488}
1489
1490static const struct file_operations atmel_proc_fops = {
1491 .open = atmel_proc_open,
1492 .read = seq_read,
1493 .llseek = seq_lseek,
1494 .release = single_release,
1495};
1496
1497static const struct net_device_ops atmel_netdev_ops = { 1485static const struct net_device_ops atmel_netdev_ops = {
1498 .ndo_open = atmel_open, 1486 .ndo_open = atmel_open,
1499 .ndo_stop = atmel_close, 1487 .ndo_stop = atmel_close,
@@ -1614,7 +1602,8 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
1614 1602
1615 netif_carrier_off(dev); 1603 netif_carrier_off(dev);
1616 1604
1617 if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)) 1605 if (!proc_create_single_data("driver/atmel", 0, NULL, atmel_proc_show,
1606 priv))
1618 printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); 1607 printk(KERN_WARNING "atmel: unable to create /proc entry.\n");
1619 1608
1620 printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", 1609 printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n",
diff --git a/drivers/net/wireless/intersil/hostap/hostap_ap.c b/drivers/net/wireless/intersil/hostap/hostap_ap.c
index b4dfe1893d18..4f76f81dd3af 100644
--- a/drivers/net/wireless/intersil/hostap/hostap_ap.c
+++ b/drivers/net/wireless/intersil/hostap/hostap_ap.c
@@ -1106,18 +1106,6 @@ static int prism2_sta_proc_show(struct seq_file *m, void *v)
1106 return 0; 1106 return 0;
1107} 1107}
1108 1108
1109static int prism2_sta_proc_open(struct inode *inode, struct file *file)
1110{
1111 return single_open(file, prism2_sta_proc_show, PDE_DATA(inode));
1112}
1113
1114static const struct file_operations prism2_sta_proc_fops = {
1115 .open = prism2_sta_proc_open,
1116 .read = seq_read,
1117 .llseek = seq_lseek,
1118 .release = single_release,
1119};
1120
1121static void handle_add_proc_queue(struct work_struct *work) 1109static void handle_add_proc_queue(struct work_struct *work)
1122{ 1110{
1123 struct ap_data *ap = container_of(work, struct ap_data, 1111 struct ap_data *ap = container_of(work, struct ap_data,
@@ -1138,9 +1126,9 @@ static void handle_add_proc_queue(struct work_struct *work)
1138 1126
1139 if (sta) { 1127 if (sta) {
1140 sprintf(name, "%pM", sta->addr); 1128 sprintf(name, "%pM", sta->addr);
1141 sta->proc = proc_create_data( 1129 sta->proc = proc_create_single_data(
1142 name, 0, ap->proc, 1130 name, 0, ap->proc,
1143 &prism2_sta_proc_fops, sta); 1131 prism2_sta_proc_show, sta);
1144 1132
1145 atomic_dec(&sta->users); 1133 atomic_dec(&sta->users);
1146 } 1134 }
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 7f9b16b97ea3..a7e0a17aa7e8 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -2663,19 +2663,6 @@ static int ray_cs_proc_show(struct seq_file *m, void *v)
2663 } 2663 }
2664 return 0; 2664 return 0;
2665} 2665}
2666
2667static int ray_cs_proc_open(struct inode *inode, struct file *file)
2668{
2669 return single_open(file, ray_cs_proc_show, NULL);
2670}
2671
2672static const struct file_operations ray_cs_proc_fops = {
2673 .owner = THIS_MODULE,
2674 .open = ray_cs_proc_open,
2675 .read = seq_read,
2676 .llseek = seq_lseek,
2677 .release = single_release,
2678};
2679#endif 2666#endif
2680/*===========================================================================*/ 2667/*===========================================================================*/
2681static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) 2668static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type)
@@ -2814,7 +2801,7 @@ static int __init init_ray_cs(void)
2814#ifdef CONFIG_PROC_FS 2801#ifdef CONFIG_PROC_FS
2815 proc_mkdir("driver/ray_cs", NULL); 2802 proc_mkdir("driver/ray_cs", NULL);
2816 2803
2817 proc_create("driver/ray_cs/ray_cs", 0, NULL, &ray_cs_proc_fops); 2804 proc_create_single("driver/ray_cs/ray_cs", 0, NULL, ray_cs_proc_show);
2818 proc_create("driver/ray_cs/essid", 0200, NULL, &ray_cs_essid_proc_fops); 2805 proc_create("driver/ray_cs/essid", 0200, NULL, &ray_cs_essid_proc_fops);
2819 proc_create_data("driver/ray_cs/net_type", 0200, NULL, &int_proc_fops, 2806 proc_create_data("driver/ray_cs/net_type", 0200, NULL, &int_proc_fops,
2820 &net_type); 2807 &net_type);
diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c
index c2e5a7e6bd3e..88e1f9a0faaf 100644
--- a/drivers/nubus/proc.c
+++ b/drivers/nubus/proc.c
@@ -45,18 +45,6 @@ nubus_devices_proc_show(struct seq_file *m, void *v)
45 return 0; 45 return 0;
46} 46}
47 47
48static int nubus_devices_proc_open(struct inode *inode, struct file *file)
49{
50 return single_open(file, nubus_devices_proc_show, NULL);
51}
52
53static const struct file_operations nubus_devices_proc_fops = {
54 .open = nubus_devices_proc_open,
55 .read = seq_read,
56 .llseek = seq_lseek,
57 .release = single_release,
58};
59
60static struct proc_dir_entry *proc_bus_nubus_dir; 48static struct proc_dir_entry *proc_bus_nubus_dir;
61 49
62/* 50/*
@@ -149,18 +137,6 @@ static int nubus_proc_rsrc_show(struct seq_file *m, void *v)
149 return 0; 137 return 0;
150} 138}
151 139
152static int nubus_proc_rsrc_open(struct inode *inode, struct file *file)
153{
154 return single_open(file, nubus_proc_rsrc_show, inode);
155}
156
157static const struct file_operations nubus_proc_rsrc_fops = {
158 .open = nubus_proc_rsrc_open,
159 .read = seq_read,
160 .llseek = seq_lseek,
161 .release = single_release,
162};
163
164void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir, 140void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir,
165 const struct nubus_dirent *ent, 141 const struct nubus_dirent *ent,
166 unsigned int size) 142 unsigned int size)
@@ -176,8 +152,8 @@ void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir,
176 pde_data = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size); 152 pde_data = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size);
177 else 153 else
178 pde_data = NULL; 154 pde_data = NULL;
179 proc_create_data(name, S_IFREG | 0444, procdir, 155 proc_create_single_data(name, S_IFREG | 0444, procdir,
180 &nubus_proc_rsrc_fops, pde_data); 156 nubus_proc_rsrc_show, pde_data);
181} 157}
182 158
183void nubus_proc_add_rsrc(struct proc_dir_entry *procdir, 159void nubus_proc_add_rsrc(struct proc_dir_entry *procdir,
@@ -190,32 +166,21 @@ void nubus_proc_add_rsrc(struct proc_dir_entry *procdir,
190 return; 166 return;
191 167
192 snprintf(name, sizeof(name), "%x", ent->type); 168 snprintf(name, sizeof(name), "%x", ent->type);
193 proc_create_data(name, S_IFREG | 0444, procdir, 169 proc_create_single_data(name, S_IFREG | 0444, procdir,
194 &nubus_proc_rsrc_fops, 170 nubus_proc_rsrc_show,
195 nubus_proc_alloc_pde_data(data, 0)); 171 nubus_proc_alloc_pde_data(data, 0));
196} 172}
197 173
198/* 174/*
199 * /proc/nubus stuff 175 * /proc/nubus stuff
200 */ 176 */
201 177
202static int nubus_proc_open(struct inode *inode, struct file *file)
203{
204 return single_open(file, nubus_proc_show, NULL);
205}
206
207static const struct file_operations nubus_proc_fops = {
208 .open = nubus_proc_open,
209 .read = seq_read,
210 .llseek = seq_lseek,
211 .release = single_release,
212};
213
214void __init nubus_proc_init(void) 178void __init nubus_proc_init(void)
215{ 179{
216 proc_create("nubus", 0, NULL, &nubus_proc_fops); 180 proc_create_single("nubus", 0, NULL, nubus_proc_show);
217 proc_bus_nubus_dir = proc_mkdir("bus/nubus", NULL); 181 proc_bus_nubus_dir = proc_mkdir("bus/nubus", NULL);
218 if (!proc_bus_nubus_dir) 182 if (!proc_bus_nubus_dir)
219 return; 183 return;
220 proc_create("devices", 0, proc_bus_nubus_dir, &nubus_devices_proc_fops); 184 proc_create_single("devices", 0, proc_bus_nubus_dir,
185 nubus_devices_proc_show);
221} 186}
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index 126cf19e869b..21a3e93417c4 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -1108,19 +1108,6 @@ static int ccio_proc_info(struct seq_file *m, void *p)
1108 return 0; 1108 return 0;
1109} 1109}
1110 1110
1111static int ccio_proc_info_open(struct inode *inode, struct file *file)
1112{
1113 return single_open(file, &ccio_proc_info, NULL);
1114}
1115
1116static const struct file_operations ccio_proc_info_fops = {
1117 .owner = THIS_MODULE,
1118 .open = ccio_proc_info_open,
1119 .read = seq_read,
1120 .llseek = seq_lseek,
1121 .release = single_release,
1122};
1123
1124static int ccio_proc_bitmap_info(struct seq_file *m, void *p) 1111static int ccio_proc_bitmap_info(struct seq_file *m, void *p)
1125{ 1112{
1126 struct ioc *ioc = ioc_list; 1113 struct ioc *ioc = ioc_list;
@@ -1135,19 +1122,6 @@ static int ccio_proc_bitmap_info(struct seq_file *m, void *p)
1135 1122
1136 return 0; 1123 return 0;
1137} 1124}
1138
1139static int ccio_proc_bitmap_open(struct inode *inode, struct file *file)
1140{
1141 return single_open(file, &ccio_proc_bitmap_info, NULL);
1142}
1143
1144static const struct file_operations ccio_proc_bitmap_fops = {
1145 .owner = THIS_MODULE,
1146 .open = ccio_proc_bitmap_open,
1147 .read = seq_read,
1148 .llseek = seq_lseek,
1149 .release = single_release,
1150};
1151#endif /* CONFIG_PROC_FS */ 1125#endif /* CONFIG_PROC_FS */
1152 1126
1153/** 1127/**
@@ -1589,10 +1563,10 @@ static int __init ccio_probe(struct parisc_device *dev)
1589 1563
1590#ifdef CONFIG_PROC_FS 1564#ifdef CONFIG_PROC_FS
1591 if (ioc_count == 0) { 1565 if (ioc_count == 0) {
1592 proc_create(MODULE_NAME, 0, proc_runway_root, 1566 proc_create_single(MODULE_NAME, 0, proc_runway_root,
1593 &ccio_proc_info_fops); 1567 ccio_proc_info);
1594 proc_create(MODULE_NAME"-bitmap", 0, proc_runway_root, 1568 proc_create_single(MODULE_NAME"-bitmap", 0, proc_runway_root,
1595 &ccio_proc_bitmap_fops); 1569 ccio_proc_bitmap_info);
1596 } 1570 }
1597#endif 1571#endif
1598 ioc_count++; 1572 ioc_count++;
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 0a9c762a70fa..0d33d1f86d10 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -1864,20 +1864,6 @@ static int sba_proc_info(struct seq_file *m, void *p)
1864} 1864}
1865 1865
1866static int 1866static int
1867sba_proc_open(struct inode *i, struct file *f)
1868{
1869 return single_open(f, &sba_proc_info, NULL);
1870}
1871
1872static const struct file_operations sba_proc_fops = {
1873 .owner = THIS_MODULE,
1874 .open = sba_proc_open,
1875 .read = seq_read,
1876 .llseek = seq_lseek,
1877 .release = single_release,
1878};
1879
1880static int
1881sba_proc_bitmap_info(struct seq_file *m, void *p) 1867sba_proc_bitmap_info(struct seq_file *m, void *p)
1882{ 1868{
1883 struct sba_device *sba_dev = sba_list; 1869 struct sba_device *sba_dev = sba_list;
@@ -1889,20 +1875,6 @@ sba_proc_bitmap_info(struct seq_file *m, void *p)
1889 1875
1890 return 0; 1876 return 0;
1891} 1877}
1892
1893static int
1894sba_proc_bitmap_open(struct inode *i, struct file *f)
1895{
1896 return single_open(f, &sba_proc_bitmap_info, NULL);
1897}
1898
1899static const struct file_operations sba_proc_bitmap_fops = {
1900 .owner = THIS_MODULE,
1901 .open = sba_proc_bitmap_open,
1902 .read = seq_read,
1903 .llseek = seq_lseek,
1904 .release = single_release,
1905};
1906#endif /* CONFIG_PROC_FS */ 1878#endif /* CONFIG_PROC_FS */
1907 1879
1908static const struct parisc_device_id sba_tbl[] __initconst = { 1880static const struct parisc_device_id sba_tbl[] __initconst = {
@@ -2014,8 +1986,8 @@ static int __init sba_driver_callback(struct parisc_device *dev)
2014 break; 1986 break;
2015 } 1987 }
2016 1988
2017 proc_create("sba_iommu", 0, root, &sba_proc_fops); 1989 proc_create_single("sba_iommu", 0, root, sba_proc_info);
2018 proc_create("sba_iommu-bitmap", 0, root, &sba_proc_bitmap_fops); 1990 proc_create_single("sba_iommu-bitmap", 0, root, sba_proc_bitmap_info);
2019#endif 1991#endif
2020 1992
2021 parisc_has_iommu(); 1993 parisc_has_iommu();
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index e8d058c5ef21..eef76bfa5d73 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -1689,19 +1689,6 @@ static int version_proc_show(struct seq_file *m, void *v)
1689 return 0; 1689 return 0;
1690} 1690}
1691 1691
1692static int version_proc_open(struct inode *inode, struct file *file)
1693{
1694 return single_open(file, version_proc_show, PDE_DATA(inode));
1695}
1696
1697static const struct file_operations version_proc_fops = {
1698 .owner = THIS_MODULE,
1699 .open = version_proc_open,
1700 .read = seq_read,
1701 .llseek = seq_lseek,
1702 .release = single_release,
1703};
1704
1705/* 1692/*
1706 * Proc and module init 1693 * Proc and module init
1707 */ 1694 */
@@ -1722,8 +1709,8 @@ static void create_toshiba_proc_entries(struct toshiba_acpi_dev *dev)
1722 if (dev->hotkey_dev) 1709 if (dev->hotkey_dev)
1723 proc_create_data("keys", S_IRUGO | S_IWUSR, toshiba_proc_dir, 1710 proc_create_data("keys", S_IRUGO | S_IWUSR, toshiba_proc_dir,
1724 &keys_proc_fops, dev); 1711 &keys_proc_fops, dev);
1725 proc_create_data("version", S_IRUGO, toshiba_proc_dir, 1712 proc_create_single_data("version", S_IRUGO, toshiba_proc_dir,
1726 &version_proc_fops, dev); 1713 version_proc_show, dev);
1727} 1714}
1728 1715
1729static void remove_toshiba_proc_entries(struct toshiba_acpi_dev *dev) 1716static void remove_toshiba_proc_entries(struct toshiba_acpi_dev *dev)
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
index 7d4aca7948dd..fe1c8f5d9af0 100644
--- a/drivers/pnp/pnpbios/proc.c
+++ b/drivers/pnp/pnpbios/proc.c
@@ -47,19 +47,6 @@ static int pnpconfig_proc_show(struct seq_file *m, void *v)
47 return 0; 47 return 0;
48} 48}
49 49
50static int pnpconfig_proc_open(struct inode *inode, struct file *file)
51{
52 return single_open(file, pnpconfig_proc_show, NULL);
53}
54
55static const struct file_operations pnpconfig_proc_fops = {
56 .owner = THIS_MODULE,
57 .open = pnpconfig_proc_open,
58 .read = seq_read,
59 .llseek = seq_lseek,
60 .release = single_release,
61};
62
63static int escd_info_proc_show(struct seq_file *m, void *v) 50static int escd_info_proc_show(struct seq_file *m, void *v)
64{ 51{
65 struct escd_info_struc escd; 52 struct escd_info_struc escd;
@@ -74,19 +61,6 @@ static int escd_info_proc_show(struct seq_file *m, void *v)
74 return 0; 61 return 0;
75} 62}
76 63
77static int escd_info_proc_open(struct inode *inode, struct file *file)
78{
79 return single_open(file, escd_info_proc_show, NULL);
80}
81
82static const struct file_operations escd_info_proc_fops = {
83 .owner = THIS_MODULE,
84 .open = escd_info_proc_open,
85 .read = seq_read,
86 .llseek = seq_lseek,
87 .release = single_release,
88};
89
90#define MAX_SANE_ESCD_SIZE (32*1024) 64#define MAX_SANE_ESCD_SIZE (32*1024)
91static int escd_proc_show(struct seq_file *m, void *v) 65static int escd_proc_show(struct seq_file *m, void *v)
92{ 66{
@@ -129,19 +103,6 @@ static int escd_proc_show(struct seq_file *m, void *v)
129 return 0; 103 return 0;
130} 104}
131 105
132static int escd_proc_open(struct inode *inode, struct file *file)
133{
134 return single_open(file, escd_proc_show, NULL);
135}
136
137static const struct file_operations escd_proc_fops = {
138 .owner = THIS_MODULE,
139 .open = escd_proc_open,
140 .read = seq_read,
141 .llseek = seq_lseek,
142 .release = single_release,
143};
144
145static int pnp_legacyres_proc_show(struct seq_file *m, void *v) 106static int pnp_legacyres_proc_show(struct seq_file *m, void *v)
146{ 107{
147 void *buf; 108 void *buf;
@@ -159,19 +120,6 @@ static int pnp_legacyres_proc_show(struct seq_file *m, void *v)
159 return 0; 120 return 0;
160} 121}
161 122
162static int pnp_legacyres_proc_open(struct inode *inode, struct file *file)
163{
164 return single_open(file, pnp_legacyres_proc_show, NULL);
165}
166
167static const struct file_operations pnp_legacyres_proc_fops = {
168 .owner = THIS_MODULE,
169 .open = pnp_legacyres_proc_open,
170 .read = seq_read,
171 .llseek = seq_lseek,
172 .release = single_release,
173};
174
175static int pnp_devices_proc_show(struct seq_file *m, void *v) 123static int pnp_devices_proc_show(struct seq_file *m, void *v)
176{ 124{
177 struct pnp_bios_node *node; 125 struct pnp_bios_node *node;
@@ -202,19 +150,6 @@ static int pnp_devices_proc_show(struct seq_file *m, void *v)
202 return 0; 150 return 0;
203} 151}
204 152
205static int pnp_devices_proc_open(struct inode *inode, struct file *file)
206{
207 return single_open(file, pnp_devices_proc_show, NULL);
208}
209
210static const struct file_operations pnp_devices_proc_fops = {
211 .owner = THIS_MODULE,
212 .open = pnp_devices_proc_open,
213 .read = seq_read,
214 .llseek = seq_lseek,
215 .release = single_release,
216};
217
218static int pnpbios_proc_show(struct seq_file *m, void *v) 153static int pnpbios_proc_show(struct seq_file *m, void *v)
219{ 154{
220 void *data = m->private; 155 void *data = m->private;
@@ -318,12 +253,13 @@ int __init pnpbios_proc_init(void)
318 proc_pnp_boot = proc_mkdir("boot", proc_pnp); 253 proc_pnp_boot = proc_mkdir("boot", proc_pnp);
319 if (!proc_pnp_boot) 254 if (!proc_pnp_boot)
320 return -EIO; 255 return -EIO;
321 proc_create("devices", 0, proc_pnp, &pnp_devices_proc_fops); 256 proc_create_single("devices", 0, proc_pnp, pnp_devices_proc_show);
322 proc_create("configuration_info", 0, proc_pnp, &pnpconfig_proc_fops); 257 proc_create_single("configuration_info", 0, proc_pnp,
323 proc_create("escd_info", 0, proc_pnp, &escd_info_proc_fops); 258 pnpconfig_proc_show);
324 proc_create("escd", S_IRUSR, proc_pnp, &escd_proc_fops); 259 proc_create_single("escd_info", 0, proc_pnp, escd_info_proc_show);
325 proc_create("legacy_device_resources", 0, proc_pnp, &pnp_legacyres_proc_fops); 260 proc_create_single("escd", S_IRUSR, proc_pnp, escd_proc_show);
326 261 proc_create_single("legacy_device_resources", 0, proc_pnp,
262 pnp_legacyres_proc_show);
327 return 0; 263 return 0;
328} 264}
329 265
diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c
index 50d38938ac6f..8bc8e42beb90 100644
--- a/drivers/staging/comedi/proc.c
+++ b/drivers/staging/comedi/proc.c
@@ -62,25 +62,9 @@ static int comedi_read(struct seq_file *m, void *v)
62 return 0; 62 return 0;
63} 63}
64 64
65/*
66 * seq_file wrappers for procfile show routines.
67 */
68static int comedi_proc_open(struct inode *inode, struct file *file)
69{
70 return single_open(file, comedi_read, NULL);
71}
72
73static const struct file_operations comedi_proc_fops = {
74 .owner = THIS_MODULE,
75 .open = comedi_proc_open,
76 .read = seq_read,
77 .llseek = seq_lseek,
78 .release = single_release,
79};
80
81void __init comedi_proc_init(void) 65void __init comedi_proc_init(void)
82{ 66{
83 if (!proc_create("comedi", 0444, NULL, &comedi_proc_fops)) 67 if (!proc_create_single("comedi", 0444, NULL, comedi_read))
84 pr_warn("comedi: unable to create proc entry\n"); 68 pr_warn("comedi: unable to create proc entry\n");
85} 69}
86 70
diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
index ad743a8493be..03959dc86cfd 100644
--- a/drivers/usb/gadget/udc/at91_udc.c
+++ b/drivers/usb/gadget/udc/at91_udc.c
@@ -234,22 +234,10 @@ static int proc_udc_show(struct seq_file *s, void *unused)
234 return 0; 234 return 0;
235} 235}
236 236
237static int proc_udc_open(struct inode *inode, struct file *file)
238{
239 return single_open(file, proc_udc_show, PDE_DATA(inode));
240}
241
242static const struct file_operations proc_ops = {
243 .owner = THIS_MODULE,
244 .open = proc_udc_open,
245 .read = seq_read,
246 .llseek = seq_lseek,
247 .release = single_release,
248};
249
250static void create_debug_file(struct at91_udc *udc) 237static void create_debug_file(struct at91_udc *udc)
251{ 238{
252 udc->pde = proc_create_data(debug_filename, 0, NULL, &proc_ops, udc); 239 udc->pde = proc_create_single_data(debug_filename, 0, NULL,
240 proc_udc_show, udc);
253} 241}
254 242
255static void remove_debug_file(struct at91_udc *udc) 243static void remove_debug_file(struct at91_udc *udc)
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index 56b517a38865..7d8af299dfc7 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2207,22 +2207,8 @@ static int fsl_proc_read(struct seq_file *m, void *v)
2207 return 0; 2207 return 0;
2208} 2208}
2209 2209
2210/* 2210#define create_proc_file() \
2211 * seq_file wrappers for procfile show routines. 2211 proc_create_single(proc_filename, 0, NULL, fsl_proc_read)
2212 */
2213static int fsl_proc_open(struct inode *inode, struct file *file)
2214{
2215 return single_open(file, fsl_proc_read, NULL);
2216}
2217
2218static const struct file_operations fsl_proc_fops = {
2219 .open = fsl_proc_open,
2220 .read = seq_read,
2221 .llseek = seq_lseek,
2222 .release = single_release,
2223};
2224
2225#define create_proc_file() proc_create(proc_filename, 0, NULL, &fsl_proc_fops)
2226#define remove_proc_file() remove_proc_entry(proc_filename, NULL) 2212#define remove_proc_file() remove_proc_entry(proc_filename, NULL)
2227 2213
2228#else /* !CONFIG_USB_GADGET_DEBUG_FILES */ 2214#else /* !CONFIG_USB_GADGET_DEBUG_FILES */
diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c
index 4504d0b202db..c3721225b61e 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -1241,22 +1241,6 @@ done:
1241 local_irq_restore(flags); 1241 local_irq_restore(flags);
1242 return 0; 1242 return 0;
1243} 1243}
1244
1245/*
1246 * seq_file wrappers for procfile show routines.
1247 */
1248static int udc_proc_open(struct inode *inode, struct file *file)
1249{
1250 return single_open(file, udc_proc_read, PDE_DATA(file_inode(file)));
1251}
1252
1253static const struct file_operations udc_proc_fops = {
1254 .open = udc_proc_open,
1255 .read = seq_read,
1256 .llseek = seq_lseek,
1257 .release = single_release,
1258};
1259
1260#endif /* CONFIG_USB_GADGET_DEBUG_FILES */ 1244#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
1261 1245
1262/*-------------------------------------------------------------------------*/ 1246/*-------------------------------------------------------------------------*/
@@ -1826,7 +1810,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1826 1810
1827 1811
1828#ifdef CONFIG_USB_GADGET_DEBUG_FILES 1812#ifdef CONFIG_USB_GADGET_DEBUG_FILES
1829 proc_create_data(proc_node_name, 0, NULL, &udc_proc_fops, dev); 1813 proc_create_single_data(proc_node_name, 0, NULL, udc_proc_read, dev);
1830#endif 1814#endif
1831 1815
1832 retval = usb_add_gadget_udc_release(&pdev->dev, &dev->gadget, 1816 retval = usb_add_gadget_udc_release(&pdev->dev, &dev->gadget,
diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c
index dc35a54bad90..3a16431da321 100644
--- a/drivers/usb/gadget/udc/omap_udc.c
+++ b/drivers/usb/gadget/udc/omap_udc.c
@@ -2432,22 +2432,9 @@ static int proc_udc_show(struct seq_file *s, void *_)
2432 return 0; 2432 return 0;
2433} 2433}
2434 2434
2435static int proc_udc_open(struct inode *inode, struct file *file)
2436{
2437 return single_open(file, proc_udc_show, NULL);
2438}
2439
2440static const struct file_operations proc_ops = {
2441 .owner = THIS_MODULE,
2442 .open = proc_udc_open,
2443 .read = seq_read,
2444 .llseek = seq_lseek,
2445 .release = single_release,
2446};
2447
2448static void create_proc_file(void) 2435static void create_proc_file(void)
2449{ 2436{
2450 proc_create(proc_filename, 0, NULL, &proc_ops); 2437 proc_create_single(proc_filename, 0, NULL, proc_udc_show);
2451} 2438}
2452 2439
2453static void remove_proc_file(void) 2440static void remove_proc_file(void)
diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c
index badee04ef496..9b45125988fb 100644
--- a/drivers/video/fbdev/via/viafbdev.c
+++ b/drivers/video/fbdev/via/viafbdev.c
@@ -1475,19 +1475,6 @@ static int viafb_sup_odev_proc_show(struct seq_file *m, void *v)
1475 return 0; 1475 return 0;
1476} 1476}
1477 1477
1478static int viafb_sup_odev_proc_open(struct inode *inode, struct file *file)
1479{
1480 return single_open(file, viafb_sup_odev_proc_show, NULL);
1481}
1482
1483static const struct file_operations viafb_sup_odev_proc_fops = {
1484 .owner = THIS_MODULE,
1485 .open = viafb_sup_odev_proc_open,
1486 .read = seq_read,
1487 .llseek = seq_lseek,
1488 .release = single_release,
1489};
1490
1491static ssize_t odev_update(const char __user *buffer, size_t count, u32 *odev) 1478static ssize_t odev_update(const char __user *buffer, size_t count, u32 *odev)
1492{ 1479{
1493 char buf[64], *ptr = buf; 1480 char buf[64], *ptr = buf;
@@ -1616,8 +1603,8 @@ static void viafb_init_proc(struct viafb_shared *shared)
1616 &viafb_vt1636_proc_fops); 1603 &viafb_vt1636_proc_fops);
1617#endif /* CONFIG_FB_VIA_DIRECT_PROCFS */ 1604#endif /* CONFIG_FB_VIA_DIRECT_PROCFS */
1618 1605
1619 proc_create("supported_output_devices", 0, viafb_entry, 1606 proc_create_single("supported_output_devices", 0, viafb_entry,
1620 &viafb_sup_odev_proc_fops); 1607 viafb_sup_odev_proc_show);
1621 iga1_entry = proc_mkdir("iga1", viafb_entry); 1608 iga1_entry = proc_mkdir("iga1", viafb_entry);
1622 shared->iga1_proc_entry = iga1_entry; 1609 shared->iga1_proc_entry = iga1_entry;
1623 proc_create("output_devices", 0, iga1_entry, 1610 proc_create("output_devices", 0, iga1_entry,
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 9d69ea433330..4bc4a7ac61d9 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -314,18 +314,6 @@ skip_rdma:
314 return 0; 314 return 0;
315} 315}
316 316
317static int cifs_debug_data_proc_open(struct inode *inode, struct file *file)
318{
319 return single_open(file, cifs_debug_data_proc_show, NULL);
320}
321
322static const struct file_operations cifs_debug_data_proc_fops = {
323 .open = cifs_debug_data_proc_open,
324 .read = seq_read,
325 .llseek = seq_lseek,
326 .release = single_release,
327};
328
329#ifdef CONFIG_CIFS_STATS 317#ifdef CONFIG_CIFS_STATS
330static ssize_t cifs_stats_proc_write(struct file *file, 318static ssize_t cifs_stats_proc_write(struct file *file,
331 const char __user *buffer, size_t count, loff_t *ppos) 319 const char __user *buffer, size_t count, loff_t *ppos)
@@ -497,7 +485,8 @@ cifs_proc_init(void)
497 if (proc_fs_cifs == NULL) 485 if (proc_fs_cifs == NULL)
498 return; 486 return;
499 487
500 proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops); 488 proc_create_single("DebugData", 0, proc_fs_cifs,
489 cifs_debug_data_proc_show);
501 490
502#ifdef CONFIG_CIFS_STATS 491#ifdef CONFIG_CIFS_STATS
503 proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops); 492 proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index f33a56d6e6dd..4b47ca6296a7 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -572,23 +572,6 @@ static int iostat_info_seq_show(struct seq_file *seq, void *offset)
572 return 0; 572 return 0;
573} 573}
574 574
575#define F2FS_PROC_FILE_DEF(_name) \
576static int _name##_open_fs(struct inode *inode, struct file *file) \
577{ \
578 return single_open(file, _name##_seq_show, PDE_DATA(inode)); \
579} \
580 \
581static const struct file_operations f2fs_seq_##_name##_fops = { \
582 .open = _name##_open_fs, \
583 .read = seq_read, \
584 .llseek = seq_lseek, \
585 .release = single_release, \
586};
587
588F2FS_PROC_FILE_DEF(segment_info);
589F2FS_PROC_FILE_DEF(segment_bits);
590F2FS_PROC_FILE_DEF(iostat_info);
591
592int __init f2fs_init_sysfs(void) 575int __init f2fs_init_sysfs(void)
593{ 576{
594 int ret; 577 int ret;
@@ -632,12 +615,12 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi)
632 sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root); 615 sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root);
633 616
634 if (sbi->s_proc) { 617 if (sbi->s_proc) {
635 proc_create_data("segment_info", S_IRUGO, sbi->s_proc, 618 proc_create_single_data("segment_info", S_IRUGO, sbi->s_proc,
636 &f2fs_seq_segment_info_fops, sb); 619 segment_info_seq_show, sb);
637 proc_create_data("segment_bits", S_IRUGO, sbi->s_proc, 620 proc_create_single_data("segment_bits", S_IRUGO, sbi->s_proc,
638 &f2fs_seq_segment_bits_fops, sb); 621 segment_bits_seq_show, sb);
639 proc_create_data("iostat_info", S_IRUGO, sbi->s_proc, 622 proc_create_single_data("iostat_info", S_IRUGO, sbi->s_proc,
640 &f2fs_seq_iostat_info_fops, sb); 623 iostat_info_seq_show, sb);
641 } 624 }
642 return 0; 625 return 0;
643} 626}
diff --git a/fs/filesystems.c b/fs/filesystems.c
index f2728a4a03a1..b03f57b1105b 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -238,21 +238,9 @@ static int filesystems_proc_show(struct seq_file *m, void *v)
238 return 0; 238 return 0;
239} 239}
240 240
241static int filesystems_proc_open(struct inode *inode, struct file *file)
242{
243 return single_open(file, filesystems_proc_show, NULL);
244}
245
246static const struct file_operations filesystems_proc_fops = {
247 .open = filesystems_proc_open,
248 .read = seq_read,
249 .llseek = seq_lseek,
250 .release = single_release,
251};
252
253static int __init proc_filesystems_init(void) 241static int __init proc_filesystems_init(void)
254{ 242{
255 proc_create("filesystems", 0, NULL, &filesystems_proc_fops); 243 proc_create_single("filesystems", 0, NULL, filesystems_proc_show);
256 return 0; 244 return 0;
257} 245}
258module_init(proc_filesystems_init); 246module_init(proc_filesystems_init);
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
index 53cfd0b34c38..f83328a7f048 100644
--- a/fs/fscache/internal.h
+++ b/fs/fscache/internal.h
@@ -295,7 +295,7 @@ static inline void fscache_stat_d(atomic_t *stat)
295 295
296#define __fscache_stat(stat) (stat) 296#define __fscache_stat(stat) (stat)
297 297
298extern const struct file_operations fscache_stats_fops; 298int fscache_stats_show(struct seq_file *m, void *v);
299#else 299#else
300 300
301#define __fscache_stat(stat) (NULL) 301#define __fscache_stat(stat) (NULL)
diff --git a/fs/fscache/proc.c b/fs/fscache/proc.c
index 459df553ea09..49a8c90414bc 100644
--- a/fs/fscache/proc.c
+++ b/fs/fscache/proc.c
@@ -26,8 +26,8 @@ int __init fscache_proc_init(void)
26 goto error_dir; 26 goto error_dir;
27 27
28#ifdef CONFIG_FSCACHE_STATS 28#ifdef CONFIG_FSCACHE_STATS
29 if (!proc_create("fs/fscache/stats", S_IFREG | 0444, NULL, 29 if (!proc_create_single("fs/fscache/stats", S_IFREG | 0444, NULL,
30 &fscache_stats_fops)) 30 fscache_stats_show))
31 goto error_stats; 31 goto error_stats;
32#endif 32#endif
33 33
diff --git a/fs/fscache/stats.c b/fs/fscache/stats.c
index fcc8c2f2690e..00564a1dfd76 100644
--- a/fs/fscache/stats.c
+++ b/fs/fscache/stats.c
@@ -138,7 +138,7 @@ atomic_t fscache_n_cache_culled_objects;
138/* 138/*
139 * display the general statistics 139 * display the general statistics
140 */ 140 */
141static int fscache_stats_show(struct seq_file *m, void *v) 141int fscache_stats_show(struct seq_file *m, void *v)
142{ 142{
143 seq_puts(m, "FS-Cache statistics\n"); 143 seq_puts(m, "FS-Cache statistics\n");
144 144
@@ -284,18 +284,3 @@ static int fscache_stats_show(struct seq_file *m, void *v)
284 atomic_read(&fscache_n_cache_culled_objects)); 284 atomic_read(&fscache_n_cache_culled_objects));
285 return 0; 285 return 0;
286} 286}
287
288/*
289 * open "/proc/fs/fscache/stats" allowing provision of a statistical summary
290 */
291static int fscache_stats_open(struct inode *inode, struct file *file)
292{
293 return single_open(file, fscache_stats_show, NULL);
294}
295
296const struct file_operations fscache_stats_fops = {
297 .open = fscache_stats_open,
298 .read = seq_read,
299 .llseek = seq_lseek,
300 .release = single_release,
301};
diff --git a/fs/proc/cmdline.c b/fs/proc/cmdline.c
index 8233e7af9389..fa762c5fbcb2 100644
--- a/fs/proc/cmdline.c
+++ b/fs/proc/cmdline.c
@@ -11,21 +11,9 @@ static int cmdline_proc_show(struct seq_file *m, void *v)
11 return 0; 11 return 0;
12} 12}
13 13
14static int cmdline_proc_open(struct inode *inode, struct file *file)
15{
16 return single_open(file, cmdline_proc_show, NULL);
17}
18
19static const struct file_operations cmdline_proc_fops = {
20 .open = cmdline_proc_open,
21 .read = seq_read,
22 .llseek = seq_lseek,
23 .release = single_release,
24};
25
26static int __init proc_cmdline_init(void) 14static int __init proc_cmdline_init(void)
27{ 15{
28 proc_create("cmdline", 0, NULL, &cmdline_proc_fops); 16 proc_create_single("cmdline", 0, NULL, cmdline_proc_show);
29 return 0; 17 return 0;
30} 18}
31fs_initcall(proc_cmdline_init); 19fs_initcall(proc_cmdline_init);
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index f87cb0053387..02bb1914f5f7 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -588,6 +588,35 @@ struct proc_dir_entry *proc_create_seq_private(const char *name, umode_t mode,
588} 588}
589EXPORT_SYMBOL(proc_create_seq_private); 589EXPORT_SYMBOL(proc_create_seq_private);
590 590
591static int proc_single_open(struct inode *inode, struct file *file)
592{
593 struct proc_dir_entry *de = PDE(inode);
594
595 return single_open(file, de->single_show, de->data);
596}
597
598static const struct file_operations proc_single_fops = {
599 .open = proc_single_open,
600 .read = seq_read,
601 .llseek = seq_lseek,
602 .release = single_release,
603};
604
605struct proc_dir_entry *proc_create_single_data(const char *name, umode_t mode,
606 struct proc_dir_entry *parent,
607 int (*show)(struct seq_file *, void *), void *data)
608{
609 struct proc_dir_entry *p;
610
611 p = proc_create_reg(name, mode, &parent, data);
612 if (!p)
613 return NULL;
614 p->proc_fops = &proc_single_fops;
615 p->single_show = show;
616 return proc_register(parent, p);
617}
618EXPORT_SYMBOL(proc_create_single_data);
619
591void proc_set_size(struct proc_dir_entry *de, loff_t size) 620void proc_set_size(struct proc_dir_entry *de, loff_t size)
592{ 621{
593 de->size = size; 622 de->size = size;
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index bcfe830ffd59..84c68508a256 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -44,7 +44,10 @@ struct proc_dir_entry {
44 struct completion *pde_unload_completion; 44 struct completion *pde_unload_completion;
45 const struct inode_operations *proc_iops; 45 const struct inode_operations *proc_iops;
46 const struct file_operations *proc_fops; 46 const struct file_operations *proc_fops;
47 const struct seq_operations *seq_ops; 47 union {
48 const struct seq_operations *seq_ops;
49 int (*single_show)(struct seq_file *, void *);
50 };
48 void *data; 51 void *data;
49 unsigned int state_size; 52 unsigned int state_size;
50 unsigned int low_ino; 53 unsigned int low_ino;
diff --git a/fs/proc/loadavg.c b/fs/proc/loadavg.c
index b572cc865b92..d06694757201 100644
--- a/fs/proc/loadavg.c
+++ b/fs/proc/loadavg.c
@@ -28,21 +28,9 @@ static int loadavg_proc_show(struct seq_file *m, void *v)
28 return 0; 28 return 0;
29} 29}
30 30
31static int loadavg_proc_open(struct inode *inode, struct file *file)
32{
33 return single_open(file, loadavg_proc_show, NULL);
34}
35
36static const struct file_operations loadavg_proc_fops = {
37 .open = loadavg_proc_open,
38 .read = seq_read,
39 .llseek = seq_lseek,
40 .release = single_release,
41};
42
43static int __init proc_loadavg_init(void) 31static int __init proc_loadavg_init(void)
44{ 32{
45 proc_create("loadavg", 0, NULL, &loadavg_proc_fops); 33 proc_create_single("loadavg", 0, NULL, loadavg_proc_show);
46 return 0; 34 return 0;
47} 35}
48fs_initcall(proc_loadavg_init); 36fs_initcall(proc_loadavg_init);
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 65a72ab57471..2fb04846ed11 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -149,21 +149,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
149 return 0; 149 return 0;
150} 150}
151 151
152static int meminfo_proc_open(struct inode *inode, struct file *file)
153{
154 return single_open(file, meminfo_proc_show, NULL);
155}
156
157static const struct file_operations meminfo_proc_fops = {
158 .open = meminfo_proc_open,
159 .read = seq_read,
160 .llseek = seq_lseek,
161 .release = single_release,
162};
163
164static int __init proc_meminfo_init(void) 152static int __init proc_meminfo_init(void)
165{ 153{
166 proc_create("meminfo", 0, NULL, &meminfo_proc_fops); 154 proc_create_single("meminfo", 0, NULL, meminfo_proc_show);
167 return 0; 155 return 0;
168} 156}
169fs_initcall(proc_meminfo_init); 157fs_initcall(proc_meminfo_init);
diff --git a/fs/proc/softirqs.c b/fs/proc/softirqs.c
index 24072cc06e65..12901dcf57e2 100644
--- a/fs/proc/softirqs.c
+++ b/fs/proc/softirqs.c
@@ -25,21 +25,9 @@ static int show_softirqs(struct seq_file *p, void *v)
25 return 0; 25 return 0;
26} 26}
27 27
28static int softirqs_open(struct inode *inode, struct file *file)
29{
30 return single_open(file, show_softirqs, NULL);
31}
32
33static const struct file_operations proc_softirqs_operations = {
34 .open = softirqs_open,
35 .read = seq_read,
36 .llseek = seq_lseek,
37 .release = single_release,
38};
39
40static int __init proc_softirqs_init(void) 28static int __init proc_softirqs_init(void)
41{ 29{
42 proc_create("softirqs", 0, NULL, &proc_softirqs_operations); 30 proc_create_single("softirqs", 0, NULL, show_softirqs);
43 return 0; 31 return 0;
44} 32}
45fs_initcall(proc_softirqs_init); 33fs_initcall(proc_softirqs_init);
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
index 95a708d83721..3bd12f955867 100644
--- a/fs/proc/uptime.c
+++ b/fs/proc/uptime.c
@@ -30,21 +30,9 @@ static int uptime_proc_show(struct seq_file *m, void *v)
30 return 0; 30 return 0;
31} 31}
32 32
33static int uptime_proc_open(struct inode *inode, struct file *file)
34{
35 return single_open(file, uptime_proc_show, NULL);
36}
37
38static const struct file_operations uptime_proc_fops = {
39 .open = uptime_proc_open,
40 .read = seq_read,
41 .llseek = seq_lseek,
42 .release = single_release,
43};
44
45static int __init proc_uptime_init(void) 33static int __init proc_uptime_init(void)
46{ 34{
47 proc_create("uptime", 0, NULL, &uptime_proc_fops); 35 proc_create_single("uptime", 0, NULL, uptime_proc_show);
48 return 0; 36 return 0;
49} 37}
50fs_initcall(proc_uptime_init); 38fs_initcall(proc_uptime_init);
diff --git a/fs/proc/version.c b/fs/proc/version.c
index 94901e8e700d..b449f186577f 100644
--- a/fs/proc/version.c
+++ b/fs/proc/version.c
@@ -15,21 +15,9 @@ static int version_proc_show(struct seq_file *m, void *v)
15 return 0; 15 return 0;
16} 16}
17 17
18static int version_proc_open(struct inode *inode, struct file *file)
19{
20 return single_open(file, version_proc_show, NULL);
21}
22
23static const struct file_operations version_proc_fops = {
24 .open = version_proc_open,
25 .read = seq_read,
26 .llseek = seq_lseek,
27 .release = single_release,
28};
29
30static int __init proc_version_init(void) 18static int __init proc_version_init(void)
31{ 19{
32 proc_create("version", 0, NULL, &version_proc_fops); 20 proc_create_single("version", 0, NULL, version_proc_show);
33 return 0; 21 return 0;
34} 22}
35fs_initcall(proc_version_init); 23fs_initcall(proc_version_init);
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
index fe999157dd97..e39b3910d24d 100644
--- a/fs/reiserfs/procfs.c
+++ b/fs/reiserfs/procfs.c
@@ -389,27 +389,13 @@ static int show_journal(struct seq_file *m, void *unused)
389 return 0; 389 return 0;
390} 390}
391 391
392static int r_open(struct inode *inode, struct file *file)
393{
394 return single_open(file, PDE_DATA(inode),
395 proc_get_parent_data(inode));
396}
397
398static const struct file_operations r_file_operations = {
399 .open = r_open,
400 .read = seq_read,
401 .llseek = seq_lseek,
402 .release = single_release,
403};
404
405static struct proc_dir_entry *proc_info_root = NULL; 392static struct proc_dir_entry *proc_info_root = NULL;
406static const char proc_info_root_name[] = "fs/reiserfs"; 393static const char proc_info_root_name[] = "fs/reiserfs";
407 394
408static void add_file(struct super_block *sb, char *name, 395static void add_file(struct super_block *sb, char *name,
409 int (*func) (struct seq_file *, void *)) 396 int (*func) (struct seq_file *, void *))
410{ 397{
411 proc_create_data(name, 0, REISERFS_SB(sb)->procdir, 398 proc_create_single_data(name, 0, REISERFS_SB(sb)->procdir, func, sb);
412 &r_file_operations, func);
413} 399}
414 400
415int reiserfs_proc_info_init(struct super_block *sb) 401int reiserfs_proc_info_init(struct super_block *sb)
diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
index 056e12b421eb..04762a72e344 100644
--- a/fs/xfs/xfs_stats.c
+++ b/fs/xfs/xfs_stats.c
@@ -124,18 +124,6 @@ static int xqm_proc_show(struct seq_file *m, void *v)
124 return 0; 124 return 0;
125} 125}
126 126
127static int xqm_proc_open(struct inode *inode, struct file *file)
128{
129 return single_open(file, xqm_proc_show, NULL);
130}
131
132static const struct file_operations xqm_proc_fops = {
133 .open = xqm_proc_open,
134 .read = seq_read,
135 .llseek = seq_lseek,
136 .release = single_release,
137};
138
139/* legacy quota stats interface no 2 */ 127/* legacy quota stats interface no 2 */
140static int xqmstat_proc_show(struct seq_file *m, void *v) 128static int xqmstat_proc_show(struct seq_file *m, void *v)
141{ 129{
@@ -147,19 +135,6 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
147 seq_putc(m, '\n'); 135 seq_putc(m, '\n');
148 return 0; 136 return 0;
149} 137}
150
151static int xqmstat_proc_open(struct inode *inode, struct file *file)
152{
153 return single_open(file, xqmstat_proc_show, NULL);
154}
155
156static const struct file_operations xqmstat_proc_fops = {
157 .owner = THIS_MODULE,
158 .open = xqmstat_proc_open,
159 .read = seq_read,
160 .llseek = seq_lseek,
161 .release = single_release,
162};
163#endif /* CONFIG_XFS_QUOTA */ 138#endif /* CONFIG_XFS_QUOTA */
164 139
165#ifdef CONFIG_PROC_FS 140#ifdef CONFIG_PROC_FS
@@ -174,11 +149,9 @@ xfs_init_procfs(void)
174 goto out; 149 goto out;
175 150
176#ifdef CONFIG_XFS_QUOTA 151#ifdef CONFIG_XFS_QUOTA
177 if (!proc_create("fs/xfs/xqmstat", 0, NULL, 152 if (!proc_create_single("fs/xfs/xqmstat", 0, NULL, xqmstat_proc_show))
178 &xqmstat_proc_fops))
179 goto out; 153 goto out;
180 if (!proc_create("fs/xfs/xqm", 0, NULL, 154 if (!proc_create_single("fs/xfs/xqm", 0, NULL, xqm_proc_show))
181 &xqm_proc_fops))
182 goto out; 155 goto out;
183#endif 156#endif
184 return 0; 157 return 0;
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 314713a48817..2529b871f379 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -9,6 +9,7 @@
9#include <linux/fs.h> 9#include <linux/fs.h>
10 10
11struct proc_dir_entry; 11struct proc_dir_entry;
12struct seq_file;
12struct seq_operations; 13struct seq_operations;
13 14
14#ifdef CONFIG_PROC_FS 15#ifdef CONFIG_PROC_FS
@@ -32,6 +33,11 @@ struct proc_dir_entry *proc_create_seq_private(const char *name, umode_t mode,
32 proc_create_seq_private(name, mode, parent, ops, 0, data) 33 proc_create_seq_private(name, mode, parent, ops, 0, data)
33#define proc_create_seq(name, mode, parent, ops) \ 34#define proc_create_seq(name, mode, parent, ops) \
34 proc_create_seq_private(name, mode, parent, ops, 0, NULL) 35 proc_create_seq_private(name, mode, parent, ops, 0, NULL)
36struct proc_dir_entry *proc_create_single_data(const char *name, umode_t mode,
37 struct proc_dir_entry *parent,
38 int (*show)(struct seq_file *, void *), void *data);
39#define proc_create_single(name, mode, parent, show) \
40 proc_create_single_data(name, mode, parent, show, NULL)
35 41
36extern struct proc_dir_entry *proc_create_data(const char *, umode_t, 42extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
37 struct proc_dir_entry *, 43 struct proc_dir_entry *,
@@ -66,9 +72,11 @@ static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
66 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } 72 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }
67static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 73static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
68 umode_t mode, struct proc_dir_entry *parent) { return NULL; } 74 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
69#define proc_create_seq_private(name, mode, parent, ops, 0, data) ({NULL;}) 75#define proc_create_seq_private(name, mode, parent, ops, size, data) ({NULL;})
70#define proc_create_seq_data(name, mode, parent, ops, data) ({NULL;}) 76#define proc_create_seq_data(name, mode, parent, ops, data) ({NULL;})
71#define proc_create_seq(name, mode, parent, ops) ({NULL;}) 77#define proc_create_seq(name, mode, parent, ops) ({NULL;})
78#define proc_create_single(name, mode, parent, show) ({NULL;})
79#define proc_create_single_data(name, mode, parent, show, data) ({NULL;})
72#define proc_create(name, mode, parent, proc_fops) ({NULL;}) 80#define proc_create(name, mode, parent, proc_fops) ({NULL;})
73#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) 81#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;})
74 82
diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h
index b928b27050c6..0808a33d16d3 100644
--- a/kernel/cgroup/cgroup-internal.h
+++ b/kernel/cgroup/cgroup-internal.h
@@ -218,9 +218,9 @@ extern const struct proc_ns_operations cgroupns_operations;
218 * cgroup-v1.c 218 * cgroup-v1.c
219 */ 219 */
220extern struct cftype cgroup1_base_files[]; 220extern struct cftype cgroup1_base_files[];
221extern const struct file_operations proc_cgroupstats_operations;
222extern struct kernfs_syscall_ops cgroup1_kf_syscall_ops; 221extern struct kernfs_syscall_ops cgroup1_kf_syscall_ops;
223 222
223int proc_cgroupstats_show(struct seq_file *m, void *v);
224bool cgroup1_ssid_disabled(int ssid); 224bool cgroup1_ssid_disabled(int ssid);
225void cgroup1_pidlist_destroy_all(struct cgroup *cgrp); 225void cgroup1_pidlist_destroy_all(struct cgroup *cgrp);
226void cgroup1_release_agent(struct work_struct *work); 226void cgroup1_release_agent(struct work_struct *work);
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index a2c05d2476ac..e06c97f3ed1a 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -682,7 +682,7 @@ struct cftype cgroup1_base_files[] = {
682}; 682};
683 683
684/* Display information about each subsystem and each hierarchy */ 684/* Display information about each subsystem and each hierarchy */
685static int proc_cgroupstats_show(struct seq_file *m, void *v) 685int proc_cgroupstats_show(struct seq_file *m, void *v)
686{ 686{
687 struct cgroup_subsys *ss; 687 struct cgroup_subsys *ss;
688 int i; 688 int i;
@@ -705,18 +705,6 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)
705 return 0; 705 return 0;
706} 706}
707 707
708static int cgroupstats_open(struct inode *inode, struct file *file)
709{
710 return single_open(file, proc_cgroupstats_show, NULL);
711}
712
713const struct file_operations proc_cgroupstats_operations = {
714 .open = cgroupstats_open,
715 .read = seq_read,
716 .llseek = seq_lseek,
717 .release = single_release,
718};
719
720/** 708/**
721 * cgroupstats_build - build and fill cgroupstats 709 * cgroupstats_build - build and fill cgroupstats
722 * @stats: cgroupstats to fill information into 710 * @stats: cgroupstats to fill information into
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index a662bfcbea0e..12883656e63e 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5335,7 +5335,7 @@ int __init cgroup_init(void)
5335 WARN_ON(sysfs_create_mount_point(fs_kobj, "cgroup")); 5335 WARN_ON(sysfs_create_mount_point(fs_kobj, "cgroup"));
5336 WARN_ON(register_filesystem(&cgroup_fs_type)); 5336 WARN_ON(register_filesystem(&cgroup_fs_type));
5337 WARN_ON(register_filesystem(&cgroup2_fs_type)); 5337 WARN_ON(register_filesystem(&cgroup2_fs_type));
5338 WARN_ON(!proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations)); 5338 WARN_ON(!proc_create_single("cgroups", 0, NULL, proc_cgroupstats_show));
5339 5339
5340 return 0; 5340 return 0;
5341} 5341}
diff --git a/kernel/dma.c b/kernel/dma.c
index 3506fc34a712..40f152936316 100644
--- a/kernel/dma.c
+++ b/kernel/dma.c
@@ -135,21 +135,9 @@ static int proc_dma_show(struct seq_file *m, void *v)
135} 135}
136#endif /* MAX_DMA_CHANNELS */ 136#endif /* MAX_DMA_CHANNELS */
137 137
138static int proc_dma_open(struct inode *inode, struct file *file)
139{
140 return single_open(file, proc_dma_show, NULL);
141}
142
143static const struct file_operations proc_dma_operations = {
144 .open = proc_dma_open,
145 .read = seq_read,
146 .llseek = seq_lseek,
147 .release = single_release,
148};
149
150static int __init proc_dma_init(void) 138static int __init proc_dma_init(void)
151{ 139{
152 proc_create("dma", 0, NULL, &proc_dma_operations); 140 proc_create_single("dma", 0, NULL, proc_dma_show);
153 return 0; 141 return 0;
154} 142}
155 143
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index a5697119290e..33f07c5f2515 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -27,21 +27,9 @@ static int execdomains_proc_show(struct seq_file *m, void *v)
27 return 0; 27 return 0;
28} 28}
29 29
30static int execdomains_proc_open(struct inode *inode, struct file *file)
31{
32 return single_open(file, execdomains_proc_show, NULL);
33}
34
35static const struct file_operations execdomains_proc_fops = {
36 .open = execdomains_proc_open,
37 .read = seq_read,
38 .llseek = seq_lseek,
39 .release = single_release,
40};
41
42static int __init proc_execdomains_init(void) 30static int __init proc_execdomains_init(void)
43{ 31{
44 proc_create("execdomains", 0, NULL, &execdomains_proc_fops); 32 proc_create_single("execdomains", 0, NULL, execdomains_proc_show);
45 return 0; 33 return 0;
46} 34}
47module_init(proc_execdomains_init); 35module_init(proc_execdomains_init);
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 7cb091d81d91..37eda10f5c36 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -185,11 +185,6 @@ static int irq_affinity_list_proc_open(struct inode *inode, struct file *file)
185 return single_open(file, irq_affinity_list_proc_show, PDE_DATA(inode)); 185 return single_open(file, irq_affinity_list_proc_show, PDE_DATA(inode));
186} 186}
187 187
188static int irq_affinity_hint_proc_open(struct inode *inode, struct file *file)
189{
190 return single_open(file, irq_affinity_hint_proc_show, PDE_DATA(inode));
191}
192
193static const struct file_operations irq_affinity_proc_fops = { 188static const struct file_operations irq_affinity_proc_fops = {
194 .open = irq_affinity_proc_open, 189 .open = irq_affinity_proc_open,
195 .read = seq_read, 190 .read = seq_read,
@@ -198,13 +193,6 @@ static const struct file_operations irq_affinity_proc_fops = {
198 .write = irq_affinity_proc_write, 193 .write = irq_affinity_proc_write,
199}; 194};
200 195
201static const struct file_operations irq_affinity_hint_proc_fops = {
202 .open = irq_affinity_hint_proc_open,
203 .read = seq_read,
204 .llseek = seq_lseek,
205 .release = single_release,
206};
207
208static const struct file_operations irq_affinity_list_proc_fops = { 196static const struct file_operations irq_affinity_list_proc_fops = {
209 .open = irq_affinity_list_proc_open, 197 .open = irq_affinity_list_proc_open,
210 .read = seq_read, 198 .read = seq_read,
@@ -223,32 +211,6 @@ static int irq_effective_aff_list_proc_show(struct seq_file *m, void *v)
223{ 211{
224 return show_irq_affinity(EFFECTIVE_LIST, m); 212 return show_irq_affinity(EFFECTIVE_LIST, m);
225} 213}
226
227static int irq_effective_aff_proc_open(struct inode *inode, struct file *file)
228{
229 return single_open(file, irq_effective_aff_proc_show, PDE_DATA(inode));
230}
231
232static int irq_effective_aff_list_proc_open(struct inode *inode,
233 struct file *file)
234{
235 return single_open(file, irq_effective_aff_list_proc_show,
236 PDE_DATA(inode));
237}
238
239static const struct file_operations irq_effective_aff_proc_fops = {
240 .open = irq_effective_aff_proc_open,
241 .read = seq_read,
242 .llseek = seq_lseek,
243 .release = single_release,
244};
245
246static const struct file_operations irq_effective_aff_list_proc_fops = {
247 .open = irq_effective_aff_list_proc_open,
248 .read = seq_read,
249 .llseek = seq_lseek,
250 .release = single_release,
251};
252#endif 214#endif
253 215
254static int default_affinity_show(struct seq_file *m, void *v) 216static int default_affinity_show(struct seq_file *m, void *v)
@@ -313,18 +275,6 @@ static int irq_node_proc_show(struct seq_file *m, void *v)
313 seq_printf(m, "%d\n", irq_desc_get_node(desc)); 275 seq_printf(m, "%d\n", irq_desc_get_node(desc));
314 return 0; 276 return 0;
315} 277}
316
317static int irq_node_proc_open(struct inode *inode, struct file *file)
318{
319 return single_open(file, irq_node_proc_show, PDE_DATA(inode));
320}
321
322static const struct file_operations irq_node_proc_fops = {
323 .open = irq_node_proc_open,
324 .read = seq_read,
325 .llseek = seq_lseek,
326 .release = single_release,
327};
328#endif 278#endif
329 279
330static int irq_spurious_proc_show(struct seq_file *m, void *v) 280static int irq_spurious_proc_show(struct seq_file *m, void *v)
@@ -337,18 +287,6 @@ static int irq_spurious_proc_show(struct seq_file *m, void *v)
337 return 0; 287 return 0;
338} 288}
339 289
340static int irq_spurious_proc_open(struct inode *inode, struct file *file)
341{
342 return single_open(file, irq_spurious_proc_show, PDE_DATA(inode));
343}
344
345static const struct file_operations irq_spurious_proc_fops = {
346 .open = irq_spurious_proc_open,
347 .read = seq_read,
348 .llseek = seq_lseek,
349 .release = single_release,
350};
351
352#define MAX_NAMELEN 128 290#define MAX_NAMELEN 128
353 291
354static int name_unique(unsigned int irq, struct irqaction *new_action) 292static int name_unique(unsigned int irq, struct irqaction *new_action)
@@ -421,24 +359,24 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
421 &irq_affinity_proc_fops, irqp); 359 &irq_affinity_proc_fops, irqp);
422 360
423 /* create /proc/irq/<irq>/affinity_hint */ 361 /* create /proc/irq/<irq>/affinity_hint */
424 proc_create_data("affinity_hint", 0444, desc->dir, 362 proc_create_single_data("affinity_hint", 0444, desc->dir,
425 &irq_affinity_hint_proc_fops, irqp); 363 irq_affinity_hint_proc_show, irqp);
426 364
427 /* create /proc/irq/<irq>/smp_affinity_list */ 365 /* create /proc/irq/<irq>/smp_affinity_list */
428 proc_create_data("smp_affinity_list", 0644, desc->dir, 366 proc_create_data("smp_affinity_list", 0644, desc->dir,
429 &irq_affinity_list_proc_fops, irqp); 367 &irq_affinity_list_proc_fops, irqp);
430 368
431 proc_create_data("node", 0444, desc->dir, 369 proc_create_single_data("node", 0444, desc->dir, irq_node_proc_show,
432 &irq_node_proc_fops, irqp); 370 irqp);
433# ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK 371# ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
434 proc_create_data("effective_affinity", 0444, desc->dir, 372 proc_create_single_data("effective_affinity", 0444, desc->dir,
435 &irq_effective_aff_proc_fops, irqp); 373 irq_effective_aff_proc_show, irqp);
436 proc_create_data("effective_affinity_list", 0444, desc->dir, 374 proc_create_single_data("effective_affinity_list", 0444, desc->dir,
437 &irq_effective_aff_list_proc_fops, irqp); 375 irq_effective_aff_list_proc_show, irqp);
438# endif 376# endif
439#endif 377#endif
440 proc_create_data("spurious", 0444, desc->dir, 378 proc_create_single_data("spurious", 0444, desc->dir,
441 &irq_spurious_proc_fops, (void *)(long)irq); 379 irq_spurious_proc_show, (void *)(long)irq);
442 380
443out_unlock: 381out_unlock:
444 mutex_unlock(&register_lock); 382 mutex_unlock(&register_lock);
diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
index 3629049648a1..3dd980dfba2d 100644
--- a/kernel/locking/lockdep_proc.c
+++ b/kernel/locking/lockdep_proc.c
@@ -331,18 +331,6 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
331 return 0; 331 return 0;
332} 332}
333 333
334static int lockdep_stats_open(struct inode *inode, struct file *file)
335{
336 return single_open(file, lockdep_stats_show, NULL);
337}
338
339static const struct file_operations proc_lockdep_stats_operations = {
340 .open = lockdep_stats_open,
341 .read = seq_read,
342 .llseek = seq_lseek,
343 .release = single_release,
344};
345
346#ifdef CONFIG_LOCK_STAT 334#ifdef CONFIG_LOCK_STAT
347 335
348struct lock_stat_data { 336struct lock_stat_data {
@@ -662,9 +650,7 @@ static int __init lockdep_proc_init(void)
662#ifdef CONFIG_PROVE_LOCKING 650#ifdef CONFIG_PROVE_LOCKING
663 proc_create_seq("lockdep_chains", S_IRUSR, NULL, &lockdep_chains_ops); 651 proc_create_seq("lockdep_chains", S_IRUSR, NULL, &lockdep_chains_ops);
664#endif 652#endif
665 proc_create("lockdep_stats", S_IRUSR, NULL, 653 proc_create_single("lockdep_stats", S_IRUSR, NULL, lockdep_stats_show);
666 &proc_lockdep_stats_operations);
667
668#ifdef CONFIG_LOCK_STAT 654#ifdef CONFIG_LOCK_STAT
669 proc_create("lock_stat", S_IRUSR | S_IWUSR, NULL, 655 proc_create("lock_stat", S_IRUSR | S_IWUSR, NULL,
670 &proc_lock_stat_operations); 656 &proc_lock_stat_operations);
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index a627a5db2125..d3e3f0f2ec1c 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -87,22 +87,6 @@ static const struct file_operations vlan_fops = {
87}; 87};
88 88
89/* 89/*
90 * /proc/net/vlan/<device> file and inode operations
91 */
92
93static int vlandev_seq_open(struct inode *inode, struct file *file)
94{
95 return single_open(file, vlandev_seq_show, PDE_DATA(inode));
96}
97
98static const struct file_operations vlandev_fops = {
99 .open = vlandev_seq_open,
100 .read = seq_read,
101 .llseek = seq_lseek,
102 .release = single_release,
103};
104
105/*
106 * Proc filesystem directory entries. 90 * Proc filesystem directory entries.
107 */ 91 */
108 92
@@ -171,9 +155,8 @@ int vlan_proc_add_dev(struct net_device *vlandev)
171 155
172 if (!strcmp(vlandev->name, name_conf)) 156 if (!strcmp(vlandev->name, name_conf))
173 return -EINVAL; 157 return -EINVAL;
174 vlan->dent = 158 vlan->dent = proc_create_single_data(vlandev->name, S_IFREG | 0600,
175 proc_create_data(vlandev->name, S_IFREG | 0600, 159 vn->proc_vlan_dir, vlandev_seq_show, vlandev);
176 vn->proc_vlan_dir, &vlandev_fops, vlandev);
177 if (!vlan->dent) 160 if (!vlan->dent)
178 return -ENOBUFS; 161 return -ENOBUFS;
179 return 0; 162 return 0;
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 43f620feb1c4..bbcbcc113d19 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1282,18 +1282,6 @@ static int pnp_seq_show(struct seq_file *seq, void *v)
1282 &ic_servaddr); 1282 &ic_servaddr);
1283 return 0; 1283 return 0;
1284} 1284}
1285
1286static int pnp_seq_open(struct inode *indoe, struct file *file)
1287{
1288 return single_open(file, pnp_seq_show, NULL);
1289}
1290
1291static const struct file_operations pnp_seq_fops = {
1292 .open = pnp_seq_open,
1293 .read = seq_read,
1294 .llseek = seq_lseek,
1295 .release = single_release,
1296};
1297#endif /* CONFIG_PROC_FS */ 1285#endif /* CONFIG_PROC_FS */
1298 1286
1299/* 1287/*
@@ -1369,7 +1357,7 @@ static int __init ip_auto_config(void)
1369 unsigned int i; 1357 unsigned int i;
1370 1358
1371#ifdef CONFIG_PROC_FS 1359#ifdef CONFIG_PROC_FS
1372 proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops); 1360 proc_create_single("pnp", 0444, init_net.proc_net, pnp_seq_show);
1373#endif /* CONFIG_PROC_FS */ 1361#endif /* CONFIG_PROC_FS */
1374 1362
1375 if (!ic_enable) 1363 if (!ic_enable)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 29268efad247..49f5f3e5dc30 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -360,18 +360,6 @@ static int rt_acct_proc_show(struct seq_file *m, void *v)
360 kfree(dst); 360 kfree(dst);
361 return 0; 361 return 0;
362} 362}
363
364static int rt_acct_proc_open(struct inode *inode, struct file *file)
365{
366 return single_open(file, rt_acct_proc_show, NULL);
367}
368
369static const struct file_operations rt_acct_proc_fops = {
370 .open = rt_acct_proc_open,
371 .read = seq_read,
372 .llseek = seq_lseek,
373 .release = single_release,
374};
375#endif 363#endif
376 364
377static int __net_init ip_rt_do_proc_init(struct net *net) 365static int __net_init ip_rt_do_proc_init(struct net *net)
@@ -389,7 +377,8 @@ static int __net_init ip_rt_do_proc_init(struct net *net)
389 goto err2; 377 goto err2;
390 378
391#ifdef CONFIG_IP_ROUTE_CLASSID 379#ifdef CONFIG_IP_ROUTE_CLASSID
392 pde = proc_create("rt_acct", 0, net->proc_net, &rt_acct_proc_fops); 380 pde = proc_create_single("rt_acct", 0, net->proc_net,
381 rt_acct_proc_show);
393 if (!pde) 382 if (!pde)
394 goto err3; 383 goto err3;
395#endif 384#endif
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index a85f7e0b14b1..a0edf194822a 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -267,18 +267,6 @@ static int snmp6_dev_seq_show(struct seq_file *seq, void *v)
267 return 0; 267 return 0;
268} 268}
269 269
270static int snmp6_dev_seq_open(struct inode *inode, struct file *file)
271{
272 return single_open(file, snmp6_dev_seq_show, PDE_DATA(inode));
273}
274
275static const struct file_operations snmp6_dev_seq_fops = {
276 .open = snmp6_dev_seq_open,
277 .read = seq_read,
278 .llseek = seq_lseek,
279 .release = single_release,
280};
281
282int snmp6_register_dev(struct inet6_dev *idev) 270int snmp6_register_dev(struct inet6_dev *idev)
283{ 271{
284 struct proc_dir_entry *p; 272 struct proc_dir_entry *p;
@@ -291,9 +279,8 @@ int snmp6_register_dev(struct inet6_dev *idev)
291 if (!net->mib.proc_net_devsnmp6) 279 if (!net->mib.proc_net_devsnmp6)
292 return -ENOENT; 280 return -ENOENT;
293 281
294 p = proc_create_data(idev->dev->name, 0444, 282 p = proc_create_single_data(idev->dev->name, 0444,
295 net->mib.proc_net_devsnmp6, 283 net->mib.proc_net_devsnmp6, snmp6_dev_seq_show, idev);
296 &snmp6_dev_seq_fops, idev);
297 if (!p) 284 if (!p)
298 return -ENOMEM; 285 return -ENOMEM;
299 286
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 106dae7e4818..54eca685420f 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -2092,23 +2092,11 @@ static int psched_show(struct seq_file *seq, void *v)
2092 return 0; 2092 return 0;
2093} 2093}
2094 2094
2095static int psched_open(struct inode *inode, struct file *file)
2096{
2097 return single_open(file, psched_show, NULL);
2098}
2099
2100static const struct file_operations psched_fops = {
2101 .open = psched_open,
2102 .read = seq_read,
2103 .llseek = seq_lseek,
2104 .release = single_release,
2105};
2106
2107static int __net_init psched_net_init(struct net *net) 2095static int __net_init psched_net_init(struct net *net)
2108{ 2096{
2109 struct proc_dir_entry *e; 2097 struct proc_dir_entry *e;
2110 2098
2111 e = proc_create("psched", 0, net->proc_net, &psched_fops); 2099 e = proc_create_single("psched", 0, net->proc_net, psched_show);
2112 if (e == NULL) 2100 if (e == NULL)
2113 return -ENOMEM; 2101 return -ENOMEM;
2114 2102