Re: [PATCH v2] USB: hub: Fix the broken detection of USB3 device in SMSC hub

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 31 Jan 2020, Hardik Gajjar wrote:

> > > @@ -1863,6 +1865,9 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
> > >  	if (id->driver_info & HUB_QUIRK_CHECK_PORT_AUTOSUSPEND)
> > >  		hub->quirk_check_port_auto_suspend = 1;
> > >  
> > > +	if (id->driver_info & HUB_QUIRK_DISABLE_AUTOSUSPEND)
> > > +		usb_autopm_get_interface(intf);
> > > +
> > >  	if (hub_configure(hub, &desc->endpoint[0].desc) >= 0)
> > >  		return 0;
> > >  
> > 
> > This isn't right.  If you call usb_autopm_get_interface() then at some 
> > later point you _must_ call usb_autopm_put_interface().  In this case, 
> > you would have to add these calls following the hub_configure() call 
> > (in the case where it returns an error) and in the hub_disconnect() 
> > routine.
> > 
> 
> Thanks for feedback.
> 
> I tried to call the usb_autopm_put_interface() after hub_configure()[1] but then,
> detection of USB3 device is stopped. Perhaps, It will increase the counter
> again and allow the hub to go into suspend/sleep Mode. I need to disable auto
> suspend permanently for SMSC hub. 
> 
> Please,  give some suggestion. 

What I mean is, you need to do something like this...

Alan Stern


Index: usb-devel/drivers/usb/core/hub.c
===================================================================
--- usb-devel.orig/drivers/usb/core/hub.c
+++ usb-devel/drivers/usb/core/hub.c
@@ -1730,6 +1730,9 @@ static void hub_disconnect(struct usb_in
 	kfree(hub->buffer);
 
 	pm_suspend_ignore_children(&intf->dev, false);
+	if (hub->quirk_disable_autosuspend)
+		usb_autopm_put_interface(intf);
+
 	kref_put(&hub->kref, hub_release);
 }
 
@@ -1862,6 +1865,11 @@ static int hub_probe(struct usb_interfac
 	if (id->driver_info & HUB_QUIRK_CHECK_PORT_AUTOSUSPEND)
 		hub->quirk_check_port_auto_suspend = 1;
 
+	if (id->driver_info & HUB_QUIRK_DISABLE_AUTOSUSPEND) {
+		hub->quirk_disable_autosuspend = 1;
+		usb_autopm_get_interface(intf);
+	}
+
 	if (hub_configure(hub, &desc->endpoint[0].desc) >= 0)
 		return 0;
 
Index: usb-devel/drivers/usb/core/hub.h
===================================================================
--- usb-devel.orig/drivers/usb/core/hub.h
+++ usb-devel/drivers/usb/core/hub.h
@@ -63,6 +63,7 @@ struct usb_hub {
 	unsigned		in_reset:1;
 
 	unsigned		quirk_check_port_auto_suspend:1;
+	unsigned		quirk_disable_autosuspend:1;
 
 	unsigned		has_indicators:1;
 	u8			indicator[USB_MAXCHILDREN];




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux