* [PATCH -next v2] mfd: ab3100-otp: Convert to DEFINE_SHOW_ATTRIBUTE
@ 2020-09-19 2:18 Qinglang Miao
2020-09-29 13:15 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Qinglang Miao @ 2020-09-19 2:18 UTC (permalink / raw)
To: Linus Walleij, Lee Jones; +Cc: linux-arm-kernel, linux-kernel, Qinglang Miao
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
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(-)
diff --git a/drivers/mfd/ab3100-otp.c b/drivers/mfd/ab3100-otp.c
index c393102e3..e5d294805 100644
--- a/drivers/mfd/ab3100-otp.c
+++ b/drivers/mfd/ab3100-otp.c
@@ -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)
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next v2] mfd: ab3100-otp: Convert to DEFINE_SHOW_ATTRIBUTE
2020-09-19 2:18 [PATCH -next v2] mfd: ab3100-otp: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
@ 2020-09-29 13:15 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2020-09-29 13:15 UTC (permalink / raw)
To: Qinglang Miao; +Cc: Lee Jones, Linux ARM, linux-kernel
On Sat, Sep 19, 2020 at 4:18 AM Qinglang Miao <miaoqinglang@huawei.com> wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-29 13:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19 2:18 [PATCH -next v2] mfd: ab3100-otp: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
2020-09-29 13:15 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).