Skip to contentSkip to conversation

mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro

PATCH In review Andy Shevchenko 2 participants 2 messages Feb 14, 2018 – Feb 18, 2018 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro

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

---
 drivers/mmc/core/debugfs.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/mmc/core/debugfs.c +1 -12
index 0f4a7d7b2626..c51e0c044a3e 100644
@@ -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)
 {
Signature · 1 line
2.15.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: [email protected] [mailto:linux-mmc- [email protected]] On Behalf Of Andy Shevchenko
Sent: Wednesday, February 14, 2018 5:45 PM
To: Ulf Hansson <[email protected]>; Linus Walleij <[email protected]>; [email protected]
Cc: Andy Shevchenko <[email protected]>
Subject: [PATCH v1] mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro

Quoted 4 lines

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

Looks fine.
Cheers,
Avri

Quoted 34 lines
---
 drivers/mmc/core/debugfs.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/mmc/core/debugfs.c index renamed from drivers/mmc/core/debugfs.c +0 -0

0f4a7d7b2626..c51e0c044a3e 100644

drivers/mmc/core/debugfs.c +1 -12
@@ -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 [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html