public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: hub:no need to obtain usb device
@ 2024-06-25 16:46 Lizhe
  2024-06-25 16:52 ` Alan Stern
  2024-06-25 17:50 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Lizhe @ 2024-06-25 16:46 UTC (permalink / raw)
  To: gregkh, stern, hgajjar, stanley_chang, ricardo.canuelo,
	johan+linaro
  Cc: linux-usb, linux-kernel, Lizhe

the usb device connected to the port has obtained.
there is no need to obtain it again.

Signed-off-by: Lizhe <sensor1010@163.com>
---
 drivers/usb/core/hub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 4b93c0bd1d4b..f37b991fa86a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -5358,7 +5358,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
 	if (udev) {
 		if (hcd->usb_phy && !hdev->parent)
 			usb_phy_notify_disconnect(hcd->usb_phy, udev->speed);
-		usb_disconnect(&port_dev->child);
+		usb_disconnect(&udev);
 	}
 
 	/* We can forget about a "removed" device when there's a physical
-- 
2.17.1


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

* Re: [PATCH] USB: hub:no need to obtain usb device
  2024-06-25 16:46 [PATCH] USB: hub:no need to obtain usb device Lizhe
@ 2024-06-25 16:52 ` Alan Stern
  2024-06-25 17:50 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Stern @ 2024-06-25 16:52 UTC (permalink / raw)
  To: Lizhe
  Cc: gregkh, hgajjar, stanley_chang, ricardo.canuelo, johan+linaro,
	linux-usb, linux-kernel

On Tue, Jun 25, 2024 at 09:46:07AM -0700, Lizhe wrote:
> the usb device connected to the port has obtained.
> there is no need to obtain it again.
> 
> Signed-off-by: Lizhe <sensor1010@163.com>
> ---
>  drivers/usb/core/hub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 4b93c0bd1d4b..f37b991fa86a 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -5358,7 +5358,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
>  	if (udev) {
>  		if (hcd->usb_phy && !hdev->parent)
>  			usb_phy_notify_disconnect(hcd->usb_phy, udev->speed);
> -		usb_disconnect(&port_dev->child);
> +		usb_disconnect(&udev);
>  	}

This is wrong.  We need to pass the address of port_dev->child, not the 
address of udev.  This is so that usb_disconnect() can set 
port_dev->child to NULL.  Setting udev to NULL instead won't work right.

Alan Stern

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

* Re: [PATCH] USB: hub:no need to obtain usb device
  2024-06-25 16:46 [PATCH] USB: hub:no need to obtain usb device Lizhe
  2024-06-25 16:52 ` Alan Stern
@ 2024-06-25 17:50 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-06-25 17:50 UTC (permalink / raw)
  To: Lizhe
  Cc: stern, hgajjar, stanley_chang, ricardo.canuelo, johan+linaro,
	linux-usb, linux-kernel

On Tue, Jun 25, 2024 at 09:46:07AM -0700, Lizhe wrote:
> the usb device connected to the port has obtained.
> there is no need to obtain it again.
> 
> Signed-off-by: Lizhe <sensor1010@163.com>
> ---
>  drivers/usb/core/hub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 4b93c0bd1d4b..f37b991fa86a 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -5358,7 +5358,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
>  	if (udev) {
>  		if (hcd->usb_phy && !hdev->parent)
>  			usb_phy_notify_disconnect(hcd->usb_phy, udev->speed);
> -		usb_disconnect(&port_dev->child);
> +		usb_disconnect(&udev);

How was this tested?

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

end of thread, other threads:[~2024-06-25 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 16:46 [PATCH] USB: hub:no need to obtain usb device Lizhe
2024-06-25 16:52 ` Alan Stern
2024-06-25 17:50 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox