linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] clk: Re-use DEFINE_SHOW_ATTRIBUTE() macro
@ 2018-02-14 15:48 Andy Shevchenko
  2018-03-16 14:19 ` Andy Shevchenko
  2018-03-19 17:53 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2018-02-14 15:48 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, linux-clk; +Cc: Andy Shevchenko

...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/clk/clk.c | 60 +++++++------------------------------------------------
 1 file changed, 7 insertions(+), 53 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 0f686a9dac3e..cc97b18ac31f 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2486,19 +2486,7 @@ static int clk_summary_show(struct seq_file *s, void *data)
 
 	return 0;
 }
-
-
-static int clk_summary_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, clk_summary_show, inode->i_private);
-}
-
-static const struct file_operations clk_summary_fops = {
-	.open		= clk_summary_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(clk_summary);
 
 static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level)
 {
@@ -2532,7 +2520,7 @@ static void clk_dump_subtree(struct seq_file *s, struct clk_core *c, int level)
 	seq_putc(s, '}');
 }
 
-static int clk_dump(struct seq_file *s, void *data)
+static int clk_dump_show(struct seq_file *s, void *data)
 {
 	struct clk_core *c;
 	bool first_node = true;
@@ -2555,19 +2543,7 @@ static int clk_dump(struct seq_file *s, void *data)
 	seq_puts(s, "}\n");
 	return 0;
 }
-
-
-static int clk_dump_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, clk_dump, inode->i_private);
-}
-
-static const struct file_operations clk_dump_fops = {
-	.open		= clk_dump_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(clk_dump);
 
 static const struct {
 	unsigned long flag;
@@ -2589,7 +2565,7 @@ static const struct {
 #undef ENTRY
 };
 
-static int clk_flags_dump(struct seq_file *s, void *data)
+static int clk_flags_show(struct seq_file *s, void *data)
 {
 	struct clk_core *core = s->private;
 	unsigned long flags = core->flags;
@@ -2608,20 +2584,9 @@ static int clk_flags_dump(struct seq_file *s, void *data)
 
 	return 0;
 }
+DEFINE_SHOW_ATTRIBUTE(clk_flags);
 
-static int clk_flags_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, clk_flags_dump, inode->i_private);
-}
-
-static const struct file_operations clk_flags_fops = {
-	.open		= clk_flags_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
-static int possible_parents_dump(struct seq_file *s, void *data)
+static int possible_parents_show(struct seq_file *s, void *data)
 {
 	struct clk_core *core = s->private;
 	int i;
@@ -2633,18 +2598,7 @@ static int possible_parents_dump(struct seq_file *s, void *data)
 
 	return 0;
 }
-
-static int possible_parents_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, possible_parents_dump, inode->i_private);
-}
-
-static const struct file_operations possible_parents_fops = {
-	.open		= possible_parents_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(possible_parents);
 
 static int clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
 {
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] clk: Re-use DEFINE_SHOW_ATTRIBUTE() macro
  2018-02-14 15:48 [PATCH v1] clk: Re-use DEFINE_SHOW_ATTRIBUTE() macro Andy Shevchenko
@ 2018-03-16 14:19 ` Andy Shevchenko
  2018-03-19 17:53 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2018-03-16 14:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, linux-clk

On Wed, 2018-02-14 at 17:48 +0200, Andy Shevchenko wrote:
> ...instead of open coding file operations followed by custom ->open()
> callbacks per each attribute.
> 

Any comments so far?

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/clk/clk.c | 60 +++++++---------------------------------------
> ---------
>  1 file changed, 7 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 0f686a9dac3e..cc97b18ac31f 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -2486,19 +2486,7 @@ static int clk_summary_show(struct seq_file *s,
> void *data)
>  
>  	return 0;
>  }
> -
> -
> -static int clk_summary_open(struct inode *inode, struct file *file)
> -{
> -	return single_open(file, clk_summary_show, inode->i_private);
> -}
> -
> -static const struct file_operations clk_summary_fops = {
> -	.open		= clk_summary_open,
> -	.read		= seq_read,
> -	.llseek		= seq_lseek,
> -	.release	= single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(clk_summary);
>  
>  static void clk_dump_one(struct seq_file *s, struct clk_core *c, int
> level)
>  {
> @@ -2532,7 +2520,7 @@ static void clk_dump_subtree(struct seq_file *s,
> struct clk_core *c, int level)
>  	seq_putc(s, '}');
>  }
>  
> -static int clk_dump(struct seq_file *s, void *data)
> +static int clk_dump_show(struct seq_file *s, void *data)
>  {
>  	struct clk_core *c;
>  	bool first_node = true;
> @@ -2555,19 +2543,7 @@ static int clk_dump(struct seq_file *s, void
> *data)
>  	seq_puts(s, "}\n");
>  	return 0;
>  }
> -
> -
> -static int clk_dump_open(struct inode *inode, struct file *file)
> -{
> -	return single_open(file, clk_dump, inode->i_private);
> -}
> -
> -static const struct file_operations clk_dump_fops = {
> -	.open		= clk_dump_open,
> -	.read		= seq_read,
> -	.llseek		= seq_lseek,
> -	.release	= single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(clk_dump);
>  
>  static const struct {
>  	unsigned long flag;
> @@ -2589,7 +2565,7 @@ static const struct {
>  #undef ENTRY
>  };
>  
> -static int clk_flags_dump(struct seq_file *s, void *data)
> +static int clk_flags_show(struct seq_file *s, void *data)
>  {
>  	struct clk_core *core = s->private;
>  	unsigned long flags = core->flags;
> @@ -2608,20 +2584,9 @@ static int clk_flags_dump(struct seq_file *s,
> void *data)
>  
>  	return 0;
>  }
> +DEFINE_SHOW_ATTRIBUTE(clk_flags);
>  
> -static int clk_flags_open(struct inode *inode, struct file *file)
> -{
> -	return single_open(file, clk_flags_dump, inode->i_private);
> -}
> -
> -static const struct file_operations clk_flags_fops = {
> -	.open		= clk_flags_open,
> -	.read		= seq_read,
> -	.llseek		= seq_lseek,
> -	.release	= single_release,
> -};
> -
> -static int possible_parents_dump(struct seq_file *s, void *data)
> +static int possible_parents_show(struct seq_file *s, void *data)
>  {
>  	struct clk_core *core = s->private;
>  	int i;
> @@ -2633,18 +2598,7 @@ static int possible_parents_dump(struct
> seq_file *s, void *data)
>  
>  	return 0;
>  }
> -
> -static int possible_parents_open(struct inode *inode, struct file
> *file)
> -{
> -	return single_open(file, possible_parents_dump, inode-
> >i_private);
> -}
> -
> -static const struct file_operations possible_parents_fops = {
> -	.open		= possible_parents_open,
> -	.read		= seq_read,
> -	.llseek		= seq_lseek,
> -	.release	= single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(possible_parents);
>  
>  static int clk_debug_create_one(struct clk_core *core, struct dentry
> *pdentry)
>  {

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] clk: Re-use DEFINE_SHOW_ATTRIBUTE() macro
  2018-02-14 15:48 [PATCH v1] clk: Re-use DEFINE_SHOW_ATTRIBUTE() macro Andy Shevchenko
  2018-03-16 14:19 ` Andy Shevchenko
@ 2018-03-19 17:53 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2018-03-19 17:53 UTC (permalink / raw)
  To: Andy Shevchenko, Michael Turquette, linux-clk; +Cc: Andy Shevchenko

Quoting Andy Shevchenko (2018-02-14 07:48:00)
> ...instead of open coding file operations followed by custom ->open()
> callbacks per each attribute.
> =

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-19 17:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-14 15:48 [PATCH v1] clk: Re-use DEFINE_SHOW_ATTRIBUTE() macro Andy Shevchenko
2018-03-16 14:19 ` Andy Shevchenko
2018-03-19 17:53 ` Stephen Boyd

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).