summaryrefslogtreecommitdiffstats
path: root/arch/um/drivers
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 /arch/um/drivers
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 'arch/um/drivers')
-rw-r--r--arch/um/drivers/ubd_kern.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index d4e8c497ae86..dcf5ea28a281 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -208,19 +208,6 @@ static int fake_ide_media_proc_show(struct seq_file *m, void *v)
208 return 0; 208 return 0;
209} 209}
210 210
211static int fake_ide_media_proc_open(struct inode *inode, struct file *file)
212{
213 return single_open(file, fake_ide_media_proc_show, NULL);
214}
215
216static const struct file_operations fake_ide_media_proc_fops = {
217 .owner = THIS_MODULE,
218 .open = fake_ide_media_proc_open,
219 .read = seq_read,
220 .llseek = seq_lseek,
221 .release = single_release,
222};
223
224static void make_ide_entries(const char *dev_name) 211static void make_ide_entries(const char *dev_name)
225{ 212{
226 struct proc_dir_entry *dir, *ent; 213 struct proc_dir_entry *dir, *ent;
@@ -231,7 +218,8 @@ static void make_ide_entries(const char *dev_name)
231 dir = proc_mkdir(dev_name, proc_ide); 218 dir = proc_mkdir(dev_name, proc_ide);
232 if(!dir) return; 219 if(!dir) return;
233 220
234 ent = proc_create("media", S_IRUGO, dir, &fake_ide_media_proc_fops); 221 ent = proc_create_single("media", S_IRUGO, dir,
222 fake_ide_media_proc_show);
235 if(!ent) return; 223 if(!ent) return;
236 snprintf(name, sizeof(name), "ide0/%s", dev_name); 224 snprintf(name, sizeof(name), "ide0/%s", dev_name);
237 proc_symlink(dev_name, proc_ide_root, name); 225 proc_symlink(dev_name, proc_ide_root, name);