Skip to content

Commit

Permalink
USB: gadget: gr: Re-use DEFINE_SHOW_ATTRIBUTE() macro
Browse files Browse the repository at this point in the history
...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Andy Shevchenko authored and Greg Kroah-Hartman committed Mar 9, 2018
1 parent b5c2939 commit 40d2589
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions drivers/usb/gadget/udc/gr_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ static void gr_seq_ep_show(struct seq_file *seq, struct gr_ep *ep)
seq_puts(seq, "\n");
}


static int gr_seq_show(struct seq_file *seq, void *v)
static int gr_dfs_show(struct seq_file *seq, void *v)
{
struct gr_udc *dev = seq->private;
u32 control = gr_read32(&dev->regs->control);
Expand All @@ -203,19 +202,7 @@ static int gr_seq_show(struct seq_file *seq, void *v)

return 0;
}

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,
};
DEFINE_SHOW_ATTRIBUTE(gr_dfs);

static void gr_dfs_create(struct gr_udc *dev)
{
Expand Down

0 comments on commit 40d2589

Please sign in to comment.