Commit 5bb1d119 authored by Qinglang Miao's avatar Qinglang Miao Committed by Felipe Balbi

usb: gadget: lpc32xx_udc: Convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Acked-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent 0abe3863
...@@ -495,7 +495,7 @@ static void proc_ep_show(struct seq_file *s, struct lpc32xx_ep *ep) ...@@ -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_udc *udc = s->private;
struct lpc32xx_ep *ep; struct lpc32xx_ep *ep;
...@@ -524,22 +524,11 @@ static int proc_udc_show(struct seq_file *s, void *unused) ...@@ -524,22 +524,11 @@ static int proc_udc_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int proc_udc_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(udc);
{
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,
};
static void create_debug_file(struct lpc32xx_udc *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) static void remove_debug_file(struct lpc32xx_udc *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