On Tue, 20 Sep 2016, Carsten Mattner wrote:

> On Tue, Sep 20, 2016 at 2:36 PM, Oliver Neukum <oneu...@suse.com> wrote:
> > On Tue, 2016-09-20 at 14:11 +0200, Carsten Mattner wrote:
> >> 4.8-rc5 was fine, but 4.8-rc6 and 4.8-rc7 on a Lenovo Thinkpad x220 report 
> >> this
> >> warning or error (cannot tell) anytime a USB mass storage device is 
> >> inserted
> >> into a usb port (2.0 or 3.0):
> >>
> >> runtime PM trying to activate child device host6 but parent
> >> (2-1.2:1.0) is not active
> >
> > I see no obvious culprit. Could you bisect?
> 
> I need the machine for so cannot do too many compile and reboot
> cycles, but I've confirmed that the error message is triggered back
> in 4.8-rc2.
> 
> No such thing in 4.7.4 and I'm now back in lts-4.7.4 to get work done.

I suspect the problem has been there all along, but it simply wasn't 
reported until commit 71723f95463d ("PM / runtime: print error when 
activating a child to unactive parent") was merged in 4.8-rc1.

Does this patch get rid of the error message?

Alan Stern



Index: usb-4.x/drivers/usb/storage/usb.c
===================================================================
--- usb-4.x.orig/drivers/usb/storage/usb.c
+++ usb-4.x/drivers/usb/storage/usb.c
@@ -1070,17 +1070,18 @@ int usb_stor_probe2(struct us_data *us)
        result = usb_stor_acquire_resources(us);
        if (result)
                goto BadDevice;
+
+       usb_autopm_get_interface_no_resume(us->pusb_intf);
        snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s",
                                        dev_name(&us->pusb_intf->dev));
        result = scsi_add_host(us_to_host(us), dev);
        if (result) {
                dev_warn(dev,
                                "Unable to add the scsi host\n");
-               goto BadDevice;
+               goto AddHostFailed;
        }
 
        /* Submit the delayed_work for SCSI-device scanning */
-       usb_autopm_get_interface_no_resume(us->pusb_intf);
        set_bit(US_FLIDX_SCAN_PENDING, &us->dflags);
 
        if (delay_use > 0)
@@ -1090,7 +1091,9 @@ int usb_stor_probe2(struct us_data *us)
        return 0;
 
        /* We come here if there are any problems */
-BadDevice:
+ AddHostFailed:
+       usb_autopm_put_interface_no_suspend(us->pusb_intf);
+ BadDevice:
        usb_stor_dbg(us, "storage_probe() failed\n");
        release_everything(us);
        return result;

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

Reply via email to