Commit aaabe7a8 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

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

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

Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 40d2589a
...@@ -1233,8 +1233,7 @@ static const struct usb_gadget_ops pxa25x_udc_ops = { ...@@ -1233,8 +1233,7 @@ static const struct usb_gadget_ops pxa25x_udc_ops = {
#ifdef CONFIG_USB_GADGET_DEBUG_FS #ifdef CONFIG_USB_GADGET_DEBUG_FS
static int static int udc_debug_show(struct seq_file *m, void *_d)
udc_seq_show(struct seq_file *m, void *_d)
{ {
struct pxa25x_udc *dev = m->private; struct pxa25x_udc *dev = m->private;
unsigned long flags; unsigned long flags;
...@@ -1335,25 +1334,12 @@ udc_seq_show(struct seq_file *m, void *_d) ...@@ -1335,25 +1334,12 @@ udc_seq_show(struct seq_file *m, void *_d)
local_irq_restore(flags); local_irq_restore(flags);
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(udc_debug);
static int
udc_debugfs_open(struct inode *inode, struct file *file)
{
return single_open(file, udc_seq_show, inode->i_private);
}
static const struct file_operations debug_fops = {
.open = udc_debugfs_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};
#define create_debug_files(dev) \ #define create_debug_files(dev) \
do { \ do { \
dev->debugfs_udc = debugfs_create_file(dev->gadget.name, \ dev->debugfs_udc = debugfs_create_file(dev->gadget.name, \
S_IRUGO, NULL, dev, &debug_fops); \ S_IRUGO, NULL, dev, &udc_debug_fops); \
} while (0) } while (0)
#define remove_debug_files(dev) debugfs_remove(dev->debugfs_udc) #define remove_debug_files(dev) debugfs_remove(dev->debugfs_udc)
......
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