Skip to content

Commit

Permalink
USB: host: fhci: 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 35a7e0a commit 513f675
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions drivers/usb/host/fhci-dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static int fhci_dfs_regs_show(struct seq_file *s, void *v)

return 0;
}
DEFINE_SHOW_ATTRIBUTE(fhci_dfs_regs);

static int fhci_dfs_irq_stat_show(struct seq_file *s, void *v)
{
Expand All @@ -75,30 +76,7 @@ static int fhci_dfs_irq_stat_show(struct seq_file *s, void *v)

return 0;
}

static int fhci_dfs_regs_open(struct inode *inode, struct file *file)
{
return single_open(file, fhci_dfs_regs_show, inode->i_private);
}

static int fhci_dfs_irq_stat_open(struct inode *inode, struct file *file)
{
return single_open(file, fhci_dfs_irq_stat_show, inode->i_private);
}

static const struct file_operations fhci_dfs_regs_fops = {
.open = fhci_dfs_regs_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};

static const struct file_operations fhci_dfs_irq_stat_fops = {
.open = fhci_dfs_irq_stat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(fhci_dfs_irq_stat);

void fhci_dfs_create(struct fhci_hcd *fhci)
{
Expand Down

0 comments on commit 513f675

Please sign in to comment.