diff options
author | Christoph Hellwig <hch@lst.de> | 2018-05-15 15:57:23 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 07:23:35 +0200 |
commit | 3f3942aca6da351a12543aa776467791b63b3a78 (patch) | |
tree | 31030e086ea36920e07078ea2289b9b72c0b2939 /drivers/macintosh/via-pmu.c | |
parent | 44414d82cfe0f68cb59d0a42f599ccd893ae0032 (diff) | |
download | linux-3f3942aca6da351a12543aa776467791b63b3a78.tar.bz2 |
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/via-pmu.c')
-rw-r--r-- | drivers/macintosh/via-pmu.c | 57 |
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); static void pmu_start(void); static irqreturn_t via_pmu_interrupt(int irq, void *arg); static irqreturn_t gpio1_interrupt(int irq, void *arg); -static const struct file_operations pmu_info_proc_fops; -static const struct file_operations pmu_irqstats_proc_fops; +static int pmu_info_proc_show(struct seq_file *m, void *v); +static int pmu_irqstats_proc_show(struct seq_file *m, void *v); +static int pmu_battery_proc_show(struct seq_file *m, void *v); static void pmu_pass_intr(unsigned char *data, int len); -static const struct file_operations pmu_battery_proc_fops; static const struct file_operations pmu_options_proc_fops; #ifdef CONFIG_ADB @@ -511,13 +511,15 @@ static int __init via_pmu_dev_init(void) for (i=0; i<pmu_battery_count; i++) { char title[16]; sprintf(title, "battery_%ld", i); - proc_pmu_batt[i] = proc_create_data(title, 0, proc_pmu_root, - &pmu_battery_proc_fops, (void *)i); + proc_pmu_batt[i] = proc_create_single_data(title, 0, + proc_pmu_root, pmu_battery_proc_show, + (void *)i); } - proc_pmu_info = proc_create("info", 0, proc_pmu_root, &pmu_info_proc_fops); - proc_pmu_irqstats = proc_create("interrupts", 0, proc_pmu_root, - &pmu_irqstats_proc_fops); + proc_pmu_info = proc_create_single("info", 0, proc_pmu_root, + pmu_info_proc_show); + proc_pmu_irqstats = proc_create_single("interrupts", 0, + proc_pmu_root, pmu_irqstats_proc_show); proc_pmu_options = proc_create("options", 0600, proc_pmu_root, &pmu_options_proc_fops); } @@ -811,19 +813,6 @@ static int pmu_info_proc_show(struct seq_file *m, void *v) return 0; } -static int pmu_info_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, pmu_info_proc_show, NULL); -} - -static const struct file_operations pmu_info_proc_fops = { - .owner = THIS_MODULE, - .open = pmu_info_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - static int pmu_irqstats_proc_show(struct seq_file *m, void *v) { int i; @@ -848,19 +837,6 @@ static int pmu_irqstats_proc_show(struct seq_file *m, void *v) return 0; } -static int pmu_irqstats_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, pmu_irqstats_proc_show, NULL); -} - -static const struct file_operations pmu_irqstats_proc_fops = { - .owner = THIS_MODULE, - .open = pmu_irqstats_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - static int pmu_battery_proc_show(struct seq_file *m, void *v) { long batnum = (long)m->private; @@ -875,19 +851,6 @@ static int pmu_battery_proc_show(struct seq_file *m, void *v) return 0; } -static int pmu_battery_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, pmu_battery_proc_show, PDE_DATA(inode)); -} - -static const struct file_operations pmu_battery_proc_fops = { - .owner = THIS_MODULE, - .open = pmu_battery_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - static int pmu_options_proc_show(struct seq_file *m, void *v) { #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) |