LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: gdm724x: get lock before calling usb_[disable|enable]_autosuspend()
@ 2021-08-02 22:37 Salah Triki
  2021-08-03  5:16 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Salah Triki @ 2021-08-02 22:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Dan Carpenter, Amey Narkhede
  Cc: linux-staging, linux-kernel

Based on the documentation of usb_[disable|enable]_autosuspend(), the
caller must hold udev's device lock.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/staging/gdm724x/gdm_usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
index 54bdb64f52e8..31b3b3e563c8 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -846,7 +846,9 @@ static int gdm_usb_probe(struct usb_interface *intf,
 	udev->intf = intf;
 
 	intf->needs_remote_wakeup = 1;
+	usb_lock_device(usbdev);
 	usb_enable_autosuspend(usbdev);
+	usb_unlock_device(usbdev);
 	pm_runtime_set_autosuspend_delay(&usbdev->dev, AUTO_SUSPEND_TIMER);
 
 	/* List up hosts with big endians, otherwise,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: gdm724x: get lock before calling usb_[disable|enable]_autosuspend()
  2021-08-02 22:37 [PATCH] staging: gdm724x: get lock before calling usb_[disable|enable]_autosuspend() Salah Triki
@ 2021-08-03  5:16 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2021-08-03  5:16 UTC (permalink / raw)
  To: Salah Triki; +Cc: Dan Carpenter, Amey Narkhede, linux-staging, linux-kernel

On Mon, Aug 02, 2021 at 11:37:03PM +0100, Salah Triki wrote:
> Based on the documentation of usb_[disable|enable]_autosuspend(), the
> caller must hold udev's device lock.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  drivers/staging/gdm724x/gdm_usb.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
> index 54bdb64f52e8..31b3b3e563c8 100644
> --- a/drivers/staging/gdm724x/gdm_usb.c
> +++ b/drivers/staging/gdm724x/gdm_usb.c
> @@ -846,7 +846,9 @@ static int gdm_usb_probe(struct usb_interface *intf,
>  	udev->intf = intf;
>  
>  	intf->needs_remote_wakeup = 1;
> +	usb_lock_device(usbdev);
>  	usb_enable_autosuspend(usbdev);
> +	usb_unlock_device(usbdev);
>  	pm_runtime_set_autosuspend_delay(&usbdev->dev, AUTO_SUSPEND_TIMER);
>  
>  	/* List up hosts with big endians, otherwise,
> -- 
> 2.25.1

Please look at the other places where this function is called and note
that the pattern you have added here is not used in those situations
either, so perhaps this change is not correct at all.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-03  5:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 22:37 [PATCH] staging: gdm724x: get lock before calling usb_[disable|enable]_autosuspend() Salah Triki
2021-08-03  5:16 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).