summaryrefslogtreecommitdiffstats
path: root/drivers/pnp
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/pnp
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/pnp')
-rw-r--r--drivers/pnp/pnpbios/proc.c78
1 files changed, 7 insertions, 71 deletions
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
index 7d4aca7948dd..fe1c8f5d9af0 100644
--- a/drivers/pnp/pnpbios/proc.c
+++ b/drivers/pnp/pnpbios/proc.c
@@ -47,19 +47,6 @@ static int pnpconfig_proc_show(struct seq_file *m, void *v)
47 return 0; 47 return 0;
48} 48}
49 49
50static int pnpconfig_proc_open(struct inode *inode, struct file *file)
51{
52 return single_open(file, pnpconfig_proc_show, NULL);
53}
54
55static const struct file_operations pnpconfig_proc_fops = {
56 .owner = THIS_MODULE,
57 .open = pnpconfig_proc_open,
58 .read = seq_read,
59 .llseek = seq_lseek,
60 .release = single_release,
61};
62
63static int escd_info_proc_show(struct seq_file *m, void *v) 50static int escd_info_proc_show(struct seq_file *m, void *v)
64{ 51{
65 struct escd_info_struc escd; 52 struct escd_info_struc escd;
@@ -74,19 +61,6 @@ static int escd_info_proc_show(struct seq_file *m, void *v)
74 return 0; 61 return 0;
75} 62}
76 63
77static int escd_info_proc_open(struct inode *inode, struct file *file)
78{
79 return single_open(file, escd_info_proc_show, NULL);
80}
81
82static const struct file_operations escd_info_proc_fops = {
83 .owner = THIS_MODULE,
84 .open = escd_info_proc_open,
85 .read = seq_read,
86 .llseek = seq_lseek,
87 .release = single_release,
88};
89
90#define MAX_SANE_ESCD_SIZE (32*1024) 64#define MAX_SANE_ESCD_SIZE (32*1024)
91static int escd_proc_show(struct seq_file *m, void *v) 65static int escd_proc_show(struct seq_file *m, void *v)
92{ 66{
@@ -129,19 +103,6 @@ static int escd_proc_show(struct seq_file *m, void *v)
129 return 0; 103 return 0;
130} 104}
131 105
132static int escd_proc_open(struct inode *inode, struct file *file)
133{
134 return single_open(file, escd_proc_show, NULL);
135}
136
137static const struct file_operations escd_proc_fops = {
138 .owner = THIS_MODULE,
139 .open = escd_proc_open,
140 .read = seq_read,
141 .llseek = seq_lseek,
142 .release = single_release,
143};
144
145static int pnp_legacyres_proc_show(struct seq_file *m, void *v) 106static int pnp_legacyres_proc_show(struct seq_file *m, void *v)
146{ 107{
147 void *buf; 108 void *buf;
@@ -159,19 +120,6 @@ static int pnp_legacyres_proc_show(struct seq_file *m, void *v)
159 return 0; 120 return 0;
160} 121}
161 122
162static int pnp_legacyres_proc_open(struct inode *inode, struct file *file)
163{
164 return single_open(file, pnp_legacyres_proc_show, NULL);
165}
166
167static const struct file_operations pnp_legacyres_proc_fops = {
168 .owner = THIS_MODULE,
169 .open = pnp_legacyres_proc_open,
170 .read = seq_read,
171 .llseek = seq_lseek,
172 .release = single_release,
173};
174
175static int pnp_devices_proc_show(struct seq_file *m, void *v) 123static int pnp_devices_proc_show(struct seq_file *m, void *v)
176{ 124{
177 struct pnp_bios_node *node; 125 struct pnp_bios_node *node;
@@ -202,19 +150,6 @@ static int pnp_devices_proc_show(struct seq_file *m, void *v)
202 return 0; 150 return 0;
203} 151}
204 152
205static int pnp_devices_proc_open(struct inode *inode, struct file *file)
206{
207 return single_open(file, pnp_devices_proc_show, NULL);
208}
209
210static const struct file_operations pnp_devices_proc_fops = {
211 .owner = THIS_MODULE,
212 .open = pnp_devices_proc_open,
213 .read = seq_read,
214 .llseek = seq_lseek,
215 .release = single_release,
216};
217
218static int pnpbios_proc_show(struct seq_file *m, void *v) 153static int pnpbios_proc_show(struct seq_file *m, void *v)
219{ 154{
220 void *data = m->private; 155 void *data = m->private;
@@ -318,12 +253,13 @@ int __init pnpbios_proc_init(void)
318 proc_pnp_boot = proc_mkdir("boot", proc_pnp); 253 proc_pnp_boot = proc_mkdir("boot", proc_pnp);
319 if (!proc_pnp_boot) 254 if (!proc_pnp_boot)
320 return -EIO; 255 return -EIO;
321 proc_create("devices", 0, proc_pnp, &pnp_devices_proc_fops); 256 proc_create_single("devices", 0, proc_pnp, pnp_devices_proc_show);
322 proc_create("configuration_info", 0, proc_pnp, &pnpconfig_proc_fops); 257 proc_create_single("configuration_info", 0, proc_pnp,
323 proc_create("escd_info", 0, proc_pnp, &escd_info_proc_fops); 258 pnpconfig_proc_show);
324 proc_create("escd", S_IRUSR, proc_pnp, &escd_proc_fops); 259 proc_create_single("escd_info", 0, proc_pnp, escd_info_proc_show);
325 proc_create("legacy_device_resources", 0, proc_pnp, &pnp_legacyres_proc_fops); 260 proc_create_single("escd", S_IRUSR, proc_pnp, escd_proc_show);
326 261 proc_create_single("legacy_device_resources", 0, proc_pnp,
262 pnp_legacyres_proc_show);
327 return 0; 263 return 0;
328} 264}
329 265