diff mbox series

USB: gadget: lpc32xx_udc: remove debugfs dentry variable

Message ID 20210518162035.3697860-1-gregkh@linuxfoundation.org (mailing list archive)
State Accepted
Commit e3d59eff47b8cc385acae9d7fb1c787857023376
Headers show
Series USB: gadget: lpc32xx_udc: remove debugfs dentry variable | expand

Commit Message

Greg KH May 18, 2021, 4:20 p.m. UTC
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...

Cc: Felipe Balbi <balbi@kernel.org>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/gadget/udc/lpc32xx_udc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Vladimir Zapolskiy May 19, 2021, 11:09 a.m. UTC | #1
On 5/18/21 7:20 PM, Greg Kroah-Hartman wrote:
> 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.

> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: Vladimir Zapolskiy <vz@mleia.com>
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Vladimir Zapolskiy <vz@mleia.com>

Thank you.

--
Best wishes,
Vladimir
Felipe Balbi May 19, 2021, 12:05 p.m. UTC | #2
Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:

> 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...
>
> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: Vladimir Zapolskiy <vz@mleia.com>
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Felipe Balbi <balbi@kernel.org>
Greg KH May 21, 2021, 11:45 a.m. UTC | #3
On Wed, May 19, 2021 at 02:09:17PM +0300, Vladimir Zapolskiy wrote:
> On 5/18/21 7:20 PM, Greg Kroah-Hartman wrote:
> > 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.

Not a big deal :)

> > Cc: Felipe Balbi <balbi@kernel.org>
> > Cc: Vladimir Zapolskiy <vz@mleia.com>
> > Cc: linux-usb@vger.kernel.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Acked-by: Vladimir Zapolskiy <vz@mleia.com>

Thanks for the review!

greg k-h
Greg KH May 21, 2021, 11:45 a.m. UTC | #4
On Wed, May 19, 2021 at 03:05:18PM +0300, Felipe Balbi wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> 
> > 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...
> >
> > Cc: Felipe Balbi <balbi@kernel.org>
> > Cc: Vladimir Zapolskiy <vz@mleia.com>
> > Cc: linux-usb@vger.kernel.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Acked-by: Felipe Balbi <balbi@kernel.org>

Great, thanks for the review.

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
index 3f1c62adce4b..a25d01c89564 100644
--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
+++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
@@ -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