USB: host: isp116x: remove dentry pointer for debugfs
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 1/6 USB: host: isp116x: remove dentry pointer for debugfs
There is no need to keep the dentry pointer around for the created debugfs file, as it is only needed when removing it from the system. When it is to be removed, ask debugfs itself for the pointer, to save on storage and make things a bit simpler.
--- drivers/usb/host/isp116x-hcd.c | 7 +++---- drivers/usb/host/isp116x.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/usb/host/isp116x-hcd.c +3 -4
@@ -1200,14 +1200,13 @@ DEFINE_SHOW_ATTRIBUTE(isp116x_debug);static void create_debug_file (struct isp116x *isp116x) { - isp116x->dentry =debugfs_create_file (hcd_name, -S_IRUGO ,NULL , isp116x, - &isp116x_debug_fops); +debugfs_create_file (hcd_name,S_IRUGO , usb_debug_root, isp116x, + &isp116x_debug_fops); }static void remove_debug_file (struct isp116x *isp116x) { -debugfs_remove (isp116x->dentry); +debugfs_remove (debugfs_lookup (hcd_name, usb_debug_root)); }#else
drivers/usb/host/isp116x.h +0 -1
@@ -260,7 +260,6 @@ struct isp116x {struct isp116x_platform_data *board; -struct dentry *dentry;unsigned long stat1, stat2, stat4, stat8, stat16;/* HC registers */
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 2/6 USB: host: isp1362: remove dentry pointer for debugfs
There is no need to keep the dentry pointer around for the created debugfs file, as it is only needed when removing it from the system. When it is to be removed, ask debugfs itself for the pointer, to save on storage and make things a bit simpler.
--- drivers/usb/host/isp1362-hcd.c | 8 +++----- drivers/usb/host/isp1362.h | 1 - 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/usb/host/isp1362-hcd.c +3 -5
@@ -2164,15 +2164,13 @@ DEFINE_SHOW_ATTRIBUTE(isp1362);/* expect just one isp1362_hcd per system */ static void create_debug_file (struct isp1362_hcd *isp1362_hcd) { - isp1362_hcd->debug_file =debugfs_create_file ("isp1362" ,S_IRUGO , - usb_debug_root, - isp1362_hcd, - &isp1362_fops); +debugfs_create_file ("isp1362" ,S_IRUGO , usb_debug_root, isp1362_hcd, + &isp1362_fops); }static void remove_debug_file (struct isp1362_hcd *isp1362_hcd) { -debugfs_remove (isp1362_hcd->debug_file); +debugfs_remove (debugfs_lookup ("isp1362" , usb_debug_root)); }/*-------------------------------------------------------------------------*/
drivers/usb/host/isp1362.h +0 -1
@@ -435,7 +435,6 @@ struct isp1362_hcd {struct isp1362_platform_data *board; -struct dentry *debug_file;unsigned long stat1, stat2, stat4, stat8, stat16;/* HC registers */
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 3/6 USB: host: sl811: remove dentry pointer for debugfs
In reply to Greg Kroah-HartmanThere is no need to keep the dentry pointer around for the created debugfs file, as it is only needed when removing it from the system. When it is to be removed, ask debugfs itself for the pointer, to save on storage and make things a bit simpler.
--- drivers/usb/host/sl811-hcd.c | 7 +++---- drivers/usb/host/sl811.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/usb/host/sl811-hcd.c +3 -4
@@ -1496,14 +1496,13 @@ DEFINE_SHOW_ATTRIBUTE(sl811h_debug);/* expect just one sl811 per system */ static void create_debug_file (struct sl811 *sl811) { - sl811->debug_file =debugfs_create_file ("sl811h" ,S_IRUGO , - usb_debug_root, sl811, - &sl811h_debug_fops); +debugfs_create_file ("sl811h" ,S_IRUGO , usb_debug_root, sl811, + &sl811h_debug_fops); }static void remove_debug_file (struct sl811 *sl811) { -debugfs_remove (sl811->debug_file); +debugfs_remove (debugfs_lookup ("sl811h" , usb_debug_root)); }/*-------------------------------------------------------------------------*/
drivers/usb/host/sl811.h +0 -1
@@ -123,7 +123,6 @@ struct sl811 {void __iomem *addr_reg;void __iomem *data_reg;struct sl811_platform_data *board; -struct dentry *debug_file;unsigned long stat_insrmv;unsigned long stat_wake;
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 4/6 USB: host: uhci: remove dentry pointer for debugfs
In reply to Greg Kroah-HartmanThere is no need to keep the dentry pointer around for the created debugfs file, as it is only needed when removing it from the system. When it is to be removed, ask debugfs itself for the pointer, to save on storage and make things a bit simpler.
And, no one noticed that a __maybe_unused dentry * in uhci_start() really was unused, so remove that as it's obviously not needed, and hasn't been for quite some time.
--- drivers/usb/host/uhci-hcd.c | 12 +++++------- drivers/usb/host/uhci-hcd.h | 4 ---- 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/usb/host/uhci-hcd.c +5 -7
@@ -536,7 +536,8 @@ static void release_uhci(struct uhci_hcd *uhci) uhci->is_initialized =0 ;spin_unlock_irq (&uhci->lock); -debugfs_remove (uhci->dentry); +debugfs_remove (debugfs_lookup (uhci_to_hcd (uhci)->self.bus_name, + uhci_debugfs_root));for (i =0 ; i <UHCI_NUM_SKELQH ; i++)uhci_free_qh (uhci, uhci->skelqh[i]);
@@ -577,7 +578,6 @@ static int uhci_start(struct usb_hcd *hcd)struct uhci_hcd *uhci =hcd_to_uhci (hcd);int retval = -EBUSY ;int i; -struct dentry __maybe_unused *dentry; hcd->uses_new_polling =1 ;/* Accept arbitrarily long scatter-gather lists */
@@ -590,10 +590,8 @@ static int uhci_start(struct usb_hcd *hcd)init_waitqueue_head (&uhci->waitqh);#ifdef UHCI_DEBUG_OPS - uhci->dentry =debugfs_create_file (hcd->self.bus_name, -S_IFREG |S_IRUGO |S_IWUSR , - uhci_debugfs_root, uhci, - &uhci_debug_operations); +debugfs_create_file (hcd->self.bus_name,S_IFREG |S_IRUGO |S_IWUSR , + uhci_debugfs_root, uhci, &uhci_debug_operations);#endif uhci->frame = dma_alloc_coherent(uhci_dev(uhci),
@@ -702,7 +700,7 @@ static int uhci_start(struct usb_hcd *hcd) uhci->frame, uhci->frame_dma_handle); err_alloc_frame: -debugfs_remove (uhci->dentry); +debugfs_remove (debugfs_lookup (hcd->self.bus_name, uhci_debugfs_root));return retval; }
drivers/usb/host/uhci-hcd.h +0 -4
@@ -381,10 +381,6 @@ enum uhci_rh_state {* The full UHCI controller information: */ struct uhci_hcd { - -/* debugfs */ -struct dentry *dentry; -/* Grabbed from PCI */ unsigned long io_addr;
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 5/6 USB: typec: fusb302: create debugfs subdir for the driver
In reply to Greg Kroah-HartmanThe 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.
--- drivers/usb/typec/tcpm/fusb302.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/typec/tcpm/fusb302.c +3 -2
@@ -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)
Signature · 1 line
2.30.1
Re: [PATCH 5/6] USB: typec: fusb302: create debugfs subdir for the driver
Quoted 9 lines · Greg Kroah-Hartman
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 <[email protected]>Cc Heikki Krogerus <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
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
Quoted 21 lines
--- drivers/usb/typec/tcpm/fusb302.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/usb/typec/tcpm/fusb302.c +3
-2@@ -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)
Greg Kroah-Hartman
maintainerRe: [PATCH 5/6] USB: typec: fusb302: create debugfs subdir for the driver
Quoted 11 lines · Guenter Roeck
Quoted 9 lines · Greg Kroah-Hartman
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 <[email protected]>Cc Heikki Krogerus <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 5 lines
Reviewed-by Guenter Roeck <[email protected]>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
Re: [PATCH 5/6] USB: typec: fusb302: create debugfs subdir for the driver
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
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 <[email protected]>Cc Heikki Krogerus <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 22 lines
--- drivers/usb/typec/tcpm/fusb302.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/usb/typec/tcpm/fusb302.c +3
-2@@ -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)Signature · 1 line
2.30.1
Signature · 1 line
heikki
Greg Kroah-Hartman
maintainerPATCH 6/6 USB: typec: tcpm: create debugfs subdir for the driver
In reply to Greg Kroah-HartmanThe 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.
--- drivers/usb/typec/tcpm/tcpm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +3 -2
@@ -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)
Signature · 1 line
2.30.1
Re: [PATCH 6/6] USB: typec: tcpm: create debugfs subdir for the driver
Quoted 9 lines · Greg Kroah-Hartman
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 <[email protected]>Cc Heikki Krogerus <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 21 lines
--- drivers/usb/typec/tcpm/tcpm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/usb/typec/tcpm/tcpm.c +3
-2@@ -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)
Re: [PATCH 6/6] USB: typec: tcpm: create debugfs subdir for the driver
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
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 <[email protected]>Cc Heikki Krogerus <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 22 lines
--- drivers/usb/typec/tcpm/tcpm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/usb/typec/tcpm/tcpm.c +3
-2@@ -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)Signature · 1 line
2.30.1
Signature · 1 line
heikki