Commit 8802559e authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Felipe Balbi

USB: gadget: bcm63xx: Re-use DEFINE_SHOW_ATTRIBUTE() macro

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

Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent ec082f70
...@@ -2158,6 +2158,7 @@ static int bcm63xx_usbd_dbg_show(struct seq_file *s, void *p) ...@@ -2158,6 +2158,7 @@ static int bcm63xx_usbd_dbg_show(struct seq_file *s, void *p)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(bcm63xx_usbd_dbg);
/* /*
* bcm63xx_iudma_dbg_show - Show IUDMA status and descriptors. * bcm63xx_iudma_dbg_show - Show IUDMA status and descriptors.
...@@ -2238,33 +2239,7 @@ static int bcm63xx_iudma_dbg_show(struct seq_file *s, void *p) ...@@ -2238,33 +2239,7 @@ static int bcm63xx_iudma_dbg_show(struct seq_file *s, void *p)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(bcm63xx_iudma_dbg);
static int bcm63xx_usbd_dbg_open(struct inode *inode, struct file *file)
{
return single_open(file, bcm63xx_usbd_dbg_show, inode->i_private);
}
static int bcm63xx_iudma_dbg_open(struct inode *inode, struct file *file)
{
return single_open(file, bcm63xx_iudma_dbg_show, inode->i_private);
}
static const struct file_operations usbd_dbg_fops = {
.owner = THIS_MODULE,
.open = bcm63xx_usbd_dbg_open,
.llseek = seq_lseek,
.read = seq_read,
.release = single_release,
};
static const struct file_operations iudma_dbg_fops = {
.owner = THIS_MODULE,
.open = bcm63xx_iudma_dbg_open,
.llseek = seq_lseek,
.read = seq_read,
.release = single_release,
};
/** /**
* bcm63xx_udc_init_debugfs - Create debugfs entries. * bcm63xx_udc_init_debugfs - Create debugfs entries.
...@@ -2282,11 +2257,11 @@ static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc *udc) ...@@ -2282,11 +2257,11 @@ static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc *udc)
goto err_root; goto err_root;
usbd = debugfs_create_file("usbd", 0400, root, udc, usbd = debugfs_create_file("usbd", 0400, root, udc,
&usbd_dbg_fops); &bcm63xx_usbd_dbg_fops);
if (!usbd) if (!usbd)
goto err_usbd; goto err_usbd;
iudma = debugfs_create_file("iudma", 0400, root, udc, iudma = debugfs_create_file("iudma", 0400, root, udc,
&iudma_dbg_fops); &bcm63xx_iudma_dbg_fops);
if (!iudma) if (!iudma)
goto err_iudma; goto err_iudma;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment