Skip to contentSkip to conversation

USB: gadget: s3c2410_udc: remove dentry storage for debugfs file

PATCH In review Greg Kroah-Hartman 2 participants 2 messages May 18, 2021 – Jun 3, 2021 USB

lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/1 USB: gadget: s3c2410_udc: remove dentry storage for debugfs file

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.

---
 drivers/usb/gadget/udc/s3c2410_udc.c | 7 +++----
 drivers/usb/gadget/udc/s3c2410_udc.h | 1 -
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/s3c2410_udc.c +3 -4
index b154b62abefa..5e453ebb2643 100644
@@ -1843,9 +1843,8 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
 	if (retval)
 		goto err_add_udc;
 
-	udc->regs_info = debugfs_create_file("registers", S_IRUGO,
-					     s3c2410_udc_debugfs_root, udc,
-					     &s3c2410_udc_debugfs_fops);
+	debugfs_create_file("registers", S_IRUGO, s3c2410_udc_debugfs_root, udc,
+			    &s3c2410_udc_debugfs_fops);
 
 	dev_dbg(dev, "probe ok\n");
 
@@ -1889,7 +1888,7 @@ static int s3c2410_udc_remove(struct platform_device *pdev)
 		return -EBUSY;
 
 	usb_del_gadget_udc(&udc->gadget);
-	debugfs_remove(udc->regs_info);
+	debugfs_remove(debugfs_lookup("registers", s3c2410_udc_debugfs_root));
 
 	if (udc_info && !udc_info->udc_command &&
 		gpio_is_valid(udc_info->pullup_pin))
drivers/usb/gadget/udc/s3c2410_udc.h +0 -1
index 68bdf3e5aac2..135a5bff3c74 100644
@@ -89,7 +89,6 @@ struct s3c2410_udc {
 	unsigned			req_config : 1;
 	unsigned			req_pending : 1;
 	u8				vbus;
-	struct dentry			*regs_info;
 	int				irq;
 };
 #define to_s3c2410(g)	(container_of((g), struct s3c2410_udc, gadget))
Signature · 1 line
2.31.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Greg Kroah-Hartman

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.

Signature · 1 line
balbi