提交 40d2589a 编写于 作者: A Andy Shevchenko 提交者: Greg Kroah-Hartman

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

...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 b5c29398
...@@ -179,8 +179,7 @@ static void gr_seq_ep_show(struct seq_file *seq, struct gr_ep *ep) ...@@ -179,8 +179,7 @@ static void gr_seq_ep_show(struct seq_file *seq, struct gr_ep *ep)
seq_puts(seq, "\n"); seq_puts(seq, "\n");
} }
static int gr_dfs_show(struct seq_file *seq, void *v)
static int gr_seq_show(struct seq_file *seq, void *v)
{ {
struct gr_udc *dev = seq->private; struct gr_udc *dev = seq->private;
u32 control = gr_read32(&dev->regs->control); u32 control = gr_read32(&dev->regs->control);
...@@ -203,19 +202,7 @@ static int gr_seq_show(struct seq_file *seq, void *v) ...@@ -203,19 +202,7 @@ static int gr_seq_show(struct seq_file *seq, void *v)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(gr_dfs);
static int gr_dfs_open(struct inode *inode, struct file *file)
{
return single_open(file, gr_seq_show, inode->i_private);
}
static const struct file_operations gr_dfs_fops = {
.owner = THIS_MODULE,
.open = gr_dfs_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static void gr_dfs_create(struct gr_udc *dev) static void gr_dfs_create(struct gr_udc *dev)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册