Skip to contentSkip to conversation

USB: gadget: lpc32xx_udc: remove debugfs dentry variable

PATCH In review Greg Kroah-Hartman 3 participants 5 messages May 18, 2021 – May 21, 2021

Subsystems (2)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/1 USB: gadget: lpc32xx_udc: remove debugfs dentry variable

There is no need to store the dentry for a fixed filename that we have the string for. So just have debugfs look it up when we need it to remove the file, no need to store it anywhere locally.

Note, this driver is broken in that debugfs will not work for more than one instance of the device it supports. But given that this patch does not change that, and no one has ever seemed to notice, it must not be an issue...

---
 drivers/usb/gadget/udc/lpc32xx_udc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/gadget/udc/lpc32xx_udc.c +2 -3
index 3f1c62adce4b..a25d01c89564 100644
@@ -127,7 +127,6 @@ struct lpc32xx_udc {
 	struct usb_gadget_driver *driver;
 	struct platform_device	*pdev;
 	struct device		*dev;
-	struct dentry		*pde;
 	spinlock_t		lock;
 	struct i2c_client	*isp1301_i2c_client;
 
@@ -528,12 +527,12 @@ DEFINE_SHOW_ATTRIBUTE(udc);
 
 static void create_debug_file(struct lpc32xx_udc *udc)
 {
-	udc->pde = debugfs_create_file(debug_filename, 0, NULL, udc, &udc_fops);
+	debugfs_create_file(debug_filename, 0, NULL, udc, &udc_fops);
 }
 
 static void remove_debug_file(struct lpc32xx_udc *udc)
 {
-	debugfs_remove(udc->pde);
+	debugfs_remove(debugfs_lookup(debug_filename, NULL));
 }
 
 #else
Signature · 1 line
2.31.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Greg Kroah-Hartman

There is no need to store the dentry for a fixed filename that we have the string for. So just have debugfs look it up when we need it to remove the file, no need to store it anywhere locally.

Note, this driver is broken in that debugfs will not work for more than one instance of the device it supports. But given that this patch does not change that, and no one has ever seemed to notice, it must not be an issue...

Yep, there is only one SoC with this device, and it has only one instance of this UDC. Bad excuse, I know it.

Quoted 4 lines

Thank you.

--
Best wishes,
Vladimir

author maintainer
#2 lore raw
Quoted 5 lines · Vladimir Zapolskiy
Quoted 4 lines · Greg Kroah-Hartman

There is no need to store the dentry for a fixed filename that we have the string for. So just have debugfs look it up when we need it to remove the file, no need to store it anywhere locally.

Quoted 7 lines
Quoted 4 lines

Note, this driver is broken in that debugfs will not work for more than one instance of the device it supports. But given that this patch does not change that, and no one has ever seemed to notice, it must not be an issue...

Yep, there is only one SoC with this device, and it has only one instance of this UDC. Bad excuse, I know it.

Not a big deal :)

Quoted 6 lines
Quoted 4 lines

Thanks for the review!

greg k-h

Acked-by on v1 1/1
#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

There is no need to store the dentry for a fixed filename that we have the string for. So just have debugfs look it up when we need it to remove the file, no need to store it anywhere locally.

Note, this driver is broken in that debugfs will not work for more than one instance of the device it supports. But given that this patch does not change that, and no one has ever seemed to notice, it must not be an issue...

Quoted 4 lines
Signature · 1 line
balbi
author maintainer
#4 lore raw
Quoted 11 lines · Felipe Balbi
Quoted 9 lines · Greg Kroah-Hartman

There is no need to store the dentry for a fixed filename that we have the string for. So just have debugfs look it up when we need it to remove the file, no need to store it anywhere locally.

Note, this driver is broken in that debugfs will not work for more than one instance of the device it supports. But given that this patch does not change that, and no one has ever seemed to notice, it must not be an issue...

Quoted 6 lines
Quoted 4 lines

Great, thanks for the review.

greg k-h