Message ID | 20210216144645.3813043-5-gregkh@linuxfoundation.org (mailing list archive) |
---|---|
State | Accepted |
Commit | b43fba1b7b4c6e0500dd61d5a28bf32b5de1537a |
Headers | show |
Series | [1/6] USB: host: isp116x: remove dentry pointer for debugfs | expand |
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> I'd probably have explored the possibility to group files like this under the newly created tcpm debugfs directory, but that is really a nitpick. Guenter > --- > drivers/usb/typec/tcpm/fusb302.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c > index ebc46b9f776c..7a2a17866a82 100644 > --- a/drivers/usb/typec/tcpm/fusb302.c > +++ b/drivers/usb/typec/tcpm/fusb302.c > @@ -213,8 +213,9 @@ static void fusb302_debugfs_init(struct fusb302_chip *chip) > > mutex_init(&chip->logbuffer_lock); > snprintf(name, NAME_MAX, "fusb302-%s", dev_name(chip->dev)); > - chip->dentry = debugfs_create_file(name, S_IFREG | 0444, usb_debug_root, > - chip, &fusb302_debug_fops); > + chip->dentry = debugfs_create_dir(name, usb_debug_root); > + debugfs_create_file("log", S_IFREG | 0444, chip->dentry, chip, > + &fusb302_debug_fops); > } > > static void fusb302_debugfs_exit(struct fusb302_chip *chip) >
On Tue, Feb 16, 2021 at 03:46:44PM +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/fusb302.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c > index ebc46b9f776c..7a2a17866a82 100644 > --- a/drivers/usb/typec/tcpm/fusb302.c > +++ b/drivers/usb/typec/tcpm/fusb302.c > @@ -213,8 +213,9 @@ static void fusb302_debugfs_init(struct fusb302_chip *chip) > > mutex_init(&chip->logbuffer_lock); > snprintf(name, NAME_MAX, "fusb302-%s", dev_name(chip->dev)); > - chip->dentry = debugfs_create_file(name, S_IFREG | 0444, usb_debug_root, > - chip, &fusb302_debug_fops); > + chip->dentry = debugfs_create_dir(name, usb_debug_root); > + debugfs_create_file("log", S_IFREG | 0444, chip->dentry, chip, > + &fusb302_debug_fops); > } > > static void fusb302_debugfs_exit(struct fusb302_chip *chip) > -- > 2.30.1
On Tue, Feb 16, 2021 at 07:24:14AM -0800, Guenter Roeck wrote: > 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> > > I'd probably have explored the possibility to group files like this > under the newly created tcpm debugfs directory, but that is really > a nitpick. Good idea, I'll look into doing that next... thanks, greg k-h
diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c index ebc46b9f776c..7a2a17866a82 100644 --- a/drivers/usb/typec/tcpm/fusb302.c +++ b/drivers/usb/typec/tcpm/fusb302.c @@ -213,8 +213,9 @@ static void fusb302_debugfs_init(struct fusb302_chip *chip) mutex_init(&chip->logbuffer_lock); snprintf(name, NAME_MAX, "fusb302-%s", dev_name(chip->dev)); - chip->dentry = debugfs_create_file(name, S_IFREG | 0444, usb_debug_root, - chip, &fusb302_debug_fops); + chip->dentry = debugfs_create_dir(name, usb_debug_root); + debugfs_create_file("log", S_IFREG | 0444, chip->dentry, chip, + &fusb302_debug_fops); } static void fusb302_debugfs_exit(struct fusb302_chip *chip)
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/fusb302.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)