Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+235 -1509
+1 -13
arch/arm/kernel/dma.c
··· 276 276 return 0; 277 277 } 278 278 279 - static int proc_dma_open(struct inode *inode, struct file *file) 280 - { 281 - return single_open(file, proc_dma_show, NULL); 282 - } 283 - 284 - static 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 - 291 279 static 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 282 return 0; 295 283 } 296 284
+2 -13
arch/arm/kernel/swp_emulate.c
··· 91 91 seq_printf(m, "Last process:\t\t%d\n", previous_pid); 92 92 return 0; 93 93 } 94 - 95 - static int proc_status_open(struct inode *inode, struct file *file) 96 - { 97 - return single_open(file, proc_status_show, PDE_DATA(inode)); 98 - } 99 - 100 - static 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 94 #endif 107 95 108 96 /* ··· 248 260 return 0; 249 261 250 262 #ifdef CONFIG_PROC_FS 251 - if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops)) 263 + if (!proc_create_single("cpu/swp_emulation", S_IRUGO, NULL, 264 + proc_status_show)) 252 265 return -ENOMEM; 253 266 #endif /* CONFIG_PROC_FS */ 254 267
+2 -14
arch/arm/mach-rpc/ecard.c
··· 657 657 return 0; 658 658 } 659 659 660 - static int ecard_devices_proc_open(struct inode *inode, struct file *file) 661 - { 662 - return single_open(file, ecard_devices_proc_show, NULL); 663 - } 664 - 665 - static 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 - 673 660 static struct proc_dir_entry *proc_bus_ecard_dir = NULL; 674 661 675 662 static void ecard_proc_init(void) 676 663 { 677 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 669 #define ec_set_resource(ec,nr,st,sz) \
+2 -14
arch/ia64/kernel/palinfo.c
··· 920 920 return 0; 921 921 } 922 922 923 - static int proc_palinfo_open(struct inode *inode, struct file *file) 924 - { 925 - return single_open(file, proc_palinfo_show, PDE_DATA(inode)); 926 - } 927 - 928 - static 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 - 935 923 static int palinfo_add_proc(unsigned int cpu) 936 924 { 937 925 pal_func_cpu_u_t f; ··· 936 948 937 949 for (j=0; j < NR_PALINFO_ENTRIES; j++) { 938 950 f.func_id = j; 939 - proc_create_data(palinfo_entries[j].name, 0, cpu_dir, 940 - &proc_palinfo_fops, (void *)f.value); 951 + proc_create_single_data(palinfo_entries[j].name, 0, cpu_dir, 952 + proc_palinfo_show, (void *)f.value); 941 953 } 942 954 return 0; 943 955 }
+14 -28
arch/ia64/kernel/salinfo.c
··· 54 54 MODULE_DESCRIPTION("/proc interface to IA-64 SAL features"); 55 55 MODULE_LICENSE("GPL"); 56 56 57 - static const struct file_operations proc_salinfo_fops; 58 - 59 57 typedef struct { 60 58 const char *name; /* name of the proc entry */ 61 59 unsigned long feature; /* feature bit */ ··· 576 578 return 0; 577 579 } 578 580 581 + /* 582 + * 'data' contains an integer that corresponds to the feature we're 583 + * testing 584 + */ 585 + static int proc_salinfo_show(struct seq_file *m, void *v) 586 + { 587 + unsigned long data = (unsigned long)v; 588 + seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n"); 589 + return 0; 590 + } 591 + 579 592 static int __init 580 593 salinfo_init(void) 581 594 { ··· 602 593 603 594 for (i=0; i < NR_SALINFO_ENTRIES; i++) { 604 595 /* pass the feature bit in question as misc data */ 605 - *sdir++ = proc_create_data(salinfo_entries[i].name, 0, salinfo_dir, 606 - &proc_salinfo_fops, 607 - (void *)salinfo_entries[i].feature); 596 + *sdir++ = proc_create_single_data(salinfo_entries[i].name, 0, 597 + salinfo_dir, proc_salinfo_show, 598 + (void *)salinfo_entries[i].feature); 608 599 } 609 600 610 601 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { ··· 641 632 WARN_ON(i < 0); 642 633 return 0; 643 634 } 644 - 645 - /* 646 - * 'data' contains an integer that corresponds to the feature we're 647 - * testing 648 - */ 649 - static int proc_salinfo_show(struct seq_file *m, void *v) 650 - { 651 - unsigned long data = (unsigned long)v; 652 - seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n"); 653 - return 0; 654 - } 655 - 656 - static int proc_salinfo_open(struct inode *inode, struct file *file) 657 - { 658 - return single_open(file, proc_salinfo_show, PDE_DATA(inode)); 659 - } 660 - 661 - static const struct file_operations proc_salinfo_fops = { 662 - .open = proc_salinfo_open, 663 - .read = seq_read, 664 - .llseek = seq_lseek, 665 - .release = single_release, 666 - }; 667 635 668 636 module_init(salinfo_init);
+4 -28
arch/ia64/sn/kernel/sn2/prominfo_proc.c
··· 140 140 return 0; 141 141 } 142 142 143 - static int proc_fit_open(struct inode *inode, struct file *file) 144 - { 145 - return single_open(file, proc_fit_show, PDE_DATA(inode)); 146 - } 147 - 148 - static 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 - 155 143 static int proc_version_show(struct seq_file *m, void *v) 156 144 { 157 145 unsigned long nasid = (unsigned long)m->private; ··· 161 173 seq_printf(m, "%s\n", banner); 162 174 return 0; 163 175 } 164 - 165 - static int proc_version_open(struct inode *inode, struct file *file) 166 - { 167 - return single_open(file, proc_version_show, PDE_DATA(inode)); 168 - } 169 - 170 - static const struct file_operations proc_version_fops = { 171 - .open = proc_version_open, 172 - .read = seq_read, 173 - .llseek = seq_lseek, 174 - .release = single_release, 175 - }; 176 176 177 177 /* module entry points */ 178 178 int __init prominfo_init(void); ··· 193 217 if (!dir) 194 218 continue; 195 219 nasid = cnodeid_to_nasid(cnodeid); 196 - proc_create_data("fit", 0, dir, 197 - &proc_fit_fops, (void *)nasid); 198 - proc_create_data("version", 0, dir, 199 - &proc_version_fops, (void *)nasid); 220 + proc_create_single_data("fit", 0, dir, proc_fit_show, 221 + (void *)nasid); 222 + proc_create_single_data("version", 0, dir, proc_version_show, 223 + (void *)nasid); 200 224 } 201 225 return 0; 202 226 }
+7 -55
arch/ia64/sn/kernel/sn2/sn_proc_fs.c
··· 18 18 return 0; 19 19 } 20 20 21 - static int partition_id_open(struct inode *inode, struct file *file) 22 - { 23 - return single_open(file, partition_id_show, NULL); 24 - } 25 - 26 21 static int system_serial_number_show(struct seq_file *s, void *p) 27 22 { 28 23 seq_printf(s, "%s\n", sn_system_serial_number()); 29 24 return 0; 30 25 } 31 26 32 - static int system_serial_number_open(struct inode *inode, struct file *file) 33 - { 34 - return single_open(file, system_serial_number_show, NULL); 35 - } 36 - 37 27 static int licenseID_show(struct seq_file *s, void *p) 38 28 { 39 29 seq_printf(s, "0x%llx\n", sn_partition_serial_number_val()); 40 30 return 0; 41 - } 42 - 43 - static int licenseID_open(struct inode *inode, struct file *file) 44 - { 45 - return single_open(file, licenseID_show, NULL); 46 31 } 47 32 48 33 static int coherence_id_show(struct seq_file *s, void *p) ··· 37 52 return 0; 38 53 } 39 54 40 - static int coherence_id_open(struct inode *inode, struct file *file) 41 - { 42 - return single_open(file, coherence_id_show, NULL); 43 - } 44 - 45 55 /* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ 46 56 extern int sn_topology_open(struct inode *, struct file *); 47 57 extern int sn_topology_release(struct inode *, struct file *); 48 - 49 - static const struct file_operations proc_partition_id_fops = { 50 - .open = partition_id_open, 51 - .read = seq_read, 52 - .llseek = seq_lseek, 53 - .release = single_release, 54 - }; 55 - 56 - static const struct file_operations proc_system_sn_fops = { 57 - .open = system_serial_number_open, 58 - .read = seq_read, 59 - .llseek = seq_lseek, 60 - .release = single_release, 61 - }; 62 - 63 - static const struct file_operations proc_license_id_fops = { 64 - .open = licenseID_open, 65 - .read = seq_read, 66 - .llseek = seq_lseek, 67 - .release = single_release, 68 - }; 69 - 70 - static const struct file_operations proc_coherence_id_fops = { 71 - .open = coherence_id_open, 72 - .read = seq_read, 73 - .llseek = seq_lseek, 74 - .release = single_release, 75 - }; 76 58 77 59 static const struct file_operations proc_sn_topo_fops = { 78 60 .open = sn_topology_open, ··· 56 104 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) 57 105 return; 58 106 59 - proc_create("partition_id", 0444, sgi_proc_dir, 60 - &proc_partition_id_fops); 61 - proc_create("system_serial_number", 0444, sgi_proc_dir, 62 - &proc_system_sn_fops); 63 - proc_create("licenseID", 0444, sgi_proc_dir, &proc_license_id_fops); 64 - proc_create("coherence_id", 0444, sgi_proc_dir, 65 - &proc_coherence_id_fops); 107 + proc_create_single("partition_id", 0444, sgi_proc_dir, 108 + partition_id_show); 109 + proc_create_single("system_serial_number", 0444, sgi_proc_dir, 110 + system_serial_number_show); 111 + proc_create_single("licenseID", 0444, sgi_proc_dir, licenseID_show); 112 + proc_create_single("coherence_id", 0444, sgi_proc_dir, 113 + coherence_id_show); 66 114 proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops); 67 115 } 68 116
+1 -13
arch/m68k/kernel/setup_mm.c
··· 527 527 return 0; 528 528 } 529 529 530 - static int hardware_proc_open(struct inode *inode, struct file *file) 531 - { 532 - return single_open(file, hardware_proc_show, NULL); 533 - } 534 - 535 - static 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 - 542 530 static 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 533 return 0; 546 534 } 547 535 module_init(proc_hardware_init);
+2 -26
arch/mips/pci/ops-pmcmsp.c
··· 83 83 return 0; 84 84 } 85 85 86 - static 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 - 91 - static 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 88 * FUNCTION: gen_pci_cfg_wr_show ··· 148 160 return 0; 149 161 } 150 162 151 - static int gen_pci_cfg_wr_open(struct inode *inode, struct file *file) 152 - { 153 - return single_open(file, gen_pci_cfg_wr_show, NULL); 154 - } 155 - 156 - static const struct file_operations gen_pci_cfg_wr_fops = { 157 - .open = gen_pci_cfg_wr_open, 158 - .read = seq_read, 159 - .llseek = seq_lseek, 160 - .release = single_release, 161 - }; 162 - 163 163 /***************************************************************************** 164 164 * 165 165 * FUNCTION: pci_proc_init ··· 164 188 ****************************************************************************/ 165 189 static void pci_proc_init(void) 166 190 { 167 - proc_create("pmc_msp_pci_rd_cnt", 0, NULL, &msp_pci_rd_cnt_fops); 168 - proc_create("pmc_msp_pci_cfg_wr", 0, NULL, &gen_pci_cfg_wr_fops); 191 + proc_create_single("pmc_msp_pci_rd_cnt", 0, NULL, show_msp_pci_counts); 192 + proc_create_single("pmc_msp_pci_cfg_wr", 0, NULL, gen_pci_cfg_wr_show); 169 193 } 170 194 #endif /* CONFIG_PROC_FS && PCI_COUNTERS */ 171 195
+2 -14
arch/mips/sibyte/common/bus_watcher.c
··· 142 142 return 0; 143 143 } 144 144 145 - static int bw_proc_open(struct inode *inode, struct file *file) 146 - { 147 - return single_open(file, bw_proc_show, PDE_DATA(inode)); 148 - } 149 - 150 - static 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 - 157 145 static void create_proc_decoder(struct bw_stats_struct *stats) 158 146 { 159 147 struct proc_dir_entry *ent; 160 148 161 - ent = proc_create_data("bus_watcher", S_IWUSR | S_IRUGO, NULL, 162 - &bw_proc_fops, stats); 149 + ent = proc_create_single_data("bus_watcher", S_IWUSR | S_IRUGO, NULL, 150 + bw_proc_show, stats); 163 151 if (!ent) { 164 152 printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n"); 165 153 return;
+2 -15
arch/parisc/kernel/pci-dma.c
··· 367 367 return 0; 368 368 } 369 369 370 - static int proc_pcxl_dma_open(struct inode *inode, struct file *file) 371 - { 372 - return single_open(file, proc_pcxl_dma_show, NULL); 373 - } 374 - 375 - static 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 - 383 370 static int __init 384 371 pcxl_dma_init(void) 385 372 { ··· 384 397 "pcxl_dma_init: Unable to create gsc /proc dir entry\n"); 385 398 else { 386 399 struct proc_dir_entry* ent; 387 - ent = proc_create("pcxl_dma", 0, proc_gsc_root, 388 - &proc_pcxl_dma_ops); 400 + ent = proc_create_single("pcxl_dma", 0, proc_gsc_root, 401 + proc_pcxl_dma_show); 389 402 if (!ent) 390 403 printk(KERN_WARNING 391 404 "pci-dma.c: Unable to create pcxl_dma /proc entry.\n");
+1 -13
arch/parisc/kernel/pdc_chassis.c
··· 266 266 return 0; 267 267 } 268 268 269 - static int pdc_chassis_warn_open(struct inode *inode, struct file *file) 270 - { 271 - return single_open(file, pdc_chassis_warn_show, NULL); 272 - } 273 - 274 - static 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 - 281 269 static int __init pdc_chassis_create_procfs(void) 282 270 { 283 271 unsigned long test; ··· 280 292 281 293 printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n", 282 294 PDC_CHASSIS_VER); 283 - proc_create("chassis", 0400, NULL, &pdc_chassis_warn_fops); 295 + proc_create_single("chassis", 0400, NULL, pdc_chassis_warn_show); 284 296 return 0; 285 297 } 286 298
+1 -13
arch/powerpc/kernel/eeh.c
··· 1775 1775 return 0; 1776 1776 } 1777 1777 1778 - static int proc_eeh_open(struct inode *inode, struct file *file) 1779 - { 1780 - return single_open(file, proc_eeh_show, NULL); 1781 - } 1782 - 1783 - static 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 1778 #ifdef CONFIG_DEBUG_FS 1791 1779 static int eeh_enable_dbgfs_set(void *data, u64 val) 1792 1780 { ··· 1816 1828 static int __init eeh_init_proc(void) 1817 1829 { 1818 1830 if (machine_is(pseries) || machine_is(powernv)) { 1819 - proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations); 1831 + proc_create_single("powerpc/eeh", 0, NULL, proc_eeh_show); 1820 1832 #ifdef CONFIG_DEBUG_FS 1821 1833 debugfs_create_file("eeh_enable", 0600, 1822 1834 powerpc_debugfs_root, NULL,
+4 -28
arch/powerpc/kernel/rtas-proc.c
··· 154 154 static int ppc_rtas_tone_volume_show(struct seq_file *m, void *v); 155 155 static int ppc_rtas_rmo_buf_show(struct seq_file *m, void *v); 156 156 157 - static int sensors_open(struct inode *inode, struct file *file) 158 - { 159 - return single_open(file, ppc_rtas_sensors_show, NULL); 160 - } 161 - 162 - static 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 - 169 157 static int poweron_open(struct inode *inode, struct file *file) 170 158 { 171 159 return single_open(file, ppc_rtas_poweron_show, NULL); ··· 219 231 .release = single_release, 220 232 }; 221 233 222 - static int rmo_buf_open(struct inode *inode, struct file *file) 223 - { 224 - return single_open(file, ppc_rtas_rmo_buf_show, NULL); 225 - } 226 - 227 - static const struct file_operations ppc_rtas_rmo_buf_ops = { 228 - .open = rmo_buf_open, 229 - .read = seq_read, 230 - .llseek = seq_lseek, 231 - .release = single_release, 232 - }; 233 - 234 234 static int ppc_rtas_find_all_sensors(void); 235 235 static void ppc_rtas_process_sensor(struct seq_file *m, 236 236 struct individual_sensor *s, int state, int error, const char *loc); ··· 243 267 &ppc_rtas_clock_operations); 244 268 proc_create("powerpc/rtas/poweron", 0644, NULL, 245 269 &ppc_rtas_poweron_operations); 246 - proc_create("powerpc/rtas/sensors", 0444, NULL, 247 - &ppc_rtas_sensors_operations); 270 + proc_create_single("powerpc/rtas/sensors", 0444, NULL, 271 + ppc_rtas_sensors_show); 248 272 proc_create("powerpc/rtas/frequency", 0644, NULL, 249 273 &ppc_rtas_tone_freq_operations); 250 274 proc_create("powerpc/rtas/volume", 0644, NULL, 251 275 &ppc_rtas_tone_volume_operations); 252 - proc_create("powerpc/rtas/rmo_buffer", 0400, NULL, 253 - &ppc_rtas_rmo_buf_ops); 276 + proc_create_single("powerpc/rtas/rmo_buffer", 0400, NULL, 277 + ppc_rtas_rmo_buf_show); 254 278 return 0; 255 279 } 256 280
+1 -13
arch/powerpc/platforms/cell/spufs/sched.c
··· 1095 1095 atomic_read(&nr_spu_contexts), 1096 1096 idr_get_cursor(&task_active_pid_ns(current)->idr) - 1); 1097 1097 return 0; 1098 - } 1099 - 1100 - static int spu_loadavg_open(struct inode *inode, struct file *file) 1101 - { 1102 - return single_open(file, show_spu_loadavg, NULL); 1103 - } 1104 - 1105 - static 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 1112 1100 int __init spu_sched_init(void) ··· 1123 1135 1124 1136 mod_timer(&spuloadavg_timer, 0); 1125 1137 1126 - entry = proc_create("spu_loadavg", 0, NULL, &spu_loadavg_fops); 1138 + entry = proc_create_single("spu_loadavg", 0, NULL, show_spu_loadavg); 1127 1139 if (!entry) 1128 1140 goto out_stop_kthread; 1129 1141
+1 -13
arch/s390/kernel/sysinfo.c
··· 294 294 return 0; 295 295 } 296 296 297 - static int sysinfo_open(struct inode *inode, struct file *file) 298 - { 299 - return single_open(file, sysinfo_show, NULL); 300 - } 301 - 302 - static const struct file_operations sysinfo_fops = { 303 - .open = sysinfo_open, 304 - .read = seq_read, 305 - .llseek = seq_lseek, 306 - .release = single_release, 307 - }; 308 - 309 297 static 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 300 return 0; 313 301 } 314 302 device_initcall(sysinfo_create_proc);
+1 -13
arch/sh/drivers/dma/dma-api.c
··· 339 339 return 0; 340 340 } 341 341 342 - static int dma_proc_open(struct inode *inode, struct file *file) 343 - { 344 - return single_open(file, dma_proc_show, NULL); 345 - } 346 - 347 - static 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 - 354 342 int register_dmac(struct dma_info *info) 355 343 { 356 344 unsigned int total_channels, i; ··· 411 423 static int __init dma_api_init(void) 412 424 { 413 425 printk(KERN_NOTICE "DMA: Registering DMA API.\n"); 414 - return proc_create("dma", 0, NULL, &dma_proc_fops) ? 0 : -ENOMEM; 426 + return proc_create_single("dma", 0, NULL, dma_proc_show) ? 0 : -ENOMEM; 415 427 } 416 428 subsys_initcall(dma_api_init); 417 429
+4 -15
arch/sparc/kernel/ioport.c
··· 678 678 679 679 return 0; 680 680 } 681 - 682 - static 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 - 687 - static 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 681 #endif /* CONFIG_PROC_FS */ 695 682 696 683 static void register_proc_sparc_ioport(void) 697 684 { 698 685 #ifdef CONFIG_PROC_FS 699 - proc_create_data("io_map", 0, NULL, &sparc_io_proc_fops, &sparc_iomap); 700 - proc_create_data("dvma_map", 0, NULL, &sparc_io_proc_fops, &_sparc_dvma); 686 + proc_create_single_data("io_map", 0, NULL, sparc_io_proc_show, 687 + &sparc_iomap); 688 + proc_create_single_data("dvma_map", 0, NULL, sparc_io_proc_show, 689 + &_sparc_dvma); 701 690 #endif 702 691 }
+2 -14
arch/um/drivers/ubd_kern.c
··· 208 208 return 0; 209 209 } 210 210 211 - static 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 - 216 - static 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 - 224 211 static void make_ide_entries(const char *dev_name) 225 212 { 226 213 struct proc_dir_entry *dir, *ent; ··· 218 231 dir = proc_mkdir(dev_name, proc_ide); 219 232 if(!dir) return; 220 233 221 - ent = proc_create("media", S_IRUGO, dir, &fake_ide_media_proc_fops); 234 + ent = proc_create_single("media", S_IRUGO, dir, 235 + fake_ide_media_proc_show); 222 236 if(!ent) return; 223 237 snprintf(name, sizeof(name), "ide0/%s", dev_name); 224 238 proc_symlink(dev_name, proc_ide_root, name);
+1 -14
arch/x86/kernel/apm_32.c
··· 1715 1715 return 0; 1716 1716 } 1717 1717 1718 - static int proc_apm_open(struct inode *inode, struct file *file) 1719 - { 1720 - return single_open(file, proc_apm_show, NULL); 1721 - } 1722 - 1723 - static 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 - 1731 1718 static int apm(void *unused) 1732 1719 { 1733 1720 unsigned short bx; ··· 2347 2360 set_desc_base(&gdt[APM_DS >> 3], 2348 2361 (unsigned long)__va((unsigned long)apm_info.bios.dseg << 4)); 2349 2362 2350 - proc_create("apm", 0, NULL, &apm_file_ops); 2363 + proc_create_single("apm", 0, NULL, proc_apm_show); 2351 2364 2352 2365 kapmd_task = kthread_create(apm, NULL, "kapmd"); 2353 2366 if (IS_ERR(kapmd_task)) {
+2 -19
drivers/acpi/ac.c
··· 82 82 #ifdef CONFIG_ACPI_PROCFS_POWER 83 83 extern struct proc_dir_entry *acpi_lock_ac_dir(void); 84 84 extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); 85 - static int acpi_ac_open_fs(struct inode *inode, struct file *file); 86 85 #endif 87 86 88 87 ··· 109 110 }; 110 111 111 112 #define to_acpi_ac(x) power_supply_get_drvdata(x) 112 - 113 - #ifdef CONFIG_ACPI_PROCFS_POWER 114 - static const struct file_operations acpi_ac_fops = { 115 - .owner = THIS_MODULE, 116 - .open = acpi_ac_open_fs, 117 - .read = seq_read, 118 - .llseek = seq_lseek, 119 - .release = single_release, 120 - }; 121 - #endif 122 113 123 114 /* -------------------------------------------------------------------------- 124 115 AC Adapter Management ··· 198 209 return 0; 199 210 } 200 211 201 - static int acpi_ac_open_fs(struct inode *inode, struct file *file) 202 - { 203 - return single_open(file, acpi_ac_seq_show, PDE_DATA(inode)); 204 - } 205 - 206 212 static int acpi_ac_add_fs(struct acpi_ac *ac) 207 213 { 208 214 struct proc_dir_entry *entry = NULL; ··· 212 228 } 213 229 214 230 /* 'state' [R] */ 215 - entry = proc_create_data(ACPI_AC_FILE_STATE, 216 - S_IRUGO, acpi_device_dir(ac->device), 217 - &acpi_ac_fops, ac); 231 + entry = proc_create_single_data(ACPI_AC_FILE_STATE, S_IRUGO, 232 + acpi_device_dir(ac->device), acpi_ac_seq_show, ac); 218 233 if (!entry) 219 234 return -ENODEV; 220 235 return 0;
+3 -16
drivers/acpi/button.c
··· 263 263 return 0; 264 264 } 265 265 266 - static 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 - 271 - static 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 - 279 266 static int acpi_button_add_fs(struct acpi_device *device) 280 267 { 281 268 struct acpi_button *button = acpi_driver_data(device); ··· 298 311 } 299 312 300 313 /* create /proc/acpi/button/lid/LID/state */ 301 - entry = proc_create_data(ACPI_BUTTON_FILE_STATE, 302 - S_IRUGO, acpi_device_dir(device), 303 - &acpi_button_state_fops, device); 314 + entry = proc_create_single_data(ACPI_BUTTON_FILE_STATE, S_IRUGO, 315 + acpi_device_dir(device), acpi_button_state_seq_show, 316 + device); 304 317 if (!entry) { 305 318 ret = -ENODEV; 306 319 goto remove_dev_dir;
+6 -43
drivers/block/DAC960.c
··· 6451 6451 return 0; 6452 6452 } 6453 6453 6454 - static int dac960_proc_open(struct inode *inode, struct file *file) 6455 - { 6456 - return single_open(file, dac960_proc_show, NULL); 6457 - } 6458 - 6459 - static 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 - 6467 6454 static int dac960_initial_status_proc_show(struct seq_file *m, void *v) 6468 6455 { 6469 6456 DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private; 6470 6457 seq_printf(m, "%.*s", Controller->InitialStatusLength, Controller->CombinedStatusBuffer); 6471 6458 return 0; 6472 6459 } 6473 - 6474 - static 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 - 6479 - static 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 6460 6487 6461 static int dac960_current_status_proc_show(struct seq_file *m, void *v) 6488 6462 { ··· 6490 6516 seq_printf(m, "%.*s", Controller->CurrentStatusLength, Controller->CurrentStatusBuffer); 6491 6517 return 0; 6492 6518 } 6493 - 6494 - static int dac960_current_status_proc_open(struct inode *inode, struct file *file) 6495 - { 6496 - return single_open(file, dac960_current_status_proc_show, PDE_DATA(inode)); 6497 - } 6498 - 6499 - static const struct file_operations dac960_current_status_proc_fops = { 6500 - .owner = THIS_MODULE, 6501 - .open = dac960_current_status_proc_open, 6502 - .read = seq_read, 6503 - .llseek = seq_lseek, 6504 - .release = single_release, 6505 - }; 6506 6519 6507 6520 static int dac960_user_command_proc_show(struct seq_file *m, void *v) 6508 6521 { ··· 6545 6584 6546 6585 if (DAC960_ProcDirectoryEntry == NULL) { 6547 6586 DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL); 6548 - proc_create("status", 0, DAC960_ProcDirectoryEntry, 6549 - &dac960_proc_fops); 6587 + proc_create_single("status", 0, DAC960_ProcDirectoryEntry, 6588 + dac960_proc_show); 6550 6589 } 6551 6590 6552 6591 snprintf(Controller->ControllerName, sizeof(Controller->ControllerName), 6553 6592 "c%d", Controller->ControllerNumber); 6554 6593 ControllerProcEntry = proc_mkdir(Controller->ControllerName, 6555 6594 DAC960_ProcDirectoryEntry); 6556 - proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller); 6557 - proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller); 6595 + proc_create_single_data("initial_status", 0, ControllerProcEntry, 6596 + dac960_initial_status_proc_show, Controller); 6597 + proc_create_single_data("current_status", 0, ControllerProcEntry, 6598 + dac960_current_status_proc_show, Controller); 6558 6599 proc_create_data("user_command", S_IWUSR | S_IRUSR, ControllerProcEntry, &dac960_user_command_proc_fops, Controller); 6559 6600 Controller->ControllerProcEntry = ControllerProcEntry; 6560 6601 }
+1 -13
drivers/block/pktcdvd.c
··· 2538 2538 return 0; 2539 2539 } 2540 2540 2541 - static int pkt_seq_open(struct inode *inode, struct file *file) 2542 - { 2543 - return single_open(file, pkt_seq_show, PDE_DATA(inode)); 2544 - } 2545 - 2546 - static 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 - 2553 2541 static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) 2554 2542 { 2555 2543 int i; ··· 2592 2604 goto out_mem; 2593 2605 } 2594 2606 2595 - proc_create_data(pd->name, 0, pkt_proc, &pkt_proc_fops, pd); 2607 + proc_create_single_data(pd->name, 0, pkt_proc, pkt_seq_show, pd); 2596 2608 pkt_dbg(1, pd, "writer mapped to %s\n", bdevname(bdev, b)); 2597 2609 return 0; 2598 2610
+2 -15
drivers/block/ps3vram.c
··· 521 521 return 0; 522 522 } 523 523 524 - static int ps3vram_proc_open(struct inode *inode, struct file *file) 525 - { 526 - return single_open(file, ps3vram_proc_show, PDE_DATA(inode)); 527 - } 528 - 529 - static 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 - 537 524 static void ps3vram_proc_init(struct ps3_system_bus_device *dev) 538 525 { 539 526 struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev); 540 527 struct proc_dir_entry *pde; 541 528 542 - pde = proc_create_data(DEVICE_NAME, 0444, NULL, &ps3vram_proc_fops, 543 - priv); 529 + pde = proc_create_single_data(DEVICE_NAME, 0444, NULL, 530 + ps3vram_proc_show, priv); 544 531 if (!pde) 545 532 dev_warn(&dev->core, "failed to create /proc entry\n"); 546 533 }
+1 -14
drivers/char/apm-emulation.c
··· 461 461 462 462 return 0; 463 463 } 464 - 465 - static int proc_apm_open(struct inode *inode, struct file *file) 466 - { 467 - return single_open(file, proc_apm_show, NULL); 468 - } 469 - 470 - static 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 464 #endif 478 465 479 466 static int kapmd(void *arg) ··· 644 657 wake_up_process(kapmd_tsk); 645 658 646 659 #ifdef CONFIG_PROC_FS 647 - proc_create("apm", 0, NULL, &apm_proc_fops); 660 + proc_create_single("apm", 0, NULL, proc_apm_show); 648 661 #endif 649 662 650 663 ret = misc_register(&apm_device);
+1 -13
drivers/char/ds1620.c
··· 345 345 fan_state[netwinder_get_fan()]); 346 346 return 0; 347 347 } 348 - 349 - static int ds1620_proc_therm_open(struct inode *inode, struct file *file) 350 - { 351 - return single_open(file, ds1620_proc_therm_show, NULL); 352 - } 353 - 354 - static 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 348 #endif 361 349 362 350 static const struct file_operations ds1620_fops = { ··· 392 404 return ret; 393 405 394 406 #ifdef THERM_USE_PROC 395 - if (!proc_create("therm", 0, NULL, &ds1620_proc_therm_fops)) 407 + if (!proc_create_single("therm", 0, NULL, ds1620_proc_therm_show)) 396 408 printk(KERN_ERR "therm: unable to register /proc/therm\n"); 397 409 #endif 398 410
+1 -14
drivers/char/efirtc.c
··· 358 358 359 359 return 0; 360 360 } 361 - 362 - static int efi_rtc_proc_open(struct inode *inode, struct file *file) 363 - { 364 - return single_open(file, efi_rtc_proc_show, NULL); 365 - } 366 - 367 - static 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 - 374 361 static int __init 375 362 efi_rtc_init(void) 376 363 { ··· 373 386 return ret; 374 387 } 375 388 376 - dir = proc_create("driver/efirtc", 0, NULL, &efi_rtc_proc_fops); 389 + dir = proc_create_single("driver/efirtc", 0, NULL, efi_rtc_proc_show); 377 390 if (dir == NULL) { 378 391 printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n"); 379 392 misc_deregister(&efi_rtc_dev);
+1 -14
drivers/char/nvram.c
··· 389 389 return 0; 390 390 } 391 391 392 - static int nvram_proc_open(struct inode *inode, struct file *file) 393 - { 394 - return single_open(file, nvram_proc_read, NULL); 395 - } 396 - 397 - static 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 - 405 392 static 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 395 return -ENOMEM; 409 396 return 0; 410 397 }
+2 -17
drivers/char/rtc.c
··· 171 171 #endif 172 172 173 173 #ifdef CONFIG_PROC_FS 174 - static int rtc_proc_open(struct inode *inode, struct file *file); 174 + static int rtc_proc_show(struct seq_file *seq, void *v); 175 175 #endif 176 176 177 177 /* ··· 832 832 .fops = &rtc_fops, 833 833 }; 834 834 835 - #ifdef CONFIG_PROC_FS 836 - static 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 - 845 835 static resource_size_t rtc_size; 846 836 847 837 static struct resource * __init rtc_request_region(resource_size_t size) ··· 972 982 } 973 983 974 984 #ifdef CONFIG_PROC_FS 975 - ent = proc_create("driver/rtc", 0, NULL, &rtc_proc_fops); 985 + ent = proc_create_single("driver/rtc", 0, NULL, rtc_proc_show); 976 986 if (!ent) 977 987 printk(KERN_WARNING "rtc: Failed to register with procfs.\n"); 978 988 #endif ··· 1190 1200 return 0; 1191 1201 #undef YN 1192 1202 #undef NY 1193 - } 1194 - 1195 - static int rtc_proc_open(struct inode *inode, struct file *file) 1196 - { 1197 - return single_open(file, rtc_proc_show, NULL); 1198 1203 } 1199 1204 #endif 1200 1205
+1 -14
drivers/char/toshiba.c
··· 326 326 key); 327 327 return 0; 328 328 } 329 - 330 - static int proc_toshiba_open(struct inode *inode, struct file *file) 331 - { 332 - return single_open(file, proc_toshiba_show, NULL); 333 - } 334 - 335 - static 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 329 #endif 343 330 344 331 ··· 511 524 { 512 525 struct proc_dir_entry *pde; 513 526 514 - pde = proc_create("toshiba", 0, NULL, &proc_toshiba_fops); 527 + pde = proc_create_single("toshiba", 0, NULL, proc_toshiba_show); 515 528 if (!pde) { 516 529 misc_deregister(&tosh_device); 517 530 return -ENOMEM;
+1 -14
drivers/connector/connector.c
··· 260 260 return 0; 261 261 } 262 262 263 - static int cn_proc_open(struct inode *inode, struct file *file) 264 - { 265 - return single_open(file, cn_proc_show, NULL); 266 - } 267 - 268 - static 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 - 276 263 static struct cn_dev cdev = { 277 264 .input = cn_rx_skb, 278 265 }; ··· 284 297 285 298 cn_already_initialized = 1; 286 299 287 - proc_create("connector", S_IRUGO, init_net.proc_net, &cn_file_ops); 300 + proc_create_single("connector", S_IRUGO, init_net.proc_net, cn_proc_show); 288 301 289 302 return 0; 290 303 }
+1 -13
drivers/input/misc/hp_sdc_rtc.c
··· 509 509 #undef NY 510 510 } 511 511 512 - static 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 - 517 - static 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 - 524 512 static int hp_sdc_rtc_ioctl(struct file *file, 525 513 unsigned int cmd, unsigned long arg) 526 514 { ··· 701 713 if (misc_register(&hp_sdc_rtc_dev) != 0) 702 714 printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n"); 703 715 704 - proc_create("driver/rtc", 0, NULL, &hp_sdc_rtc_proc_fops); 716 + proc_create_single("driver/rtc", 0, NULL, hp_sdc_rtc_proc_show); 705 717 706 718 printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded " 707 719 "(RTC v " RTC_VERSION ")\n");
+2 -28
drivers/isdn/capi/capi.c
··· 1340 1340 return 0; 1341 1341 } 1342 1342 1343 - static int capi20_proc_open(struct inode *inode, struct file *file) 1344 - { 1345 - return single_open(file, capi20_proc_show, NULL); 1346 - } 1347 - 1348 - static 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 1344 * /proc/capi/capi20ncci: 1358 1345 * applid ncci ··· 1360 1373 return 0; 1361 1374 } 1362 1375 1363 - static int capi20ncci_proc_open(struct inode *inode, struct file *file) 1364 - { 1365 - return single_open(file, capi20ncci_proc_show, NULL); 1366 - } 1367 - 1368 - static const struct file_operations capi20ncci_proc_fops = { 1369 - .owner = THIS_MODULE, 1370 - .open = capi20ncci_proc_open, 1371 - .read = seq_read, 1372 - .llseek = seq_lseek, 1373 - .release = single_release, 1374 - }; 1375 - 1376 1376 static void __init proc_init(void) 1377 1377 { 1378 - proc_create("capi/capi20", 0, NULL, &capi20_proc_fops); 1379 - proc_create("capi/capi20ncci", 0, NULL, &capi20ncci_proc_fops); 1378 + proc_create_single("capi/capi20", 0, NULL, capi20_proc_show); 1379 + proc_create_single("capi/capi20ncci", 0, NULL, capi20ncci_proc_show); 1380 1380 } 1381 1381 1382 1382 static void __exit proc_exit(void)
+1 -14
drivers/isdn/capi/capidrv.c
··· 2460 2460 return 0; 2461 2461 } 2462 2462 2463 - static int capidrv_proc_open(struct inode *inode, struct file *file) 2464 - { 2465 - return single_open(file, capidrv_proc_show, NULL); 2466 - } 2467 - 2468 - static 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 - 2476 2463 static 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 2481 2468 static void __exit proc_exit(void)
+2 -15
drivers/isdn/hardware/eicon/diva_didd.c
··· 78 78 return 0; 79 79 } 80 80 81 - static int divadidd_proc_open(struct inode *inode, struct file *file) 82 - { 83 - return single_open(file, divadidd_proc_show, NULL); 84 - } 85 - 86 - static 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 - 94 81 static int __init create_proc(void) 95 82 { 96 83 proc_net_eicon = proc_mkdir("eicon", init_net.proc_net); 97 84 98 85 if (proc_net_eicon) { 99 - proc_didd = proc_create(DRIVERLNAME, S_IRUGO, proc_net_eicon, 100 - &divadidd_proc_fops); 86 + proc_didd = proc_create_single(DRIVERLNAME, S_IRUGO, 87 + proc_net_eicon, divadidd_proc_show); 101 88 return (1); 102 89 } 103 90 return (0);
+2 -15
drivers/isdn/hardware/eicon/divasi.c
··· 101 101 return 0; 102 102 } 103 103 104 - static int um_idi_proc_open(struct inode *inode, struct file *file) 105 - { 106 - return single_open(file, um_idi_proc_show, NULL); 107 - } 108 - 109 - static 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 - 117 104 static int __init create_um_idi_proc(void) 118 105 { 119 - um_idi_proc_entry = proc_create(DRIVERLNAME, S_IRUGO, proc_net_eicon, 120 - &um_idi_proc_fops); 106 + um_idi_proc_entry = proc_create_single(DRIVERLNAME, S_IRUGO, 107 + proc_net_eicon, um_idi_proc_show); 121 108 if (!um_idi_proc_entry) 122 109 return (0); 123 110 return (1);
+10 -47
drivers/macintosh/via-pmu.c
··· 191 191 static void pmu_start(void); 192 192 static irqreturn_t via_pmu_interrupt(int irq, void *arg); 193 193 static irqreturn_t gpio1_interrupt(int irq, void *arg); 194 - static const struct file_operations pmu_info_proc_fops; 195 - static const struct file_operations pmu_irqstats_proc_fops; 194 + static int pmu_info_proc_show(struct seq_file *m, void *v); 195 + static int pmu_irqstats_proc_show(struct seq_file *m, void *v); 196 + static int pmu_battery_proc_show(struct seq_file *m, void *v); 196 197 static void pmu_pass_intr(unsigned char *data, int len); 197 - static const struct file_operations pmu_battery_proc_fops; 198 198 static const struct file_operations pmu_options_proc_fops; 199 199 200 200 #ifdef CONFIG_ADB ··· 511 511 for (i=0; i<pmu_battery_count; i++) { 512 512 char title[16]; 513 513 sprintf(title, "battery_%ld", i); 514 - proc_pmu_batt[i] = proc_create_data(title, 0, proc_pmu_root, 515 - &pmu_battery_proc_fops, (void *)i); 514 + proc_pmu_batt[i] = proc_create_single_data(title, 0, 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_irqstats = proc_create("interrupts", 0, proc_pmu_root, 520 - &pmu_irqstats_proc_fops); 519 + proc_pmu_info = proc_create_single("info", 0, proc_pmu_root, 520 + pmu_info_proc_show); 521 + proc_pmu_irqstats = proc_create_single("interrupts", 0, 522 + proc_pmu_root, pmu_irqstats_proc_show); 521 523 proc_pmu_options = proc_create("options", 0600, proc_pmu_root, 522 524 &pmu_options_proc_fops); 523 525 } ··· 813 811 return 0; 814 812 } 815 813 816 - static int pmu_info_proc_open(struct inode *inode, struct file *file) 817 - { 818 - return single_open(file, pmu_info_proc_show, NULL); 819 - } 820 - 821 - static const struct file_operations pmu_info_proc_fops = { 822 - .owner = THIS_MODULE, 823 - .open = pmu_info_proc_open, 824 - .read = seq_read, 825 - .llseek = seq_lseek, 826 - .release = single_release, 827 - }; 828 - 829 814 static int pmu_irqstats_proc_show(struct seq_file *m, void *v) 830 815 { 831 816 int i; ··· 837 848 return 0; 838 849 } 839 850 840 - static int pmu_irqstats_proc_open(struct inode *inode, struct file *file) 841 - { 842 - return single_open(file, pmu_irqstats_proc_show, NULL); 843 - } 844 - 845 - static const struct file_operations pmu_irqstats_proc_fops = { 846 - .owner = THIS_MODULE, 847 - .open = pmu_irqstats_proc_open, 848 - .read = seq_read, 849 - .llseek = seq_lseek, 850 - .release = single_release, 851 - }; 852 - 853 851 static int pmu_battery_proc_show(struct seq_file *m, void *v) 854 852 { 855 853 long batnum = (long)m->private; ··· 850 874 seq_printf(m, "time rem. : %d\n", pmu_batteries[batnum].time_remaining); 851 875 return 0; 852 876 } 853 - 854 - static int pmu_battery_proc_open(struct inode *inode, struct file *file) 855 - { 856 - return single_open(file, pmu_battery_proc_show, PDE_DATA(inode)); 857 - } 858 - 859 - static const struct file_operations pmu_battery_proc_fops = { 860 - .owner = THIS_MODULE, 861 - .open = pmu_battery_proc_open, 862 - .read = seq_read, 863 - .llseek = seq_lseek, 864 - .release = single_release, 865 - }; 866 877 867 878 static int pmu_options_proc_show(struct seq_file *m, void *v) 868 879 {
+1 -13
drivers/media/pci/saa7164/saa7164-core.c
··· 1122 1122 return 0; 1123 1123 } 1124 1124 1125 - static int saa7164_proc_open(struct inode *inode, struct file *filp) 1126 - { 1127 - return single_open(filp, saa7164_proc_show, NULL); 1128 - } 1129 - 1130 - static 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 - 1137 1125 static int saa7164_proc_create(void) 1138 1126 { 1139 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 1130 if (!pe) 1143 1131 return -ENOMEM; 1144 1132
+2 -14
drivers/media/pci/zoran/videocodec.c
··· 344 344 345 345 return 0; 346 346 } 347 - 348 - static int proc_videocodecs_open(struct inode *inode, struct file *file) 349 - { 350 - return single_open(file, proc_videocodecs_show, NULL); 351 - } 352 - 353 - static 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 347 #endif 361 348 362 349 /* ===================== */ ··· 360 373 VIDEOCODEC_VERSION); 361 374 362 375 #ifdef CONFIG_PROC_FS 363 - videocodec_proc_entry = proc_create("videocodecs", 0, NULL, &videocodecs_proc_fops); 376 + videocodec_proc_entry = proc_create_single("videocodecs", 0, NULL, 377 + proc_videocodecs_show); 364 378 if (!videocodec_proc_entry) { 365 379 dprintk(1, KERN_ERR "videocodec: can't init procfs.\n"); 366 380 }
+11 -46
drivers/message/fusion/mptbase.c
··· 197 197 static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init); 198 198 199 199 #ifdef CONFIG_PROC_FS 200 - static const struct file_operations mpt_summary_proc_fops; 201 - static const struct file_operations mpt_version_proc_fops; 202 - static const struct file_operations mpt_iocinfo_proc_fops; 200 + static int mpt_summary_proc_show(struct seq_file *m, void *v); 201 + static int mpt_version_proc_show(struct seq_file *m, void *v); 202 + static int mpt_iocinfo_proc_show(struct seq_file *m, void *v); 203 203 #endif 204 204 static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); 205 205 ··· 2040 2040 */ 2041 2041 dent = proc_mkdir(ioc->name, mpt_proc_root_dir); 2042 2042 if (dent) { 2043 - proc_create_data("info", S_IRUGO, dent, &mpt_iocinfo_proc_fops, ioc); 2044 - proc_create_data("summary", S_IRUGO, dent, &mpt_summary_proc_fops, ioc); 2043 + proc_create_single_data("info", S_IRUGO, dent, 2044 + mpt_iocinfo_proc_show, ioc); 2045 + proc_create_single_data("summary", S_IRUGO, dent, 2046 + mpt_summary_proc_show, ioc); 2045 2047 } 2046 2048 #endif 2047 2049 ··· 6608 6606 if (mpt_proc_root_dir == NULL) 6609 6607 return -ENOTDIR; 6610 6608 6611 - proc_create("summary", S_IRUGO, mpt_proc_root_dir, &mpt_summary_proc_fops); 6612 - proc_create("version", S_IRUGO, mpt_proc_root_dir, &mpt_version_proc_fops); 6609 + proc_create_single("summary", S_IRUGO, mpt_proc_root_dir, 6610 + mpt_summary_proc_show); 6611 + proc_create_single("version", S_IRUGO, mpt_proc_root_dir, 6612 + mpt_version_proc_show); 6613 6613 return 0; 6614 6614 } 6615 6615 ··· 6649 6645 6650 6646 return 0; 6651 6647 } 6652 - 6653 - static int mpt_summary_proc_open(struct inode *inode, struct file *file) 6654 - { 6655 - return single_open(file, mpt_summary_proc_show, PDE_DATA(inode)); 6656 - } 6657 - 6658 - static const struct file_operations mpt_summary_proc_fops = { 6659 - .owner = THIS_MODULE, 6660 - .open = mpt_summary_proc_open, 6661 - .read = seq_read, 6662 - .llseek = seq_lseek, 6663 - .release = single_release, 6664 - }; 6665 6648 6666 6649 static int mpt_version_proc_show(struct seq_file *m, void *v) 6667 6650 { ··· 6691 6700 6692 6701 return 0; 6693 6702 } 6694 - 6695 - static int mpt_version_proc_open(struct inode *inode, struct file *file) 6696 - { 6697 - return single_open(file, mpt_version_proc_show, NULL); 6698 - } 6699 - 6700 - static const struct file_operations mpt_version_proc_fops = { 6701 - .owner = THIS_MODULE, 6702 - .open = mpt_version_proc_open, 6703 - .read = seq_read, 6704 - .llseek = seq_lseek, 6705 - .release = single_release, 6706 - }; 6707 6703 6708 6704 static int mpt_iocinfo_proc_show(struct seq_file *m, void *v) 6709 6705 { ··· 6771 6793 6772 6794 return 0; 6773 6795 } 6774 - 6775 - static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file) 6776 - { 6777 - return single_open(file, mpt_iocinfo_proc_show, PDE_DATA(inode)); 6778 - } 6779 - 6780 - static const struct file_operations mpt_iocinfo_proc_fops = { 6781 - .owner = THIS_MODULE, 6782 - .open = mpt_iocinfo_proc_open, 6783 - .read = seq_read, 6784 - .llseek = seq_lseek, 6785 - .release = single_release, 6786 - }; 6787 6796 #endif /* CONFIG_PROC_FS } */ 6788 6797 6789 6798 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+1 -13
drivers/mtd/mtdcore.c
··· 1829 1829 mutex_unlock(&mtd_table_mutex); 1830 1830 return 0; 1831 1831 } 1832 - 1833 - static int mtd_proc_open(struct inode *inode, struct file *file) 1834 - { 1835 - return single_open(file, mtd_proc_show, NULL); 1836 - } 1837 - 1838 - static 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 1832 #endif /* CONFIG_PROC_FS */ 1845 1833 1846 1834 /*====================================================================*/ ··· 1871 1883 goto err_bdi; 1872 1884 } 1873 1885 1874 - proc_mtd = proc_create("mtd", 0, NULL, &mtd_proc_ops); 1886 + proc_mtd = proc_create_single("mtd", 0, NULL, mtd_proc_show); 1875 1887 1876 1888 ret = init_mtdchar(); 1877 1889 if (ret)
+2 -13
drivers/net/wireless/atmel/atmel.c
··· 1482 1482 return 0; 1483 1483 } 1484 1484 1485 - static int atmel_proc_open(struct inode *inode, struct file *file) 1486 - { 1487 - return single_open(file, atmel_proc_show, PDE_DATA(inode)); 1488 - } 1489 - 1490 - static 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 - 1497 1485 static const struct net_device_ops atmel_netdev_ops = { 1498 1486 .ndo_open = atmel_open, 1499 1487 .ndo_stop = atmel_close, ··· 1602 1614 1603 1615 netif_carrier_off(dev); 1604 1616 1605 - if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)) 1617 + if (!proc_create_single_data("driver/atmel", 0, NULL, atmel_proc_show, 1618 + priv)) 1606 1619 printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); 1607 1620 1608 1621 printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n",
+2 -14
drivers/net/wireless/intersil/hostap/hostap_ap.c
··· 1106 1106 return 0; 1107 1107 } 1108 1108 1109 - static 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 - 1114 - static 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 - 1121 1109 static void handle_add_proc_queue(struct work_struct *work) 1122 1110 { 1123 1111 struct ap_data *ap = container_of(work, struct ap_data, ··· 1126 1138 1127 1139 if (sta) { 1128 1140 sprintf(name, "%pM", sta->addr); 1129 - sta->proc = proc_create_data( 1141 + sta->proc = proc_create_single_data( 1130 1142 name, 0, ap->proc, 1131 - &prism2_sta_proc_fops, sta); 1143 + prism2_sta_proc_show, sta); 1132 1144 1133 1145 atomic_dec(&sta->users); 1134 1146 }
+1 -14
drivers/net/wireless/ray_cs.c
··· 2663 2663 } 2664 2664 return 0; 2665 2665 } 2666 - 2667 - static int ray_cs_proc_open(struct inode *inode, struct file *file) 2668 - { 2669 - return single_open(file, ray_cs_proc_show, NULL); 2670 - } 2671 - 2672 - static 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 2666 #endif 2680 2667 /*===========================================================================*/ 2681 2668 static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) ··· 2801 2814 #ifdef CONFIG_PROC_FS 2802 2815 proc_mkdir("driver/ray_cs", NULL); 2803 2816 2804 - proc_create("driver/ray_cs/ray_cs", 0, NULL, &ray_cs_proc_fops); 2817 + proc_create_single("driver/ray_cs/ray_cs", 0, NULL, ray_cs_proc_show); 2805 2818 proc_create("driver/ray_cs/essid", 0200, NULL, &ray_cs_essid_proc_fops); 2806 2819 proc_create_data("driver/ray_cs/net_type", 0200, NULL, &int_proc_fops, 2807 2820 &net_type);
+8 -43
drivers/nubus/proc.c
··· 45 45 return 0; 46 46 } 47 47 48 - static int nubus_devices_proc_open(struct inode *inode, struct file *file) 49 - { 50 - return single_open(file, nubus_devices_proc_show, NULL); 51 - } 52 - 53 - static 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 - 60 48 static struct proc_dir_entry *proc_bus_nubus_dir; 61 49 62 50 /* ··· 137 149 return 0; 138 150 } 139 151 140 - static int nubus_proc_rsrc_open(struct inode *inode, struct file *file) 141 - { 142 - return single_open(file, nubus_proc_rsrc_show, inode); 143 - } 144 - 145 - static const struct file_operations nubus_proc_rsrc_fops = { 146 - .open = nubus_proc_rsrc_open, 147 - .read = seq_read, 148 - .llseek = seq_lseek, 149 - .release = single_release, 150 - }; 151 - 152 152 void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir, 153 153 const struct nubus_dirent *ent, 154 154 unsigned int size) ··· 152 176 pde_data = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size); 153 177 else 154 178 pde_data = NULL; 155 - proc_create_data(name, S_IFREG | 0444, procdir, 156 - &nubus_proc_rsrc_fops, pde_data); 179 + proc_create_single_data(name, S_IFREG | 0444, procdir, 180 + nubus_proc_rsrc_show, pde_data); 157 181 } 158 182 159 183 void nubus_proc_add_rsrc(struct proc_dir_entry *procdir, ··· 166 190 return; 167 191 168 192 snprintf(name, sizeof(name), "%x", ent->type); 169 - proc_create_data(name, S_IFREG | 0444, procdir, 170 - &nubus_proc_rsrc_fops, 171 - nubus_proc_alloc_pde_data(data, 0)); 193 + proc_create_single_data(name, S_IFREG | 0444, procdir, 194 + nubus_proc_rsrc_show, 195 + nubus_proc_alloc_pde_data(data, 0)); 172 196 } 173 197 174 198 /* 175 199 * /proc/nubus stuff 176 200 */ 177 201 178 - static int nubus_proc_open(struct inode *inode, struct file *file) 179 - { 180 - return single_open(file, nubus_proc_show, NULL); 181 - } 182 - 183 - static const struct file_operations nubus_proc_fops = { 184 - .open = nubus_proc_open, 185 - .read = seq_read, 186 - .llseek = seq_lseek, 187 - .release = single_release, 188 - }; 189 - 190 202 void __init nubus_proc_init(void) 191 203 { 192 - proc_create("nubus", 0, NULL, &nubus_proc_fops); 204 + proc_create_single("nubus", 0, NULL, nubus_proc_show); 193 205 proc_bus_nubus_dir = proc_mkdir("bus/nubus", NULL); 194 206 if (!proc_bus_nubus_dir) 195 207 return; 196 - proc_create("devices", 0, proc_bus_nubus_dir, &nubus_devices_proc_fops); 208 + proc_create_single("devices", 0, proc_bus_nubus_dir, 209 + nubus_devices_proc_show); 197 210 }
+4 -30
drivers/parisc/ccio-dma.c
··· 1108 1108 return 0; 1109 1109 } 1110 1110 1111 - static int ccio_proc_info_open(struct inode *inode, struct file *file) 1112 - { 1113 - return single_open(file, &ccio_proc_info, NULL); 1114 - } 1115 - 1116 - static 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 - 1124 1111 static int ccio_proc_bitmap_info(struct seq_file *m, void *p) 1125 1112 { 1126 1113 struct ioc *ioc = ioc_list; ··· 1122 1135 1123 1136 return 0; 1124 1137 } 1125 - 1126 - static int ccio_proc_bitmap_open(struct inode *inode, struct file *file) 1127 - { 1128 - return single_open(file, &ccio_proc_bitmap_info, NULL); 1129 - } 1130 - 1131 - static const struct file_operations ccio_proc_bitmap_fops = { 1132 - .owner = THIS_MODULE, 1133 - .open = ccio_proc_bitmap_open, 1134 - .read = seq_read, 1135 - .llseek = seq_lseek, 1136 - .release = single_release, 1137 - }; 1138 1138 #endif /* CONFIG_PROC_FS */ 1139 1139 1140 1140 /** ··· 1563 1589 1564 1590 #ifdef CONFIG_PROC_FS 1565 1591 if (ioc_count == 0) { 1566 - proc_create(MODULE_NAME, 0, proc_runway_root, 1567 - &ccio_proc_info_fops); 1568 - proc_create(MODULE_NAME"-bitmap", 0, proc_runway_root, 1569 - &ccio_proc_bitmap_fops); 1592 + proc_create_single(MODULE_NAME, 0, proc_runway_root, 1593 + ccio_proc_info); 1594 + proc_create_single(MODULE_NAME"-bitmap", 0, proc_runway_root, 1595 + ccio_proc_bitmap_info); 1570 1596 } 1571 1597 #endif 1572 1598 ioc_count++;
+2 -30
drivers/parisc/sba_iommu.c
··· 1864 1864 } 1865 1865 1866 1866 static int 1867 - sba_proc_open(struct inode *i, struct file *f) 1868 - { 1869 - return single_open(f, &sba_proc_info, NULL); 1870 - } 1871 - 1872 - static 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 - 1880 - static int 1881 1867 sba_proc_bitmap_info(struct seq_file *m, void *p) 1882 1868 { 1883 1869 struct sba_device *sba_dev = sba_list; ··· 1875 1889 1876 1890 return 0; 1877 1891 } 1878 - 1879 - static int 1880 - sba_proc_bitmap_open(struct inode *i, struct file *f) 1881 - { 1882 - return single_open(f, &sba_proc_bitmap_info, NULL); 1883 - } 1884 - 1885 - static const struct file_operations sba_proc_bitmap_fops = { 1886 - .owner = THIS_MODULE, 1887 - .open = sba_proc_bitmap_open, 1888 - .read = seq_read, 1889 - .llseek = seq_lseek, 1890 - .release = single_release, 1891 - }; 1892 1892 #endif /* CONFIG_PROC_FS */ 1893 1893 1894 1894 static const struct parisc_device_id sba_tbl[] __initconst = { ··· 1986 2014 break; 1987 2015 } 1988 2016 1989 - proc_create("sba_iommu", 0, root, &sba_proc_fops); 1990 - proc_create("sba_iommu-bitmap", 0, root, &sba_proc_bitmap_fops); 2017 + proc_create_single("sba_iommu", 0, root, sba_proc_info); 2018 + proc_create_single("sba_iommu-bitmap", 0, root, sba_proc_bitmap_info); 1991 2019 #endif 1992 2020 1993 2021 parisc_has_iommu();
+2 -15
drivers/platform/x86/toshiba_acpi.c
··· 1689 1689 return 0; 1690 1690 } 1691 1691 1692 - static int version_proc_open(struct inode *inode, struct file *file) 1693 - { 1694 - return single_open(file, version_proc_show, PDE_DATA(inode)); 1695 - } 1696 - 1697 - static 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 1693 * Proc and module init 1707 1694 */ ··· 1709 1722 if (dev->hotkey_dev) 1710 1723 proc_create_data("keys", S_IRUGO | S_IWUSR, toshiba_proc_dir, 1711 1724 &keys_proc_fops, dev); 1712 - proc_create_data("version", S_IRUGO, toshiba_proc_dir, 1713 - &version_proc_fops, dev); 1725 + proc_create_single_data("version", S_IRUGO, toshiba_proc_dir, 1726 + version_proc_show, dev); 1714 1727 } 1715 1728 1716 1729 static void remove_toshiba_proc_entries(struct toshiba_acpi_dev *dev)
+7 -71
drivers/pnp/pnpbios/proc.c
··· 47 47 return 0; 48 48 } 49 49 50 - static int pnpconfig_proc_open(struct inode *inode, struct file *file) 51 - { 52 - return single_open(file, pnpconfig_proc_show, NULL); 53 - } 54 - 55 - static 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 - 63 50 static int escd_info_proc_show(struct seq_file *m, void *v) 64 51 { 65 52 struct escd_info_struc escd; ··· 60 73 escd.escd_size, escd.nv_storage_base); 61 74 return 0; 62 75 } 63 - 64 - static int escd_info_proc_open(struct inode *inode, struct file *file) 65 - { 66 - return single_open(file, escd_info_proc_show, NULL); 67 - } 68 - 69 - static const struct file_operations escd_info_proc_fops = { 70 - .owner = THIS_MODULE, 71 - .open = escd_info_proc_open, 72 - .read = seq_read, 73 - .llseek = seq_lseek, 74 - .release = single_release, 75 - }; 76 76 77 77 #define MAX_SANE_ESCD_SIZE (32*1024) 78 78 static int escd_proc_show(struct seq_file *m, void *v) ··· 103 129 return 0; 104 130 } 105 131 106 - static int escd_proc_open(struct inode *inode, struct file *file) 107 - { 108 - return single_open(file, escd_proc_show, NULL); 109 - } 110 - 111 - static const struct file_operations escd_proc_fops = { 112 - .owner = THIS_MODULE, 113 - .open = escd_proc_open, 114 - .read = seq_read, 115 - .llseek = seq_lseek, 116 - .release = single_release, 117 - }; 118 - 119 132 static int pnp_legacyres_proc_show(struct seq_file *m, void *v) 120 133 { 121 134 void *buf; ··· 119 158 kfree(buf); 120 159 return 0; 121 160 } 122 - 123 - static int pnp_legacyres_proc_open(struct inode *inode, struct file *file) 124 - { 125 - return single_open(file, pnp_legacyres_proc_show, NULL); 126 - } 127 - 128 - static const struct file_operations pnp_legacyres_proc_fops = { 129 - .owner = THIS_MODULE, 130 - .open = pnp_legacyres_proc_open, 131 - .read = seq_read, 132 - .llseek = seq_lseek, 133 - .release = single_release, 134 - }; 135 161 136 162 static int pnp_devices_proc_show(struct seq_file *m, void *v) 137 163 { ··· 149 201 kfree(node); 150 202 return 0; 151 203 } 152 - 153 - static int pnp_devices_proc_open(struct inode *inode, struct file *file) 154 - { 155 - return single_open(file, pnp_devices_proc_show, NULL); 156 - } 157 - 158 - static const struct file_operations pnp_devices_proc_fops = { 159 - .owner = THIS_MODULE, 160 - .open = pnp_devices_proc_open, 161 - .read = seq_read, 162 - .llseek = seq_lseek, 163 - .release = single_release, 164 - }; 165 204 166 205 static int pnpbios_proc_show(struct seq_file *m, void *v) 167 206 { ··· 253 318 proc_pnp_boot = proc_mkdir("boot", proc_pnp); 254 319 if (!proc_pnp_boot) 255 320 return -EIO; 256 - proc_create("devices", 0, proc_pnp, &pnp_devices_proc_fops); 257 - proc_create("configuration_info", 0, proc_pnp, &pnpconfig_proc_fops); 258 - proc_create("escd_info", 0, proc_pnp, &escd_info_proc_fops); 259 - proc_create("escd", S_IRUSR, proc_pnp, &escd_proc_fops); 260 - proc_create("legacy_device_resources", 0, proc_pnp, &pnp_legacyres_proc_fops); 261 - 321 + proc_create_single("devices", 0, proc_pnp, pnp_devices_proc_show); 322 + proc_create_single("configuration_info", 0, proc_pnp, 323 + pnpconfig_proc_show); 324 + proc_create_single("escd_info", 0, proc_pnp, escd_info_proc_show); 325 + proc_create_single("escd", S_IRUSR, proc_pnp, escd_proc_show); 326 + proc_create_single("legacy_device_resources", 0, proc_pnp, 327 + pnp_legacyres_proc_show); 262 328 return 0; 263 329 } 264 330
+1 -17
drivers/staging/comedi/proc.c
··· 62 62 return 0; 63 63 } 64 64 65 - /* 66 - * seq_file wrappers for procfile show routines. 67 - */ 68 - static int comedi_proc_open(struct inode *inode, struct file *file) 69 - { 70 - return single_open(file, comedi_read, NULL); 71 - } 72 - 73 - static 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 - 81 65 void __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 68 pr_warn("comedi: unable to create proc entry\n"); 85 69 } 86 70
+2 -14
drivers/usb/gadget/udc/at91_udc.c
··· 234 234 return 0; 235 235 } 236 236 237 - static int proc_udc_open(struct inode *inode, struct file *file) 238 - { 239 - return single_open(file, proc_udc_show, PDE_DATA(inode)); 240 - } 241 - 242 - static 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 - 250 237 static 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 255 243 static void remove_debug_file(struct at91_udc *udc)
+2 -16
drivers/usb/gadget/udc/fsl_udc_core.c
··· 2207 2207 return 0; 2208 2208 } 2209 2209 2210 - /* 2211 - * seq_file wrappers for procfile show routines. 2212 - */ 2213 - static int fsl_proc_open(struct inode *inode, struct file *file) 2214 - { 2215 - return single_open(file, fsl_proc_read, NULL); 2216 - } 2217 - 2218 - static 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) 2210 + #define create_proc_file() \ 2211 + proc_create_single(proc_filename, 0, NULL, fsl_proc_read) 2226 2212 #define remove_proc_file() remove_proc_entry(proc_filename, NULL) 2227 2213 2228 2214 #else /* !CONFIG_USB_GADGET_DEBUG_FILES */
+1 -17
drivers/usb/gadget/udc/goku_udc.c
··· 1241 1241 local_irq_restore(flags); 1242 1242 return 0; 1243 1243 } 1244 - 1245 - /* 1246 - * seq_file wrappers for procfile show routines. 1247 - */ 1248 - static 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 - 1253 - static 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 1244 #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ 1261 1245 1262 1246 /*-------------------------------------------------------------------------*/ ··· 1810 1826 1811 1827 1812 1828 #ifdef CONFIG_USB_GADGET_DEBUG_FILES 1813 - proc_create_data(proc_node_name, 0, NULL, &udc_proc_fops, dev); 1829 + proc_create_single_data(proc_node_name, 0, NULL, udc_proc_read, dev); 1814 1830 #endif 1815 1831 1816 1832 retval = usb_add_gadget_udc_release(&pdev->dev, &dev->gadget,
+1 -14
drivers/usb/gadget/udc/omap_udc.c
··· 2432 2432 return 0; 2433 2433 } 2434 2434 2435 - static int proc_udc_open(struct inode *inode, struct file *file) 2436 - { 2437 - return single_open(file, proc_udc_show, NULL); 2438 - } 2439 - 2440 - static 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 - 2448 2435 static 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 2453 2440 static void remove_proc_file(void)
+2 -15
drivers/video/fbdev/via/viafbdev.c
··· 1475 1475 return 0; 1476 1476 } 1477 1477 1478 - static 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 - 1483 - static 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 - 1491 1478 static ssize_t odev_update(const char __user *buffer, size_t count, u32 *odev) 1492 1479 { 1493 1480 char buf[64], *ptr = buf; ··· 1603 1616 &viafb_vt1636_proc_fops); 1604 1617 #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */ 1605 1618 1606 - proc_create("supported_output_devices", 0, viafb_entry, 1607 - &viafb_sup_odev_proc_fops); 1619 + proc_create_single("supported_output_devices", 0, viafb_entry, 1620 + viafb_sup_odev_proc_show); 1608 1621 iga1_entry = proc_mkdir("iga1", viafb_entry); 1609 1622 shared->iga1_proc_entry = iga1_entry; 1610 1623 proc_create("output_devices", 0, iga1_entry,
+2 -13
fs/cifs/cifs_debug.c
··· 314 314 return 0; 315 315 } 316 316 317 - static 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 - 322 - static 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 317 #ifdef CONFIG_CIFS_STATS 330 318 static ssize_t cifs_stats_proc_write(struct file *file, 331 319 const char __user *buffer, size_t count, loff_t *ppos) ··· 485 497 if (proc_fs_cifs == NULL) 486 498 return; 487 499 488 - proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops); 500 + proc_create_single("DebugData", 0, proc_fs_cifs, 501 + cifs_debug_data_proc_show); 489 502 490 503 #ifdef CONFIG_CIFS_STATS 491 504 proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
+6 -23
fs/f2fs/sysfs.c
··· 572 572 return 0; 573 573 } 574 574 575 - #define F2FS_PROC_FILE_DEF(_name) \ 576 - static int _name##_open_fs(struct inode *inode, struct file *file) \ 577 - { \ 578 - return single_open(file, _name##_seq_show, PDE_DATA(inode)); \ 579 - } \ 580 - \ 581 - static 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 - 588 - F2FS_PROC_FILE_DEF(segment_info); 589 - F2FS_PROC_FILE_DEF(segment_bits); 590 - F2FS_PROC_FILE_DEF(iostat_info); 591 - 592 575 int __init f2fs_init_sysfs(void) 593 576 { 594 577 int ret; ··· 615 632 sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root); 616 633 617 634 if (sbi->s_proc) { 618 - proc_create_data("segment_info", S_IRUGO, sbi->s_proc, 619 - &f2fs_seq_segment_info_fops, sb); 620 - proc_create_data("segment_bits", S_IRUGO, sbi->s_proc, 621 - &f2fs_seq_segment_bits_fops, sb); 622 - proc_create_data("iostat_info", S_IRUGO, sbi->s_proc, 623 - &f2fs_seq_iostat_info_fops, sb); 635 + proc_create_single_data("segment_info", S_IRUGO, sbi->s_proc, 636 + segment_info_seq_show, sb); 637 + proc_create_single_data("segment_bits", S_IRUGO, sbi->s_proc, 638 + segment_bits_seq_show, sb); 639 + proc_create_single_data("iostat_info", S_IRUGO, sbi->s_proc, 640 + iostat_info_seq_show, sb); 624 641 } 625 642 return 0; 626 643 }
+1 -13
fs/filesystems.c
··· 238 238 return 0; 239 239 } 240 240 241 - static int filesystems_proc_open(struct inode *inode, struct file *file) 242 - { 243 - return single_open(file, filesystems_proc_show, NULL); 244 - } 245 - 246 - static 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 - 253 241 static 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 244 return 0; 257 245 } 258 246 module_init(proc_filesystems_init);
+1 -1
fs/fscache/internal.h
··· 295 295 296 296 #define __fscache_stat(stat) (stat) 297 297 298 - extern const struct file_operations fscache_stats_fops; 298 + int fscache_stats_show(struct seq_file *m, void *v); 299 299 #else 300 300 301 301 #define __fscache_stat(stat) (NULL)
+2 -2
fs/fscache/proc.c
··· 26 26 goto error_dir; 27 27 28 28 #ifdef CONFIG_FSCACHE_STATS 29 - if (!proc_create("fs/fscache/stats", S_IFREG | 0444, NULL, 30 - &fscache_stats_fops)) 29 + if (!proc_create_single("fs/fscache/stats", S_IFREG | 0444, NULL, 30 + fscache_stats_show)) 31 31 goto error_stats; 32 32 #endif 33 33
+1 -16
fs/fscache/stats.c
··· 138 138 /* 139 139 * display the general statistics 140 140 */ 141 - static int fscache_stats_show(struct seq_file *m, void *v) 141 + int fscache_stats_show(struct seq_file *m, void *v) 142 142 { 143 143 seq_puts(m, "FS-Cache statistics\n"); 144 144 ··· 284 284 atomic_read(&fscache_n_cache_culled_objects)); 285 285 return 0; 286 286 } 287 - 288 - /* 289 - * open "/proc/fs/fscache/stats" allowing provision of a statistical summary 290 - */ 291 - static int fscache_stats_open(struct inode *inode, struct file *file) 292 - { 293 - return single_open(file, fscache_stats_show, NULL); 294 - } 295 - 296 - const struct file_operations fscache_stats_fops = { 297 - .open = fscache_stats_open, 298 - .read = seq_read, 299 - .llseek = seq_lseek, 300 - .release = single_release, 301 - };
+1 -13
fs/proc/cmdline.c
··· 11 11 return 0; 12 12 } 13 13 14 - static int cmdline_proc_open(struct inode *inode, struct file *file) 15 - { 16 - return single_open(file, cmdline_proc_show, NULL); 17 - } 18 - 19 - static 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 - 26 14 static 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 17 return 0; 30 18 } 31 19 fs_initcall(proc_cmdline_init);
+29
fs/proc/generic.c
··· 588 588 } 589 589 EXPORT_SYMBOL(proc_create_seq_private); 590 590 591 + static 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 + 598 + static 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 + 605 + struct 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 + } 618 + EXPORT_SYMBOL(proc_create_single_data); 619 + 591 620 void proc_set_size(struct proc_dir_entry *de, loff_t size) 592 621 { 593 622 de->size = size;
+4 -1
fs/proc/internal.h
··· 44 44 struct completion *pde_unload_completion; 45 45 const struct inode_operations *proc_iops; 46 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 51 void *data; 49 52 unsigned int state_size; 50 53 unsigned int low_ino;
+1 -13
fs/proc/loadavg.c
··· 28 28 return 0; 29 29 } 30 30 31 - static int loadavg_proc_open(struct inode *inode, struct file *file) 32 - { 33 - return single_open(file, loadavg_proc_show, NULL); 34 - } 35 - 36 - static 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 - 43 31 static 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 34 return 0; 47 35 } 48 36 fs_initcall(proc_loadavg_init);
+1 -13
fs/proc/meminfo.c
··· 149 149 return 0; 150 150 } 151 151 152 - static int meminfo_proc_open(struct inode *inode, struct file *file) 153 - { 154 - return single_open(file, meminfo_proc_show, NULL); 155 - } 156 - 157 - static 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 - 164 152 static 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 155 return 0; 168 156 } 169 157 fs_initcall(proc_meminfo_init);
+1 -13
fs/proc/softirqs.c
··· 25 25 return 0; 26 26 } 27 27 28 - static int softirqs_open(struct inode *inode, struct file *file) 29 - { 30 - return single_open(file, show_softirqs, NULL); 31 - } 32 - 33 - static 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 - 40 28 static 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 31 return 0; 44 32 } 45 33 fs_initcall(proc_softirqs_init);
+1 -13
fs/proc/uptime.c
··· 30 30 return 0; 31 31 } 32 32 33 - static int uptime_proc_open(struct inode *inode, struct file *file) 34 - { 35 - return single_open(file, uptime_proc_show, NULL); 36 - } 37 - 38 - static 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 - 45 33 static 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 36 return 0; 49 37 } 50 38 fs_initcall(proc_uptime_init);
+1 -13
fs/proc/version.c
··· 15 15 return 0; 16 16 } 17 17 18 - static int version_proc_open(struct inode *inode, struct file *file) 19 - { 20 - return single_open(file, version_proc_show, NULL); 21 - } 22 - 23 - static 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 - 30 18 static 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 21 return 0; 34 22 } 35 23 fs_initcall(proc_version_init);
+1 -15
fs/reiserfs/procfs.c
··· 389 389 return 0; 390 390 } 391 391 392 - static 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 - 398 - static 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 - 405 392 static struct proc_dir_entry *proc_info_root = NULL; 406 393 static const char proc_info_root_name[] = "fs/reiserfs"; 407 394 408 395 static void add_file(struct super_block *sb, char *name, 409 396 int (*func) (struct seq_file *, void *)) 410 397 { 411 - proc_create_data(name, 0, REISERFS_SB(sb)->procdir, 412 - &r_file_operations, func); 398 + proc_create_single_data(name, 0, REISERFS_SB(sb)->procdir, func, sb); 413 399 } 414 400 415 401 int reiserfs_proc_info_init(struct super_block *sb)
+2 -29
fs/xfs/xfs_stats.c
··· 124 124 return 0; 125 125 } 126 126 127 - static int xqm_proc_open(struct inode *inode, struct file *file) 128 - { 129 - return single_open(file, xqm_proc_show, NULL); 130 - } 131 - 132 - static 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 127 /* legacy quota stats interface no 2 */ 140 128 static int xqmstat_proc_show(struct seq_file *m, void *v) 141 129 { ··· 135 147 seq_putc(m, '\n'); 136 148 return 0; 137 149 } 138 - 139 - static int xqmstat_proc_open(struct inode *inode, struct file *file) 140 - { 141 - return single_open(file, xqmstat_proc_show, NULL); 142 - } 143 - 144 - static const struct file_operations xqmstat_proc_fops = { 145 - .owner = THIS_MODULE, 146 - .open = xqmstat_proc_open, 147 - .read = seq_read, 148 - .llseek = seq_lseek, 149 - .release = single_release, 150 - }; 151 150 #endif /* CONFIG_XFS_QUOTA */ 152 151 153 152 #ifdef CONFIG_PROC_FS ··· 149 174 goto out; 150 175 151 176 #ifdef CONFIG_XFS_QUOTA 152 - if (!proc_create("fs/xfs/xqmstat", 0, NULL, 153 - &xqmstat_proc_fops)) 177 + if (!proc_create_single("fs/xfs/xqmstat", 0, NULL, xqmstat_proc_show)) 154 178 goto out; 155 - if (!proc_create("fs/xfs/xqm", 0, NULL, 156 - &xqm_proc_fops)) 179 + if (!proc_create_single("fs/xfs/xqm", 0, NULL, xqm_proc_show)) 157 180 goto out; 158 181 #endif 159 182 return 0;
+9 -1
include/linux/proc_fs.h
··· 9 9 #include <linux/fs.h> 10 10 11 11 struct proc_dir_entry; 12 + struct seq_file; 12 13 struct seq_operations; 13 14 14 15 #ifdef CONFIG_PROC_FS ··· 33 32 proc_create_seq_private(name, mode, parent, ops, 0, data) 34 33 #define proc_create_seq(name, mode, parent, ops) \ 35 34 proc_create_seq_private(name, mode, parent, ops, 0, NULL) 35 + struct proc_dir_entry *proc_create_single_data(const char *name, umode_t mode, 36 + struct proc_dir_entry *parent, 37 + int (*show)(struct seq_file *, void *), void *data); 38 + #define proc_create_single(name, mode, parent, show) \ 39 + proc_create_single_data(name, mode, parent, show, NULL) 36 40 37 41 extern struct proc_dir_entry *proc_create_data(const char *, umode_t, 38 42 struct proc_dir_entry *, ··· 72 66 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } 73 67 static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 74 68 umode_t mode, struct proc_dir_entry *parent) { return NULL; } 75 - #define proc_create_seq_private(name, mode, parent, ops, 0, data) ({NULL;}) 69 + #define proc_create_seq_private(name, mode, parent, ops, size, data) ({NULL;}) 76 70 #define proc_create_seq_data(name, mode, parent, ops, data) ({NULL;}) 77 71 #define proc_create_seq(name, mode, parent, ops) ({NULL;}) 72 + #define proc_create_single(name, mode, parent, show) ({NULL;}) 73 + #define proc_create_single_data(name, mode, parent, show, data) ({NULL;}) 78 74 #define proc_create(name, mode, parent, proc_fops) ({NULL;}) 79 75 #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) 80 76
+1 -1
kernel/cgroup/cgroup-internal.h
··· 218 218 * cgroup-v1.c 219 219 */ 220 220 extern struct cftype cgroup1_base_files[]; 221 - extern const struct file_operations proc_cgroupstats_operations; 222 221 extern struct kernfs_syscall_ops cgroup1_kf_syscall_ops; 223 222 223 + int proc_cgroupstats_show(struct seq_file *m, void *v); 224 224 bool cgroup1_ssid_disabled(int ssid); 225 225 void cgroup1_pidlist_destroy_all(struct cgroup *cgrp); 226 226 void cgroup1_release_agent(struct work_struct *work);
+1 -13
kernel/cgroup/cgroup-v1.c
··· 682 682 }; 683 683 684 684 /* Display information about each subsystem and each hierarchy */ 685 - static int proc_cgroupstats_show(struct seq_file *m, void *v) 685 + int proc_cgroupstats_show(struct seq_file *m, void *v) 686 686 { 687 687 struct cgroup_subsys *ss; 688 688 int i; ··· 704 704 mutex_unlock(&cgroup_mutex); 705 705 return 0; 706 706 } 707 - 708 - static int cgroupstats_open(struct inode *inode, struct file *file) 709 - { 710 - return single_open(file, proc_cgroupstats_show, NULL); 711 - } 712 - 713 - const struct file_operations proc_cgroupstats_operations = { 714 - .open = cgroupstats_open, 715 - .read = seq_read, 716 - .llseek = seq_lseek, 717 - .release = single_release, 718 - }; 719 707 720 708 /** 721 709 * cgroupstats_build - build and fill cgroupstats
+1 -1
kernel/cgroup/cgroup.c
··· 5335 5335 WARN_ON(sysfs_create_mount_point(fs_kobj, "cgroup")); 5336 5336 WARN_ON(register_filesystem(&cgroup_fs_type)); 5337 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 5340 return 0; 5341 5341 }
+1 -13
kernel/dma.c
··· 135 135 } 136 136 #endif /* MAX_DMA_CHANNELS */ 137 137 138 - static int proc_dma_open(struct inode *inode, struct file *file) 139 - { 140 - return single_open(file, proc_dma_show, NULL); 141 - } 142 - 143 - static 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 - 150 138 static 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 141 return 0; 154 142 } 155 143
+1 -13
kernel/exec_domain.c
··· 27 27 return 0; 28 28 } 29 29 30 - static int execdomains_proc_open(struct inode *inode, struct file *file) 31 - { 32 - return single_open(file, execdomains_proc_show, NULL); 33 - } 34 - 35 - static 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 - 42 30 static 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 33 return 0; 46 34 } 47 35 module_init(proc_execdomains_init);
+10 -72
kernel/irq/proc.c
··· 185 185 return single_open(file, irq_affinity_list_proc_show, PDE_DATA(inode)); 186 186 } 187 187 188 - static 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 - 193 188 static const struct file_operations irq_affinity_proc_fops = { 194 189 .open = irq_affinity_proc_open, 195 190 .read = seq_read, 196 191 .llseek = seq_lseek, 197 192 .release = single_release, 198 193 .write = irq_affinity_proc_write, 199 - }; 200 - 201 - static 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 194 }; 207 195 208 196 static const struct file_operations irq_affinity_list_proc_fops = { ··· 211 223 { 212 224 return show_irq_affinity(EFFECTIVE_LIST, m); 213 225 } 214 - 215 - static int irq_effective_aff_proc_open(struct inode *inode, struct file *file) 216 - { 217 - return single_open(file, irq_effective_aff_proc_show, PDE_DATA(inode)); 218 - } 219 - 220 - static int irq_effective_aff_list_proc_open(struct inode *inode, 221 - struct file *file) 222 - { 223 - return single_open(file, irq_effective_aff_list_proc_show, 224 - PDE_DATA(inode)); 225 - } 226 - 227 - static const struct file_operations irq_effective_aff_proc_fops = { 228 - .open = irq_effective_aff_proc_open, 229 - .read = seq_read, 230 - .llseek = seq_lseek, 231 - .release = single_release, 232 - }; 233 - 234 - static const struct file_operations irq_effective_aff_list_proc_fops = { 235 - .open = irq_effective_aff_list_proc_open, 236 - .read = seq_read, 237 - .llseek = seq_lseek, 238 - .release = single_release, 239 - }; 240 226 #endif 241 227 242 228 static int default_affinity_show(struct seq_file *m, void *v) ··· 275 313 seq_printf(m, "%d\n", irq_desc_get_node(desc)); 276 314 return 0; 277 315 } 278 - 279 - static int irq_node_proc_open(struct inode *inode, struct file *file) 280 - { 281 - return single_open(file, irq_node_proc_show, PDE_DATA(inode)); 282 - } 283 - 284 - static const struct file_operations irq_node_proc_fops = { 285 - .open = irq_node_proc_open, 286 - .read = seq_read, 287 - .llseek = seq_lseek, 288 - .release = single_release, 289 - }; 290 316 #endif 291 317 292 318 static int irq_spurious_proc_show(struct seq_file *m, void *v) ··· 286 336 jiffies_to_msecs(desc->last_unhandled)); 287 337 return 0; 288 338 } 289 - 290 - static int irq_spurious_proc_open(struct inode *inode, struct file *file) 291 - { 292 - return single_open(file, irq_spurious_proc_show, PDE_DATA(inode)); 293 - } 294 - 295 - static const struct file_operations irq_spurious_proc_fops = { 296 - .open = irq_spurious_proc_open, 297 - .read = seq_read, 298 - .llseek = seq_lseek, 299 - .release = single_release, 300 - }; 301 339 302 340 #define MAX_NAMELEN 128 303 341 ··· 359 421 &irq_affinity_proc_fops, irqp); 360 422 361 423 /* create /proc/irq/<irq>/affinity_hint */ 362 - proc_create_data("affinity_hint", 0444, desc->dir, 363 - &irq_affinity_hint_proc_fops, irqp); 424 + proc_create_single_data("affinity_hint", 0444, desc->dir, 425 + irq_affinity_hint_proc_show, irqp); 364 426 365 427 /* create /proc/irq/<irq>/smp_affinity_list */ 366 428 proc_create_data("smp_affinity_list", 0644, desc->dir, 367 429 &irq_affinity_list_proc_fops, irqp); 368 430 369 - proc_create_data("node", 0444, desc->dir, 370 - &irq_node_proc_fops, irqp); 431 + proc_create_single_data("node", 0444, desc->dir, irq_node_proc_show, 432 + irqp); 371 433 # ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK 372 - proc_create_data("effective_affinity", 0444, desc->dir, 373 - &irq_effective_aff_proc_fops, irqp); 374 - proc_create_data("effective_affinity_list", 0444, desc->dir, 375 - &irq_effective_aff_list_proc_fops, irqp); 434 + proc_create_single_data("effective_affinity", 0444, desc->dir, 435 + irq_effective_aff_proc_show, irqp); 436 + proc_create_single_data("effective_affinity_list", 0444, desc->dir, 437 + irq_effective_aff_list_proc_show, irqp); 376 438 # endif 377 439 #endif 378 - proc_create_data("spurious", 0444, desc->dir, 379 - &irq_spurious_proc_fops, (void *)(long)irq); 440 + proc_create_single_data("spurious", 0444, desc->dir, 441 + irq_spurious_proc_show, (void *)(long)irq); 380 442 381 443 out_unlock: 382 444 mutex_unlock(&register_lock);
+1 -15
kernel/locking/lockdep_proc.c
··· 331 331 return 0; 332 332 } 333 333 334 - static int lockdep_stats_open(struct inode *inode, struct file *file) 335 - { 336 - return single_open(file, lockdep_stats_show, NULL); 337 - } 338 - 339 - static 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 334 #ifdef CONFIG_LOCK_STAT 347 335 348 336 struct lock_stat_data { ··· 650 662 #ifdef CONFIG_PROVE_LOCKING 651 663 proc_create_seq("lockdep_chains", S_IRUSR, NULL, &lockdep_chains_ops); 652 664 #endif 653 - proc_create("lockdep_stats", S_IRUSR, NULL, 654 - &proc_lockdep_stats_operations); 655 - 665 + proc_create_single("lockdep_stats", S_IRUSR, NULL, lockdep_stats_show); 656 666 #ifdef CONFIG_LOCK_STAT 657 667 proc_create("lock_stat", S_IRUSR | S_IWUSR, NULL, 658 668 &proc_lock_stat_operations);
+2 -19
net/8021q/vlanproc.c
··· 87 87 }; 88 88 89 89 /* 90 - * /proc/net/vlan/<device> file and inode operations 91 - */ 92 - 93 - static int vlandev_seq_open(struct inode *inode, struct file *file) 94 - { 95 - return single_open(file, vlandev_seq_show, PDE_DATA(inode)); 96 - } 97 - 98 - static 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 90 * Proc filesystem directory entries. 107 91 */ 108 92 ··· 155 171 156 172 if (!strcmp(vlandev->name, name_conf)) 157 173 return -EINVAL; 158 - vlan->dent = 159 - proc_create_data(vlandev->name, S_IFREG | 0600, 160 - vn->proc_vlan_dir, &vlandev_fops, vlandev); 174 + vlan->dent = proc_create_single_data(vlandev->name, S_IFREG | 0600, 175 + vn->proc_vlan_dir, vlandev_seq_show, vlandev); 161 176 if (!vlan->dent) 162 177 return -ENOBUFS; 163 178 return 0;
+1 -13
net/ipv4/ipconfig.c
··· 1282 1282 &ic_servaddr); 1283 1283 return 0; 1284 1284 } 1285 - 1286 - static int pnp_seq_open(struct inode *indoe, struct file *file) 1287 - { 1288 - return single_open(file, pnp_seq_show, NULL); 1289 - } 1290 - 1291 - static 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 1285 #endif /* CONFIG_PROC_FS */ 1298 1286 1299 1287 /* ··· 1357 1369 unsigned int i; 1358 1370 1359 1371 #ifdef CONFIG_PROC_FS 1360 - proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops); 1372 + proc_create_single("pnp", 0444, init_net.proc_net, pnp_seq_show); 1361 1373 #endif /* CONFIG_PROC_FS */ 1362 1374 1363 1375 if (!ic_enable)
+2 -13
net/ipv4/route.c
··· 360 360 kfree(dst); 361 361 return 0; 362 362 } 363 - 364 - static int rt_acct_proc_open(struct inode *inode, struct file *file) 365 - { 366 - return single_open(file, rt_acct_proc_show, NULL); 367 - } 368 - 369 - static 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 363 #endif 376 364 377 365 static int __net_init ip_rt_do_proc_init(struct net *net) ··· 377 389 goto err2; 378 390 379 391 #ifdef CONFIG_IP_ROUTE_CLASSID 380 - pde = proc_create("rt_acct", 0, net->proc_net, &rt_acct_proc_fops); 392 + pde = proc_create_single("rt_acct", 0, net->proc_net, 393 + rt_acct_proc_show); 381 394 if (!pde) 382 395 goto err3; 383 396 #endif
+2 -15
net/ipv6/proc.c
··· 267 267 return 0; 268 268 } 269 269 270 - static 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 - 275 - static 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 - 282 270 int snmp6_register_dev(struct inet6_dev *idev) 283 271 { 284 272 struct proc_dir_entry *p; ··· 279 291 if (!net->mib.proc_net_devsnmp6) 280 292 return -ENOENT; 281 293 282 - p = proc_create_data(idev->dev->name, 0444, 283 - net->mib.proc_net_devsnmp6, 284 - &snmp6_dev_seq_fops, idev); 294 + p = proc_create_single_data(idev->dev->name, 0444, 295 + net->mib.proc_net_devsnmp6, snmp6_dev_seq_show, idev); 285 296 if (!p) 286 297 return -ENOMEM; 287 298
+1 -13
net/sched/sch_api.c
··· 2092 2092 return 0; 2093 2093 } 2094 2094 2095 - static int psched_open(struct inode *inode, struct file *file) 2096 - { 2097 - return single_open(file, psched_show, NULL); 2098 - } 2099 - 2100 - static const struct file_operations psched_fops = { 2101 - .open = psched_open, 2102 - .read = seq_read, 2103 - .llseek = seq_lseek, 2104 - .release = single_release, 2105 - }; 2106 - 2107 2095 static int __net_init psched_net_init(struct net *net) 2108 2096 { 2109 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 2100 if (e == NULL) 2113 2101 return -ENOMEM; 2114 2102