pwm: convert to use DEFINE_SEQ_ATTRIBUTE macro
PATCH 1/1 pwm: convert to use DEFINE_SEQ_ATTRIBUTE macro
Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code.
Signed-off-by Liu Shixin <[email protected]>
--- drivers/pwm/core.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/pwm/core.c +3 -14
@@ -1327,30 +1327,19 @@ static int pwm_seq_show(struct seq_file *s, void *v)return 0 ; } -static const struct seq_operations pwm_seq_ops = { +static const struct seq_operations pwm_debugfs_sops = { .start = pwm_seq_start, .next = pwm_seq_next, .stop = pwm_seq_stop, .show = pwm_seq_show, }; -static int pwm_seq_open (struct inode *inode,struct file *file) -{ -return seq_open (file, &pwm_seq_ops); -} - -static const struct file_operations pwm_debugfs_ops = { - .owner =THIS_MODULE , - .open = pwm_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; +DEFINE_SEQ_ATTRIBUTE (pwm_debugfs);static int __init pwm_debugfs_init (void ) {debugfs_create_file ("pwm" ,S_IFREG |S_IRUGO ,NULL ,NULL , - &pwm_debugfs_ops); + &pwm_debugfs_fops);return 0 ; }
Signature · 1 line
2.25.1
Quoted 3 lines · Liu Shixin
Use
DEFINE_SEQ_ATTRIBUTEmacro to simplify the code.Signed-off-by Liu Shixin <[email protected]>
Looks good. I didn't test but assume it compiles and works as before.
Acked-by Uwe Kleine-König <[email protected]>
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Thierry Reding
AppliedQuoted 6 lines · Liu Shixin
Use
DEFINE_SEQ_ATTRIBUTEmacro to simplify the code.Signed-off-by Liu Shixin <[email protected]>--- drivers/pwm/core.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
Applied, thanks.
Thierry