USB: gadget: pxa25x_udc: remove dentry storage for debugfs file
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 May 2021 16:20:54 +0000 (18:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 May 2021 11:45:50 +0000 (13:45 +0200)
There is no need to store the dentry pointer for a debugfs file that we
only use to remove it when the device goes away.  debugfs can do the
lookup for us instead, saving us some trouble, and making things smaller
overall.

Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: linux-usb@vger.kernel.org
Acked-by: Daniel Mack <daniel@zonque.org>
Link: https://lore.kernel.org/r/20210518162054.3697992-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/pxa25x_udc.c
drivers/usb/gadget/udc/pxa25x_udc.h

index 10324a7334fe170ae2cd7fbd21c62ade14d75538..69ef1e669d0ca55ac448396d640fac8a4f6aed8e 100644 (file)
@@ -1338,10 +1338,10 @@ DEFINE_SHOW_ATTRIBUTE(udc_debug);
 
 #define create_debug_files(dev) \
        do { \
-               dev->debugfs_udc = debugfs_create_file(dev->gadget.name, \
+               debugfs_create_file(dev->gadget.name, \
                        S_IRUGO, NULL, dev, &udc_debug_fops); \
        } while (0)
-#define remove_debug_files(dev) debugfs_remove(dev->debugfs_udc)
+#define remove_debug_files(dev) debugfs_remove(debugfs_lookup(dev->gadget.name, NULL))
 
 #else  /* !CONFIG_USB_GADGET_DEBUG_FILES */
 
index ccc6b921f06712dbfc0524d686f3e7619a6f5316..aa4b68fd9fc0f4953181091a8243d036e85dc08c 100644 (file)
@@ -116,10 +116,6 @@ struct pxa25x_udc {
        struct usb_phy                          *transceiver;
        u64                                     dma_mask;
        struct pxa25x_ep                        ep [PXA_UDC_NUM_ENDPOINTS];
-
-#ifdef CONFIG_USB_GADGET_DEBUG_FS
-       struct dentry                           *debugfs_udc;
-#endif
        void __iomem                            *regs;
 };
 #define to_pxa25x(g)   (container_of((g), struct pxa25x_udc, gadget))