diff options
author | Qinglang Miao <miaoqinglang@huawei.com> | 2020-09-19 10:52:08 +0800 |
---|---|---|
committer | Felipe Balbi <balbi@kernel.org> | 2020-10-02 09:57:39 +0300 |
commit | 5bb1d1197374aaf11523c8fd24a4e6f93fb3b343 (patch) | |
tree | 2d8126552bfe9f46d5234a6fbccb073958987a92 | |
parent | 0abe3863d05f3175866cfaea50f66dc3ee043220 (diff) | |
download | linux-5bb1d1197374aaf11523c8fd24a4e6f93fb3b343.tar.bz2 |
usb: gadget: lpc32xx_udc: Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
-rw-r--r-- | drivers/usb/gadget/udc/lpc32xx_udc.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index e8a4637a9a17..3f1c62adce4b 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -495,7 +495,7 @@ static void proc_ep_show(struct seq_file *s, struct lpc32xx_ep *ep) } } -static int proc_udc_show(struct seq_file *s, void *unused) +static int udc_show(struct seq_file *s, void *unused) { struct lpc32xx_udc *udc = s->private; struct lpc32xx_ep *ep; @@ -524,22 +524,11 @@ static int proc_udc_show(struct seq_file *s, void *unused) return 0; } -static int proc_udc_open(struct inode *inode, struct file *file) -{ - return single_open(file, proc_udc_show, PDE_DATA(inode)); -} - -static const struct file_operations proc_ops = { - .owner = THIS_MODULE, - .open = proc_udc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(udc); static void create_debug_file(struct lpc32xx_udc *udc) { - udc->pde = debugfs_create_file(debug_filename, 0, NULL, udc, &proc_ops); + udc->pde = debugfs_create_file(debug_filename, 0, NULL, udc, &udc_fops); } static void remove_debug_file(struct lpc32xx_udc *udc) |