public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro
@ 2018-02-14 15:45 Andy Shevchenko
  2018-02-18  8:22 ` Avri Altman
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2018-02-14 15:45 UTC (permalink / raw)
  To: Ulf Hansson, Linus Walleij, linux-mmc; +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/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


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

* RE: [PATCH v1] mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro
  2018-02-14 15:45 [PATCH v1] mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro Andy Shevchenko
@ 2018-02-18  8:22 ` Avri Altman
  0 siblings, 0 replies; 2+ messages in thread
From: Avri Altman @ 2018-02-18  8:22 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, Linus Walleij,
	linux-mmc@vger.kernel.org



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

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

end of thread, other threads:[~2018-02-18  8:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-14 15:45 [PATCH v1] mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro Andy Shevchenko
2018-02-18  8:22 ` Avri Altman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox