mmc: core: Re-use DEFINE_SHOW_ATTRIBUTE() macro
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 14 Feb 2018 15:45:12 +0000 (17:45 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 5 Mar 2018 12:04:28 +0000 (13:04 +0100)
...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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/debugfs.c

index 0f4a7d7..c51e0c0 100644 (file)
@@ -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)
 {