* [PATCH] cpufreq: s3c24xx: Change to use DEFINE_SHOW_ATTRIBUTE macro
@ 2018-11-07 16:13 Yangtao Li
2018-11-08 4:45 ` Viresh Kumar
0 siblings, 1 reply; 3+ messages in thread
From: Yangtao Li @ 2018-11-07 16:13 UTC (permalink / raw)
To: kgene, krzk, rjw, viresh.kumar
Cc: linux-arm-kernel, linux-samsung-soc, linux-pm, linux-kernel, Yangtao Li
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
drivers/cpufreq/s3c24xx-cpufreq-debugfs.c | 46 +++--------------------
1 file changed, 6 insertions(+), 40 deletions(-)
diff --git a/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c b/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
index 4d976e8dbb2f..0df87b6480fe 100644
--- a/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
+++ b/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
@@ -63,18 +63,7 @@ static int board_show(struct seq_file *seq, void *p)
return 0;
}
-static int fops_board_open(struct inode *inode, struct file *file)
-{
- return single_open(file, board_show, NULL);
-}
-
-static const struct file_operations fops_board = {
- .open = fops_board_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
- .owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(board);
static int info_show(struct seq_file *seq, void *p)
{
@@ -105,18 +94,7 @@ static int info_show(struct seq_file *seq, void *p)
return 0;
}
-static int fops_info_open(struct inode *inode, struct file *file)
-{
- return single_open(file, info_show, NULL);
-}
-
-static const struct file_operations fops_info = {
- .open = fops_info_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
- .owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(info);
static int io_show(struct seq_file *seq, void *p)
{
@@ -162,19 +140,7 @@ static int io_show(struct seq_file *seq, void *p)
return 0;
}
-static int fops_io_open(struct inode *inode, struct file *file)
-{
- return single_open(file, io_show, NULL);
-}
-
-static const struct file_operations fops_io = {
- .open = fops_io_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
- .owner = THIS_MODULE,
-};
-
+DEFINE_SHOW_ATTRIBUTE(io);
static int __init s3c_freq_debugfs_init(void)
{
@@ -185,13 +151,13 @@ static int __init s3c_freq_debugfs_init(void)
}
dbgfs_file_io = debugfs_create_file("io-timing", S_IRUGO, dbgfs_root,
- NULL, &fops_io);
+ NULL, &io_fops);
dbgfs_file_info = debugfs_create_file("info", S_IRUGO, dbgfs_root,
- NULL, &fops_info);
+ NULL, &info_fops);
dbgfs_file_board = debugfs_create_file("board", S_IRUGO, dbgfs_root,
- NULL, &fops_board);
+ NULL, &board_fops);
return 0;
}
--
2.17.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: s3c24xx: Change to use DEFINE_SHOW_ATTRIBUTE macro
2018-11-07 16:13 [PATCH] cpufreq: s3c24xx: Change to use DEFINE_SHOW_ATTRIBUTE macro Yangtao Li
@ 2018-11-08 4:45 ` Viresh Kumar
2018-12-11 10:45 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2018-11-08 4:45 UTC (permalink / raw)
To: Yangtao Li
Cc: kgene, krzk, rjw, linux-arm-kernel, linux-samsung-soc, linux-pm,
linux-kernel
On 07-11-18, 11:13, Yangtao Li wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
> drivers/cpufreq/s3c24xx-cpufreq-debugfs.c | 46 +++--------------------
> 1 file changed, 6 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c b/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
> index 4d976e8dbb2f..0df87b6480fe 100644
> --- a/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
> +++ b/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
> @@ -63,18 +63,7 @@ static int board_show(struct seq_file *seq, void *p)
> return 0;
> }
>
> -static int fops_board_open(struct inode *inode, struct file *file)
> -{
> - return single_open(file, board_show, NULL);
> -}
> -
> -static const struct file_operations fops_board = {
> - .open = fops_board_open,
> - .read = seq_read,
> - .llseek = seq_lseek,
> - .release = single_release,
> - .owner = THIS_MODULE,
> -};
> +DEFINE_SHOW_ATTRIBUTE(board);
>
> static int info_show(struct seq_file *seq, void *p)
> {
> @@ -105,18 +94,7 @@ static int info_show(struct seq_file *seq, void *p)
> return 0;
> }
>
> -static int fops_info_open(struct inode *inode, struct file *file)
> -{
> - return single_open(file, info_show, NULL);
> -}
> -
> -static const struct file_operations fops_info = {
> - .open = fops_info_open,
> - .read = seq_read,
> - .llseek = seq_lseek,
> - .release = single_release,
> - .owner = THIS_MODULE,
> -};
> +DEFINE_SHOW_ATTRIBUTE(info);
>
> static int io_show(struct seq_file *seq, void *p)
> {
> @@ -162,19 +140,7 @@ static int io_show(struct seq_file *seq, void *p)
> return 0;
> }
>
> -static int fops_io_open(struct inode *inode, struct file *file)
> -{
> - return single_open(file, io_show, NULL);
> -}
> -
> -static const struct file_operations fops_io = {
> - .open = fops_io_open,
> - .read = seq_read,
> - .llseek = seq_lseek,
> - .release = single_release,
> - .owner = THIS_MODULE,
> -};
> -
> +DEFINE_SHOW_ATTRIBUTE(io);
>
> static int __init s3c_freq_debugfs_init(void)
> {
> @@ -185,13 +151,13 @@ static int __init s3c_freq_debugfs_init(void)
> }
>
> dbgfs_file_io = debugfs_create_file("io-timing", S_IRUGO, dbgfs_root,
> - NULL, &fops_io);
> + NULL, &io_fops);
>
> dbgfs_file_info = debugfs_create_file("info", S_IRUGO, dbgfs_root,
> - NULL, &fops_info);
> + NULL, &info_fops);
>
> dbgfs_file_board = debugfs_create_file("board", S_IRUGO, dbgfs_root,
> - NULL, &fops_board);
> + NULL, &board_fops);
>
> return 0;
> }
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: s3c24xx: Change to use DEFINE_SHOW_ATTRIBUTE macro
2018-11-08 4:45 ` Viresh Kumar
@ 2018-12-11 10:45 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2018-12-11 10:45 UTC (permalink / raw)
To: Viresh Kumar, Yangtao Li
Cc: kgene, krzk, linux-arm-kernel, linux-samsung-soc, linux-pm, linux-kernel
On Thursday, November 8, 2018 5:45:03 AM CET Viresh Kumar wrote:
> On 07-11-18, 11:13, Yangtao Li wrote:
> > Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > ---
> > drivers/cpufreq/s3c24xx-cpufreq-debugfs.c | 46 +++--------------------
> > 1 file changed, 6 insertions(+), 40 deletions(-)
> >
> > diff --git a/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c b/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
> > index 4d976e8dbb2f..0df87b6480fe 100644
> > --- a/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
> > +++ b/drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
> > @@ -63,18 +63,7 @@ static int board_show(struct seq_file *seq, void *p)
> > return 0;
> > }
> >
> > -static int fops_board_open(struct inode *inode, struct file *file)
> > -{
> > - return single_open(file, board_show, NULL);
> > -}
> > -
> > -static const struct file_operations fops_board = {
> > - .open = fops_board_open,
> > - .read = seq_read,
> > - .llseek = seq_lseek,
> > - .release = single_release,
> > - .owner = THIS_MODULE,
> > -};
> > +DEFINE_SHOW_ATTRIBUTE(board);
> >
> > static int info_show(struct seq_file *seq, void *p)
> > {
> > @@ -105,18 +94,7 @@ static int info_show(struct seq_file *seq, void *p)
> > return 0;
> > }
> >
> > -static int fops_info_open(struct inode *inode, struct file *file)
> > -{
> > - return single_open(file, info_show, NULL);
> > -}
> > -
> > -static const struct file_operations fops_info = {
> > - .open = fops_info_open,
> > - .read = seq_read,
> > - .llseek = seq_lseek,
> > - .release = single_release,
> > - .owner = THIS_MODULE,
> > -};
> > +DEFINE_SHOW_ATTRIBUTE(info);
> >
> > static int io_show(struct seq_file *seq, void *p)
> > {
> > @@ -162,19 +140,7 @@ static int io_show(struct seq_file *seq, void *p)
> > return 0;
> > }
> >
> > -static int fops_io_open(struct inode *inode, struct file *file)
> > -{
> > - return single_open(file, io_show, NULL);
> > -}
> > -
> > -static const struct file_operations fops_io = {
> > - .open = fops_io_open,
> > - .read = seq_read,
> > - .llseek = seq_lseek,
> > - .release = single_release,
> > - .owner = THIS_MODULE,
> > -};
> > -
> > +DEFINE_SHOW_ATTRIBUTE(io);
> >
> > static int __init s3c_freq_debugfs_init(void)
> > {
> > @@ -185,13 +151,13 @@ static int __init s3c_freq_debugfs_init(void)
> > }
> >
> > dbgfs_file_io = debugfs_create_file("io-timing", S_IRUGO, dbgfs_root,
> > - NULL, &fops_io);
> > + NULL, &io_fops);
> >
> > dbgfs_file_info = debugfs_create_file("info", S_IRUGO, dbgfs_root,
> > - NULL, &fops_info);
> > + NULL, &info_fops);
> >
> > dbgfs_file_board = debugfs_create_file("board", S_IRUGO, dbgfs_root,
> > - NULL, &fops_board);
> > + NULL, &board_fops);
> >
> > return 0;
> > }
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Patch applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-11 10:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 16:13 [PATCH] cpufreq: s3c24xx: Change to use DEFINE_SHOW_ATTRIBUTE macro Yangtao Li
2018-11-08 4:45 ` Viresh Kumar
2018-12-11 10:45 ` Rafael J. Wysocki
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).