summaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-05-15 09:57:23 -0400
committerChristoph Hellwig <hch@lst.de>2018-05-16 01:23:35 -0400
commit3f3942aca6da351a12543aa776467791b63b3a78 (patch)
tree31030e086ea36920e07078ea2289b9b72c0b2939 /drivers/macintosh
parent44414d82cfe0f68cb59d0a42f599ccd893ae0032 (diff)
proc: introduce proc_create_single{,_data}
Variants of proc_create{,_data} that directly take a seq_file show callback and drastically reduces the boilerplate code in the callers. All trivial callers converted over. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/via-pmu.c57
1 files changed, 10 insertions, 47 deletions
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 433dbeddfcf9..6663893f41c4 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -191,10 +191,10 @@ static int init_pmu(void);
191static void pmu_start(void); 191static void pmu_start(void);
192static irqreturn_t via_pmu_interrupt(int irq, void *arg); 192static irqreturn_t via_pmu_interrupt(int irq, void *arg);
193static irqreturn_t gpio1_interrupt(int irq, void *arg); 193static irqreturn_t gpio1_interrupt(int irq, void *arg);
194static const struct file_operations pmu_info_proc_fops; 194static int pmu_info_proc_show(struct seq_file *m, void *v);
195static const struct file_operations pmu_irqstats_proc_fops; 195static int pmu_irqstats_proc_show(struct seq_file *m, void *v);
196static int pmu_battery_proc_show(struct seq_file *m, void *v);
196static void pmu_pass_intr(unsigned char *data, int len); 197static void pmu_pass_intr(unsigned char *data, int len);
197static const struct file_operations pmu_battery_proc_fops;
198static const struct file_operations pmu_options_proc_fops; 198static const struct file_operations pmu_options_proc_fops;
199 199
200#ifdef CONFIG_ADB 200#ifdef CONFIG_ADB
@@ -511,13 +511,15 @@ static int __init via_pmu_dev_init(void)
511 for (i=0; i<pmu_battery_count; i++) { 511 for (i=0; i<pmu_battery_count; i++) {
512 char title[16]; 512 char title[16];
513 sprintf(title, "battery_%ld", i); 513 sprintf(title, "battery_%ld", i);
514 proc_pmu_batt[i] = proc_create_data(title, 0, proc_pmu_root, 514 proc_pmu_batt[i] = proc_create_single_data(title, 0,
515 &pmu_battery_proc_fops, (void *)i); 515 proc_pmu_root, pmu_battery_proc_show,
516 (void *)i);
516 } 517 }
517 518
518 proc_pmu_info = proc_create("info", 0, proc_pmu_root, &pmu_info_proc_fops); 519 proc_pmu_info = proc_create_single("info", 0, proc_pmu_root,
519 proc_pmu_irqstats = proc_create("interrupts", 0, proc_pmu_root, 520 pmu_info_proc_show);
520 &pmu_irqstats_proc_fops); 521 proc_pmu_irqstats = proc_create_single("interrupts", 0,
522 proc_pmu_root, pmu_irqstats_proc_show);
521 proc_pmu_options = proc_create("options", 0600, proc_pmu_root, 523 proc_pmu_options = proc_create("options", 0600, proc_pmu_root,
522 &pmu_options_proc_fops); 524 &pmu_options_proc_fops);
523 } 525 }
@@ -811,19 +813,6 @@ static int pmu_info_proc_show(struct seq_file *m, void *v)
811 return 0; 813 return 0;
812} 814}
813 815
814static int pmu_info_proc_open(struct inode *inode, struct file *file)
815{
816 return single_open(file, pmu_info_proc_show, NULL);
817}
818
819static const struct file_operations pmu_info_proc_fops = {
820 .owner = THIS_MODULE,
821 .open = pmu_info_proc_open,
822 .read = seq_read,
823 .llseek = seq_lseek,
824 .release = single_release,
825};
826
827static int pmu_irqstats_proc_show(struct seq_file *m, void *v) 816static int pmu_irqstats_proc_show(struct seq_file *m, void *v)
828{ 817{
829 int i; 818 int i;
@@ -848,19 +837,6 @@ static int pmu_irqstats_proc_show(struct seq_file *m, void *v)
848 return 0; 837 return 0;
849} 838}
850 839
851static int pmu_irqstats_proc_open(struct inode *inode, struct file *file)
852{
853 return single_open(file, pmu_irqstats_proc_show, NULL);
854}
855
856static const struct file_operations pmu_irqstats_proc_fops = {
857 .owner = THIS_MODULE,
858 .open = pmu_irqstats_proc_open,
859 .read = seq_read,
860 .llseek = seq_lseek,
861 .release = single_release,
862};
863
864static int pmu_battery_proc_show(struct seq_file *m, void *v) 840static int pmu_battery_proc_show(struct seq_file *m, void *v)
865{ 841{
866 long batnum = (long)m->private; 842 long batnum = (long)m->private;
@@ -875,19 +851,6 @@ static int pmu_battery_proc_show(struct seq_file *m, void *v)
875 return 0; 851 return 0;
876} 852}
877 853
878static int pmu_battery_proc_open(struct inode *inode, struct file *file)
879{
880 return single_open(file, pmu_battery_proc_show, PDE_DATA(inode));
881}
882
883static const struct file_operations pmu_battery_proc_fops = {
884 .owner = THIS_MODULE,
885 .open = pmu_battery_proc_open,
886 .read = seq_read,
887 .llseek = seq_lseek,
888 .release = single_release,
889};
890
891static int pmu_options_proc_show(struct seq_file *m, void *v) 854static int pmu_options_proc_show(struct seq_file *m, void *v)
892{ 855{
893#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) 856#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)