On Mon, Sep 30, 2013 at 05:26:28PM +0300, Mathias Nyman wrote: > Cc: stable@xxxxxxxxxxxxxxx > --- > drivers/usb/core/driver.c | 3 + > drivers/usb/core/sysfs.c | 1 + > drivers/usb/host/xhci-mem.c | 10 --- > drivers/usb/host/xhci.c | 152 +++---------------------------------------- > include/linux/usb.h | 4 +- > 5 files changed, 16 insertions(+), 154 deletions(-) > > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > index f7841d4..689433c 100644 > --- a/drivers/usb/core/driver.c > +++ b/drivers/usb/core/driver.c > @@ -1790,6 +1790,9 @@ int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) > struct usb_hcd *hcd = bus_to_hcd(udev->bus); > int ret = -EPERM; > > + if (enable && !udev->usb2_hw_lpm_allowed) > + return 0; > + > if (hcd->driver->set_usb2_hw_lpm) { > ret = hcd->driver->set_usb2_hw_lpm(hcd, udev, enable); > if (!ret) > diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c > index 6d2c8ed..76bce3a 100644 > --- a/drivers/usb/core/sysfs.c > +++ b/drivers/usb/core/sysfs.c > @@ -469,6 +469,7 @@ static ssize_t usb2_hardware_lpm_store(struct device *dev, > > ret = strtobool(buf, &value); > > + udev->usb2_hw_lpm_allowed = value; > if (!ret) > ret = usb_set_usb2_hardware_lpm(udev, value); On a second review, I see a bug here. What happens if someone passes in bad input? udev->usb2_hw_lpm_allowed gets set to garbage. Also, what should happen if usb_set_usb2_hardware_lpm() fails? Should we set udev->usb2_hw_lpm_allowed to the previously stored value? I'll have to double check what the code does in failure cases. I'll refresh the patch shortly and send it out. Sarah Sharp -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html