Skip to contentSkip to conversation

USB: musb: Re-use DEFINE_SHOW_ATTRIBUTE() macro

PATCH Superseded Andy Shevchenko 1 participant 1 message Feb 14, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/14 USB: musb: Re-use DEFINE_SHOW_ATTRIBUTE() macro

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

---
 drivers/usb/musb/musb_debugfs.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/usb/musb/musb_debugfs.c +1 -12
index 7cf5a1bbdaff..025b2c8630df 100644
@@ -112,11 +112,7 @@ static int musb_regdump_show(struct seq_file *s, void *unused)
 	pm_runtime_put_autosuspend(musb->controller);
 	return 0;
 }
-
-static int musb_regdump_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, musb_regdump_show, inode->i_private);
-}
+DEFINE_SHOW_ATTRIBUTE(musb_regdump);
 
 static int musb_test_mode_show(struct seq_file *s, void *unused)
 {
@@ -161,13 +157,6 @@ static int musb_test_mode_show(struct seq_file *s, void *unused)
 	return 0;
 }
 
-static const struct file_operations musb_regdump_fops = {
-	.open			= musb_regdump_open,
-	.read			= seq_read,
-	.llseek			= seq_lseek,
-	.release		= single_release,
-};
-
 static int musb_test_mode_open(struct inode *inode, struct file *file)
 {
 	return single_open(file, musb_test_mode_show, inode->i_private);