On Sat, 16 Mar 2013, Alan Stern wrote:

> On Sat, 16 Mar 2013, Jenya Y wrote:
> 
> > Alan, looks like we are not quite there yet, just tried a fresh 3.8.3
> > build with both of your patches and here is what I have -
> > 
> > [    7.797975] usb 1-2.2: can't set config #1, error -19
> > [    7.798332] usb 1-2.2: USB disconnect, device number 3
> > [    7.799158] usb 2-1: USB disconnect, device number 2
> > [    7.801304] usb 2-2: USB disconnect, device number 3
> > [    7.813015] hub 2-2:1.0: hub_port_status failed (err = -19)
> > [    7.813364] hub 2-2:1.0: unable to enumerate USB device on port 2
> > [    7.836270] usb 4-1: USB disconnect, device number 2
> > [    7.881036] usb 4-1.3: new full-speed USB device number 3 using uhci_hcd
> > [    7.887063] hub 4-1:1.0: unable to enumerate USB device on port 3
> > 
> > 
> > So half of them is gone, just those remained. I downgraded to systemd
> > 197 for the build just to make sure.
> 
> Those -19 and "unable to enumerate" messages aren't necessary; I'll
> send you an updated version of the second patch that will get rid of
> them.  However, the "USB disconnect" messages are unavoidable.

Here's the updated version of the second patch.

You know, these patches probably will apply okay (or with only minor 
changes) to 3.9.  Then you should be able to use any config setup you 
want.

Alan Stern




Index: 3.8/drivers/usb/core/hub.c
===================================================================
--- 3.8.orig/drivers/usb/core/hub.c
+++ 3.8/drivers/usb/core/hub.c
@@ -613,8 +613,9 @@ static int hub_port_status(struct usb_hu
        mutex_lock(&hub->status_mutex);
        ret = get_port_status(hub->hdev, port1, &hub->status->port);
        if (ret < 4) {
-               dev_err(hub->intfdev,
-                       "%s failed (err = %d)\n", __func__, ret);
+               if (ret != -ENODEV)
+                       dev_err(hub->intfdev,
+                               "%s failed (err = %d)\n", __func__, ret);
                if (ret >= 0)
                        ret = -EIO;
        } else {
@@ -757,7 +758,7 @@ static void hub_tt_work(struct work_stru
                /* drop lock so HCD can concurrently report other TT errors */
                spin_unlock_irqrestore (&hub->tt.lock, flags);
                status = hub_clear_tt_buffer (hdev, clear->devinfo, clear->tt);
-               if (status)
+               if (status && status != -ENODEV)
                        dev_err (&hdev->dev,
                                "clear tt %d (%04x) error %d\n",
                                clear->tt, clear->devinfo, status);
@@ -865,10 +866,11 @@ static int hub_hub_status(struct usb_hub
 
        mutex_lock(&hub->status_mutex);
        ret = get_hub_status(hub->hdev, &hub->status->hub);
-       if (ret < 0)
-               dev_err (hub->intfdev,
-                       "%s failed (err = %d)\n", __func__, ret);
-       else {
+       if (ret < 0) {
+               if (ret != -ENODEV)
+                       dev_err(hub->intfdev,
+                               "%s failed (err = %d)\n", __func__, ret);
+       } else {
                *status = le16_to_cpu(hub->status->hub.wHubStatus);
                *change = le16_to_cpu(hub->status->hub.wHubChange); 
                ret = 0;
@@ -905,11 +907,8 @@ static int hub_usb3_port_disable(struct
                return -EINVAL;
 
        ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED);
-       if (ret) {
-               dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n",
-                               port1, ret);
+       if (ret)
                return ret;
-       }
 
        /* Wait for the link to enter the disabled state. */
        for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) {
@@ -946,7 +945,7 @@ static int hub_port_disable(struct usb_h
                        ret = clear_port_feature(hdev, port1,
                                        USB_PORT_FEAT_ENABLE);
        }
-       if (ret)
+       if (ret && ret != -ENODEV)
                dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n",
                                port1, ret);
        return ret;
@@ -2230,8 +2229,9 @@ static int usb_enumerate_device(struct u
        if (udev->config == NULL) {
                err = usb_get_configuration(udev);
                if (err < 0) {
-                       dev_err(&udev->dev, "can't read configurations, error 
%d\n",
-                               err);
+                       if (err != -ENODEV)
+                               dev_err(&udev->dev, "can't read configurations, 
error %d\n",
+                                               err);
                        return err;
                }
        }
@@ -2679,14 +2679,16 @@ static int hub_port_reset(struct usb_hub
                status = set_port_feature(hub->hdev, port1, (warm ?
                                        USB_PORT_FEAT_BH_PORT_RESET :
                                        USB_PORT_FEAT_RESET));
-               if (status) {
+               if (status == -ENODEV) {
+                       ;       /* The hub is gone */
+               } else if (status) {
                        dev_err(hub->intfdev,
                                        "cannot %sreset port %d (err = %d)\n",
                                        warm ? "warm " : "", port1, status);
                } else {
                        status = hub_port_wait_reset(hub, port1, udev, delay,
                                                                warm);
-                       if (status && status != -ENOTCONN)
+                       if (status && status != -ENOTCONN && status != -ENODEV)
                                dev_dbg(hub->intfdev,
                                                "port_wait_reset: err = %d\n",
                                                status);
@@ -4080,9 +4082,9 @@ hub_port_init (struct usb_hub *hub, stru
                                goto fail;
                        }
                        if (r) {
-                               dev_err(&udev->dev,
-                                       "device descriptor read/64, error %d\n",
-                                       r);
+                               if (r != -ENODEV)
+                                       dev_err(&udev->dev, "device descriptor 
read/64, error %d\n",
+                                                       r);
                                retval = -EMSGSIZE;
                                continue;
                        }
@@ -4102,9 +4104,9 @@ hub_port_init (struct usb_hub *hub, stru
                                msleep(200);
                        }
                        if (retval < 0) {
-                               dev_err(&udev->dev,
-                                       "device not accepting address %d, error 
%d\n",
-                                       devnum, retval);
+                               if (retval != -ENODEV)
+                                       dev_err(&udev->dev, "device not 
accepting address %d, error %d\n",
+                                                       devnum, retval);
                                goto fail;
                        }
                        if (udev->speed == USB_SPEED_SUPER) {
@@ -4126,7 +4128,8 @@ hub_port_init (struct usb_hub *hub, stru
 
                retval = usb_get_device_descriptor(udev, 8);
                if (retval < 8) {
-                       dev_err(&udev->dev,
+                       if (retval != -ENODEV)
+                               dev_err(&udev->dev,
                                        "device descriptor read/8, error %d\n",
                                        retval);
                        if (retval >= 0)
@@ -4180,8 +4183,9 @@ hub_port_init (struct usb_hub *hub, stru
   
        retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE);
        if (retval < (signed)sizeof(udev->descriptor)) {
-               dev_err(&udev->dev, "device descriptor read/all, error %d\n",
-                       retval);
+               if (retval != -ENODEV)
+                       dev_err(&udev->dev, "device descriptor read/all, error 
%d\n",
+                                       retval);
                if (retval >= 0)
                        retval = -ENOMSG;
                goto fail;
@@ -4355,7 +4359,7 @@ static void hub_port_connect_change(stru
                                USB_PORT_STAT_C_ENABLE)) {
                status = hub_port_debounce(hub, port1);
                if (status < 0) {
-                       if (printk_ratelimit())
+                       if (status != -ENODEV && printk_ratelimit())
                                dev_err(hub_dev, "connect-debounce failed, "
                                                "port %d disabled\n", port1);
                        portstatus &= ~USB_PORT_STAT_CONNECTION;
@@ -4380,6 +4384,7 @@ static void hub_port_connect_change(stru
                return;
        }
 
+       status = 0;
        for (i = 0; i < SET_CONFIG_TRIES; i++) {
 
                /* reallocate for each attempt, since references
@@ -4504,9 +4509,11 @@ loop:
        }
        if (hub->hdev->parent ||
                        !hcd->driver->port_handed_over ||
-                       !(hcd->driver->port_handed_over)(hcd, port1))
-               dev_err(hub_dev, "unable to enumerate USB device on port %d\n",
-                               port1);
+                       !(hcd->driver->port_handed_over)(hcd, port1)) {
+               if (status != -ENOTCONN && status != -ENODEV)
+                       dev_err(hub_dev, "unable to enumerate USB device on 
port %d\n",
+                                       port1);
+       }
  
 done:
        hub_port_disable(hub, port1, 1);
Index: 3.8/drivers/usb/core/generic.c
===================================================================
--- 3.8.orig/drivers/usb/core/generic.c
+++ 3.8/drivers/usb/core/generic.c
@@ -169,7 +169,7 @@ static int generic_probe(struct usb_devi
                c = usb_choose_configuration(udev);
                if (c >= 0) {
                        err = usb_set_configuration(udev, c);
-                       if (err) {
+                       if (err && err != -ENODEV) {
                                dev_err(&udev->dev, "can't set config #%d, 
error %d\n",
                                        c, err);
                                /* This need not be fatal.  The user can try to

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to