mfd: convert to DEFINE_SHOW_ATTRIBUTE
PATCH 1/1 mfd: convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by Yangtao Li <[email protected]>
--- drivers/mfd/ab3100-core.c | 15 ++------------- drivers/mfd/ab3100-otp.c | 16 +++------------- drivers/mfd/tps65010.c | 14 ++------------ 3 files changed, 7 insertions(+), 38 deletions(-)
drivers/mfd/ab3100-core.c +2 -13
@@ -451,7 +451,7 @@ static irqreturn_t ab3100_irq_handler(int irq, void *data)/* * Some debugfs entries only exposed if we're using debug */ -static int ab3100_registers_print (struct seq_file *s,void *p) +static int ab3100_registers_show (struct seq_file *s,void *p) {struct ab3100 *ab3100 = s->private;u8 value;
@@ -466,18 +466,7 @@ static int ab3100_registers_print(struct seq_file *s, void *p)return 0 ; } -static int ab3100_registers_open (struct inode *inode,struct file *file) -{ -return single_open (file, ab3100_registers_print, inode->i_private); -} - -static const struct file_operations ab3100_registers_fops = { - .open = ab3100_registers_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, - .owner =THIS_MODULE , -}; +DEFINE_SHOW_ATTRIBUTE (ab3100_registers);struct ab3100_get_set_reg_priv {struct ab3100 *ab3100;
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,24 +110,14 @@ 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 int __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); + &ab3100_otp_fops);if (!otp->debugfs) {dev_err (dev,"AB3100 debugfs OTP file registration failed!\n" );return -ENOENT ;
drivers/mfd/tps65010.c +2 -12
@@ -192,7 +192,7 @@ static inline void show_chgconfig(int por, const char *label, u8 chgconfig) { }#ifdef CONFIG_DEBUG_FS -static int dbg_show (struct seq_file *s,void *_) +static int debug_show (struct seq_file *s,void *_) {struct tps65010 *tps = s->private;u8 value, v2;
@@ -296,17 +296,7 @@ static int dbg_show(struct seq_file *s, void *_)return 0 ; } -static int dbg_tps_open (struct inode *inode,struct file *file) -{ -return single_open (file, dbg_show, inode->i_private); -} - -static const struct file_operations debug_fops = { - .open = dbg_tps_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE (debug);#define DEBUG_FOPS &debug_fops
Signature · 1 line
2.17.0
Quoted 8 lines · Yangtao Li
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Yangtao Li <[email protected]>--- drivers/mfd/ab3100-core.c | 15 ++------------- drivers/mfd/ab3100-otp.c | 16 +++------------- drivers/mfd/tps65010.c | 14 ++------------ 3 files changed, 7 insertions(+), 38 deletions(-)
Looks okay to me:
For my own reference:
Acked-for-MFD-by Lee Jones <[email protected]>
Linus,
Anything to add?
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 3 lines · Yangtao Li
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Yangtao Li <[email protected]>
Acked-by Linus Walleij <[email protected]>
Yours,
Linus Walleij
ping......
Quoted 1 line · Frank Lee
ping......
I've told you about this before:
"
Please don't do that.
If you think your patch has been missed, then please send it again as a [RESEND]. In this case you will need to fix the $SUBJECT line too. To see what it should look like do the following:
`git log --oneline -- drivers/mfd`
Once fixed, s/[PATCH]/[RESEND/ and resubmit it.
"
In this case the $SUBJECT line is fine, but the rest is relevant.
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog