mfd: ab3100-otp: Convert to DEFINE_SHOW_ATTRIBUTE
PATCH v2 1/1 mfd: ab3100-otp: Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by Qinglang Miao <[email protected]>
---
v2: based on linux-next(20200917), and can be applied to
mainline cleanly now.
drivers/mfd/ab3100-otp.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/mfd/ab3100-otp.c +3 -13
@@ -96,7 +96,7 @@ static int __init ab3100_otp_read(struct ab3100_otp *otp)* the contents of the OTP. */ #ifdef CONFIG_DEBUG_FS -static int ab3100_show_otp (struct seq_file *s,void *v) +static int ab3100_otp_show (struct seq_file *s,void *v) {struct ab3100_otp *otp = s->private;
@@ -110,23 +110,13 @@ static int ab3100_show_otp(struct seq_file *s, void *v)return 0 ; } -static int ab3100_otp_open (struct inode *inode,struct file *file) -{ -return single_open (file, ab3100_show_otp, inode->i_private); -} - -static const struct file_operations ab3100_otp_operations = { - .open = ab3100_otp_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE (ab3100_otp);static void __init ab3100_otp_init_debugfs (struct device *dev,struct ab3100_otp *otp) { otp->debugfs =debugfs_create_file ("ab3100_otp" ,S_IFREG |S_IRUGO , -NULL , otp, &ab3100_otp_operations); +NULL , otp, &ab3100_otp_fops); } static void __exit ab3100_otp_exit_debugfs(struct ab3100_otp *otp)
Signature · 1 line
2.23.0
Quoted 3 lines · Qinglang Miao
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Qinglang Miao <[email protected]>
Reviewed-by Linus Walleij <[email protected]>
Yours,
Linus Walleij