diff mbox

[v1] mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro

Message ID 20180214154512.53739-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Shevchenko Feb. 14, 2018, 3:45 p.m. UTC
...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/mmc/core/debugfs.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

Comments

Avri Altman Feb. 18, 2018, 8:22 a.m. UTC | #1
> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
> owner@vger.kernel.org] On Behalf Of Andy Shevchenko
> Sent: Wednesday, February 14, 2018 5:45 PM
> To: Ulf Hansson <ulf.hansson@linaro.org>; Linus Walleij
> <linus.walleij@linaro.org>; linux-mmc@vger.kernel.org
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Subject: [PATCH v1] mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro
> 
> ...instead of open coding file operations followed by custom ->open()
> callbacks per each attribute.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

Looks fine.
Cheers,
Avri

> ---
>  drivers/mmc/core/debugfs.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index
> 0f4a7d7b2626..c51e0c044a3e 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -196,18 +196,7 @@ static int mmc_ios_show(struct seq_file *s, void
> *data)
> 
>  	return 0;
>  }
> -
> -static int mmc_ios_open(struct inode *inode, struct file *file) -{
> -	return single_open(file, mmc_ios_show, inode->i_private);
> -}
> -
> -static const struct file_operations mmc_ios_fops = {
> -	.open		= mmc_ios_open,
> -	.read		= seq_read,
> -	.llseek		= seq_lseek,
> -	.release	= single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(mmc_ios);
> 
>  static int mmc_clock_opt_get(void *data, u64 *val)  {
> --
> 2.15.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the
> body of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Feb. 22, 2018, 3:01 p.m. UTC | #2
On Wed, Feb 14, 2018 at 4:45 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> ...instead of open coding file operations followed by custom ->open()
> callbacks per each attribute.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Lin Feb. 22, 2018, 4:22 p.m. UTC | #3
On 2018/2/14 23:45, Andy Shevchenko wrote:
> ...instead of open coding file operations followed by custom ->open()
> callbacks per each attribute.
> 

Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/mmc/core/debugfs.c | 13 +------------
>   1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> index 0f4a7d7b2626..c51e0c044a3e 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -196,18 +196,7 @@ static int mmc_ios_show(struct seq_file *s, void *data)
>   
>   	return 0;
>   }
> -
> -static int mmc_ios_open(struct inode *inode, struct file *file)
> -{
> -	return single_open(file, mmc_ios_show, inode->i_private);
> -}
> -
> -static const struct file_operations mmc_ios_fops = {
> -	.open		= mmc_ios_open,
> -	.read		= seq_read,
> -	.llseek		= seq_lseek,
> -	.release	= single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(mmc_ios);
>   
>   static int mmc_clock_opt_get(void *data, u64 *val)
>   {
>
Ulf Hansson Feb. 27, 2018, 11:27 a.m. UTC | #4
On 14 February 2018 at 16:45, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> ...instead of open coding file operations followed by custom ->open()
> callbacks per each attribute.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/core/debugfs.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> index 0f4a7d7b2626..c51e0c044a3e 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -196,18 +196,7 @@ static int mmc_ios_show(struct seq_file *s, void *data)
>
>         return 0;
>  }
> -
> -static int mmc_ios_open(struct inode *inode, struct file *file)
> -{
> -       return single_open(file, mmc_ios_show, inode->i_private);
> -}
> -
> -static const struct file_operations mmc_ios_fops = {
> -       .open           = mmc_ios_open,
> -       .read           = seq_read,
> -       .llseek         = seq_lseek,
> -       .release        = single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(mmc_ios);
>
>  static int mmc_clock_opt_get(void *data, u64 *val)
>  {
> --
> 2.15.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 0f4a7d7b2626..c51e0c044a3e 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -196,18 +196,7 @@  static int mmc_ios_show(struct seq_file *s, void *data)
 
 	return 0;
 }
-
-static int mmc_ios_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, mmc_ios_show, inode->i_private);
-}
-
-static const struct file_operations mmc_ios_fops = {
-	.open		= mmc_ios_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(mmc_ios);
 
 static int mmc_clock_opt_get(void *data, u64 *val)
 {