Skip to content

Commit 0367e23

Browse files
TinyWindzzsre
authored andcommitted
power: supply: axp288_fuel_gauge: Change to use DEFINE_SHOW_ATTRIBUTE macro
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent f5d782d commit 0367e23

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

drivers/power/supply/axp288_fuel_gauge.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -307,22 +307,12 @@ static int fuel_gauge_debug_show(struct seq_file *s, void *data)
307307
return 0;
308308
}
309309

310-
static int debug_open(struct inode *inode, struct file *file)
311-
{
312-
return single_open(file, fuel_gauge_debug_show, inode->i_private);
313-
}
314-
315-
static const struct file_operations fg_debug_fops = {
316-
.open = debug_open,
317-
.read = seq_read,
318-
.llseek = seq_lseek,
319-
.release = single_release,
320-
};
310+
DEFINE_SHOW_ATTRIBUTE(fuel_gauge_debug);
321311

322312
static void fuel_gauge_create_debugfs(struct axp288_fg_info *info)
323313
{
324314
info->debug_file = debugfs_create_file("fuelgauge", 0666, NULL,
325-
info, &fg_debug_fops);
315+
info, &fuel_gauge_debug_fops);
326316
}
327317

328318
static void fuel_gauge_remove_debugfs(struct axp288_fg_info *info)

0 commit comments

Comments
 (0)