aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
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/message
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/message')
-rw-r--r--drivers/message/fusion/mptbase.c57
1 files changed, 11 insertions, 46 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 51eb1b027963..a746ccdd630a 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -197,9 +197,9 @@ static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_valu
197static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init); 197static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init);
198 198
199#ifdef CONFIG_PROC_FS 199#ifdef CONFIG_PROC_FS
200static const struct file_operations mpt_summary_proc_fops; 200static int mpt_summary_proc_show(struct seq_file *m, void *v);
201static const struct file_operations mpt_version_proc_fops; 201static int mpt_version_proc_show(struct seq_file *m, void *v);
202static const struct file_operations mpt_iocinfo_proc_fops; 202static int mpt_iocinfo_proc_show(struct seq_file *m, void *v);
203#endif 203#endif
204static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); 204static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc);
205 205
@@ -2040,8 +2040,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
2040 */ 2040 */
2041 dent = proc_mkdir(ioc->name, mpt_proc_root_dir); 2041 dent = proc_mkdir(ioc->name, mpt_proc_root_dir);
2042 if (dent) { 2042 if (dent) {
2043 proc_create_data("info", S_IRUGO, dent, &mpt_iocinfo_proc_fops, ioc); 2043 proc_create_single_data("info", S_IRUGO, dent,
2044 proc_create_data("summary", S_IRUGO, dent, &mpt_summary_proc_fops, ioc); 2044 mpt_iocinfo_proc_show, ioc);
2045 proc_create_single_data("summary", S_IRUGO, dent,
2046 mpt_summary_proc_show, ioc);
2045 } 2047 }
2046#endif 2048#endif
2047 2049
@@ -6606,8 +6608,10 @@ procmpt_create(void)
6606 if (mpt_proc_root_dir == NULL) 6608 if (mpt_proc_root_dir == NULL)
6607 return -ENOTDIR; 6609 return -ENOTDIR;
6608 6610
6609 proc_create("summary", S_IRUGO, mpt_proc_root_dir, &mpt_summary_proc_fops); 6611 proc_create_single("summary", S_IRUGO, mpt_proc_root_dir,
6610 proc_create("version", S_IRUGO, mpt_proc_root_dir, &mpt_version_proc_fops); 6612 mpt_summary_proc_show);
6613 proc_create_single("version", S_IRUGO, mpt_proc_root_dir,
6614 mpt_version_proc_show);
6611 return 0; 6615 return 0;
6612} 6616}
6613 6617
@@ -6646,19 +6650,6 @@ static int mpt_summary_proc_show(struct seq_file *m, void *v)
6646 return 0; 6650 return 0;
6647} 6651}
6648 6652
6649static int mpt_summary_proc_open(struct inode *inode, struct file *file)
6650{
6651 return single_open(file, mpt_summary_proc_show, PDE_DATA(inode));
6652}
6653
6654static const struct file_operations mpt_summary_proc_fops = {
6655 .owner = THIS_MODULE,
6656 .open = mpt_summary_proc_open,
6657 .read = seq_read,
6658 .llseek = seq_lseek,
6659 .release = single_release,
6660};
6661
6662static int mpt_version_proc_show(struct seq_file *m, void *v) 6653static int mpt_version_proc_show(struct seq_file *m, void *v)
6663{ 6654{
6664 u8 cb_idx; 6655 u8 cb_idx;
@@ -6701,19 +6692,6 @@ static int mpt_version_proc_show(struct seq_file *m, void *v)
6701 return 0; 6692 return 0;
6702} 6693}
6703 6694
6704static int mpt_version_proc_open(struct inode *inode, struct file *file)
6705{
6706 return single_open(file, mpt_version_proc_show, NULL);
6707}
6708
6709static const struct file_operations mpt_version_proc_fops = {
6710 .owner = THIS_MODULE,
6711 .open = mpt_version_proc_open,
6712 .read = seq_read,
6713 .llseek = seq_lseek,
6714 .release = single_release,
6715};
6716
6717static int mpt_iocinfo_proc_show(struct seq_file *m, void *v) 6695static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
6718{ 6696{
6719 MPT_ADAPTER *ioc = m->private; 6697 MPT_ADAPTER *ioc = m->private;
@@ -6793,19 +6771,6 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
6793 6771
6794 return 0; 6772 return 0;
6795} 6773}
6796
6797static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file)
6798{
6799 return single_open(file, mpt_iocinfo_proc_show, PDE_DATA(inode));
6800}
6801
6802static const struct file_operations mpt_iocinfo_proc_fops = {
6803 .owner = THIS_MODULE,
6804 .open = mpt_iocinfo_proc_open,
6805 .read = seq_read,
6806 .llseek = seq_lseek,
6807 .release = single_release,
6808};
6809#endif /* CONFIG_PROC_FS } */ 6774#endif /* CONFIG_PROC_FS } */
6810 6775
6811/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6776/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/