diff mbox series

[6/6] USB: typec: tcpm: create debugfs subdir for the driver

Message ID 20210216144645.3813043-6-gregkh@linuxfoundation.org (mailing list archive)
State Accepted
Commit f88837cc27895d021f9467fe8e740a388075665c
Headers show
Series [1/6] USB: host: isp116x: remove dentry pointer for debugfs | expand

Commit Message

Greg KH Feb. 16, 2021, 2:46 p.m. UTC
The single debugfs file for this driver really is a log file, so make a
subdir and call it "log" to make it obvious this is what it is for.
This makes cleanup simpler as we just remove the whole directory, no
need to handle individual files anymore.

Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/typec/tcpm/tcpm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Guenter Roeck Feb. 16, 2021, 3:22 p.m. UTC | #1
On 2/16/21 6:46 AM, Greg Kroah-Hartman wrote:
> The single debugfs file for this driver really is a log file, so make a
> subdir and call it "log" to make it obvious this is what it is for.
> This makes cleanup simpler as we just remove the whole directory, no
> need to handle individual files anymore.
> 
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 22a85b396f69..d4dd40c95a56 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -636,8 +636,9 @@ static void tcpm_debugfs_init(struct tcpm_port *port)
>  
>  	mutex_init(&port->logbuffer_lock);
>  	snprintf(name, NAME_MAX, "tcpm-%s", dev_name(port->dev));
> -	port->dentry = debugfs_create_file(name, S_IFREG | 0444, usb_debug_root,
> -					   port, &tcpm_debug_fops);
> +	port->dentry = debugfs_create_dir(name, usb_debug_root);
> +	debugfs_create_file("log", S_IFREG | 0444, port->dentry, port,
> +			    &tcpm_debug_fops);
>  }
>  
>  static void tcpm_debugfs_exit(struct tcpm_port *port)
>
Heikki Krogerus March 1, 2021, 3:16 p.m. UTC | #2
On Tue, Feb 16, 2021 at 03:46:45PM +0100, Greg Kroah-Hartman wrote:
> The single debugfs file for this driver really is a log file, so make a
> subdir and call it "log" to make it obvious this is what it is for.
> This makes cleanup simpler as we just remove the whole directory, no
> need to handle individual files anymore.
> 
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 22a85b396f69..d4dd40c95a56 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -636,8 +636,9 @@ static void tcpm_debugfs_init(struct tcpm_port *port)
>  
>  	mutex_init(&port->logbuffer_lock);
>  	snprintf(name, NAME_MAX, "tcpm-%s", dev_name(port->dev));
> -	port->dentry = debugfs_create_file(name, S_IFREG | 0444, usb_debug_root,
> -					   port, &tcpm_debug_fops);
> +	port->dentry = debugfs_create_dir(name, usb_debug_root);
> +	debugfs_create_file("log", S_IFREG | 0444, port->dentry, port,
> +			    &tcpm_debug_fops);
>  }
>  
>  static void tcpm_debugfs_exit(struct tcpm_port *port)
> -- 
> 2.30.1
diff mbox series

Patch

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 22a85b396f69..d4dd40c95a56 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -636,8 +636,9 @@  static void tcpm_debugfs_init(struct tcpm_port *port)
 
 	mutex_init(&port->logbuffer_lock);
 	snprintf(name, NAME_MAX, "tcpm-%s", dev_name(port->dev));
-	port->dentry = debugfs_create_file(name, S_IFREG | 0444, usb_debug_root,
-					   port, &tcpm_debug_fops);
+	port->dentry = debugfs_create_dir(name, usb_debug_root);
+	debugfs_create_file("log", S_IFREG | 0444, port->dentry, port,
+			    &tcpm_debug_fops);
 }
 
 static void tcpm_debugfs_exit(struct tcpm_port *port)