power: Convert to DEFINE_SHOW_ATTRIBUTE
authorYongqiang Liu <liuyongqiang13@huawei.com>
Thu, 16 Jul 2020 08:58:49 +0000 (16:58 +0800)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Sun, 26 Jul 2020 22:05:56 +0000 (00:05 +0200)
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yongqiang Liu <liuyongqiang13@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/da9030_battery.c

index 88582423b87d40728b36df1ede0e0131989cb615..0deba48d22d31726013e8e047068e928df5a3df1 100644 (file)
@@ -172,17 +172,7 @@ static int bat_debug_show(struct seq_file *s, void *data)
        return 0;
 }
 
-static int debug_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, bat_debug_show, inode->i_private);
-}
-
-static const struct file_operations bat_debug_fops = {
-       .open           = debug_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(bat_debug);
 
 static struct dentry *da9030_bat_create_debugfs(struct da9030_charger *charger)
 {