summaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec/tcpm.c
diff options
context:
space:
mode:
authorAndy Shevchenko2018-02-14 17:08:29 +0100
committerGreg Kroah-Hartman2018-03-09 18:31:26 +0100
commit9e902c598b9253032dbc03f18a9af55fcd245a17 (patch)
treebba3424b9042a6a242c71b96a969c5c3b1b154b2 /drivers/usb/typec/tcpm.c
parentUSB: host: whci: Re-use DEFINE_SHOW_ATTRIBUTE() macro (diff)
downloadkernel-qcow2-linux-9e902c598b9253032dbc03f18a9af55fcd245a17.tar.gz
kernel-qcow2-linux-9e902c598b9253032dbc03f18a9af55fcd245a17.tar.xz
kernel-qcow2-linux-9e902c598b9253032dbc03f18a9af55fcd245a17.zip
USB: typec: 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> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/tcpm.c')
-rw-r--r--drivers/usb/typec/tcpm.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index f4d563ee7690..a163ba55b061 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -506,7 +506,7 @@ static void tcpm_log_source_caps(struct tcpm_port *port)
}
}
-static int tcpm_seq_show(struct seq_file *s, void *v)
+static int tcpm_debug_show(struct seq_file *s, void *v)
{
struct tcpm_port *port = (struct tcpm_port *)s->private;
int tail;
@@ -523,18 +523,7 @@ static int tcpm_seq_show(struct seq_file *s, void *v)
return 0;
}
-
-static int tcpm_debug_open(struct inode *inode, struct file *file)
-{
- return single_open(file, tcpm_seq_show, inode->i_private);
-}
-
-static const struct file_operations tcpm_debug_operations = {
- .open = tcpm_debug_open,
- .llseek = seq_lseek,
- .read = seq_read,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(tcpm_debug);
static struct dentry *rootdir;
@@ -550,7 +539,7 @@ static int tcpm_debugfs_init(struct tcpm_port *port)
port->dentry = debugfs_create_file(dev_name(port->dev),
S_IFREG | 0444, rootdir,
- port, &tcpm_debug_operations);
+ port, &tcpm_debug_fops);
return 0;
}