aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
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/mtd
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/mtd')
-rw-r--r--drivers/mtd/mtdcore.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 807d17d863b3..64a1fcaafd9a 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -1829,18 +1829,6 @@ static int mtd_proc_show(struct seq_file *m, void *v)
1829 mutex_unlock(&mtd_table_mutex); 1829 mutex_unlock(&mtd_table_mutex);
1830 return 0; 1830 return 0;
1831} 1831}
1832
1833static int mtd_proc_open(struct inode *inode, struct file *file)
1834{
1835 return single_open(file, mtd_proc_show, NULL);
1836}
1837
1838static 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#endif /* CONFIG_PROC_FS */ 1832#endif /* CONFIG_PROC_FS */
1845 1833
1846/*====================================================================*/ 1834/*====================================================================*/
@@ -1883,7 +1871,7 @@ static int __init init_mtd(void)
1883 goto err_bdi; 1871 goto err_bdi;
1884 } 1872 }
1885 1873
1886 proc_mtd = proc_create("mtd", 0, NULL, &mtd_proc_ops); 1874 proc_mtd = proc_create_single("mtd", 0, NULL, mtd_proc_show);
1887 1875
1888 ret = init_mtdchar(); 1876 ret = init_mtdchar();
1889 if (ret) 1877 if (ret)