USB: host: uhci: remove dentry pointer for debugfs
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Feb 2021 14:46:43 +0000 (15:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Mar 2021 08:37:15 +0000 (09:37 +0100)
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.

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.

Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
Link: https://lore.kernel.org/r/20210216144645.3813043-4-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/uhci-hcd.c
drivers/usb/host/uhci-hcd.h

index 03bc59755123fda5177c29a3a66a02d450fcc114..d90b869f5f409a801e3cab39304fd09219aaa6e8 100644 (file)
@@ -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 @@ err_alloc_frame_cpu:
                        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;
 }
index 7f9f33c8c232413d5e85a01e29b3de4ec5151b9a..8ae5ccd26753b34d3c38823cc45840a4e8b9897b 100644 (file)
@@ -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;