summaryrefslogtreecommitdiffstats
path: root/drivers/uwb
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-02-14 18:08:30 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-09 09:31:26 -0800
commit092bd5c2b939e63e0e02249f7695ca828fa05049 (patch)
tree9338245e1e8d98634c6b4d90667a2d064e170506 /drivers/uwb
parent9e902c598b9253032dbc03f18a9af55fcd245a17 (diff)
downloadlinux-092bd5c2b939e63e0e02249f7695ca828fa05049.tar.bz2
uwb: Re-use DEFINE_SHOW_ATTRIBUTE() macro
...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>
Diffstat (limited to 'drivers/uwb')
-rw-r--r--drivers/uwb/uwb-debug.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/drivers/uwb/uwb-debug.c b/drivers/uwb/uwb-debug.c
index 991374b13571..f1622bae13be 100644
--- a/drivers/uwb/uwb-debug.c
+++ b/drivers/uwb/uwb-debug.c
@@ -206,7 +206,7 @@ static const struct file_operations command_fops = {
.owner = THIS_MODULE,
};
-static int reservations_print(struct seq_file *s, void *p)
+static int reservations_show(struct seq_file *s, void *p)
{
struct uwb_rc *rc = s->private;
struct uwb_rsv *rsv;
@@ -240,21 +240,9 @@ static int reservations_print(struct seq_file *s, void *p)
return 0;
}
+DEFINE_SHOW_ATTRIBUTE(reservations);
-static int reservations_open(struct inode *inode, struct file *file)
-{
- return single_open(file, reservations_print, inode->i_private);
-}
-
-static const struct file_operations reservations_fops = {
- .open = reservations_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
- .owner = THIS_MODULE,
-};
-
-static int drp_avail_print(struct seq_file *s, void *p)
+static int drp_avail_show(struct seq_file *s, void *p)
{
struct uwb_rc *rc = s->private;
@@ -264,19 +252,7 @@ static int drp_avail_print(struct seq_file *s, void *p)
return 0;
}
-
-static int drp_avail_open(struct inode *inode, struct file *file)
-{
- return single_open(file, drp_avail_print, inode->i_private);
-}
-
-static const struct file_operations drp_avail_fops = {
- .open = drp_avail_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
- .owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(drp_avail);
static void uwb_dbg_channel_changed(struct uwb_pal *pal, int channel)
{