The problem was that the update_display_{visual,mode}() functions (which send a control msg to the actual device) checks to make sure mydev->shadow_power == 1, otherwise it returns immediately. The mydev->shadow_power variable is only set in the resume(), reset_resume(), and suspend() functions. So, when autosuspend is disabled, resume() is never called, which means mydev->shadow_power is still set to 0, and the update_display_{visual,mode}() functions simply return and do not send a msg to the device. The (new) mydev->has_interface_pm variable is simply to track if we have called usb_autopm_get_interface(), instead of relying on mydev->shadow_power to determine if it was called. We need to track this because the user could "echo 1 > /sys/$DEVICE/powered" multiple times, but we only want to increment the usage count once. That way, when they "echo 0 > /sys/$DEVICE/powered" the device's display turns off and usb_autopm_put_interface() is called making the reference count 0 (assuming nothing else is using the interface / device). At this point, the device can be suspended as its display is off. Harry Metzger On Mon, Mar 8, 2010 at 5:01 AM, Oliver Neukum <oliver@xxxxxxxxxx> wrote: > Am Sonntag, 7. März 2010 22:45:42 schrieb Harrison Metzger: >> /* sysfs_streq can't replace this completely >> @@ -68,12 +69,16 @@ static void update_display_powered(struc >> { >> int rc; >> >> - if (!mydev->shadow_power && mydev->powered) { >> + if (mydev->powered && !mydev->has_interface_pm) { >> rc = usb_autopm_get_interface(mydev->intf); >> if (rc < 0) >> return; >> + mydev->has_interface_pm = 1; >> } >> >> + if (mydev->shadow_power != 1) >> + return; >> + > > This looks wrong, because even if you use autosuspend you > cannot be sure usb_autopm_get_interface() calls resume(), > as for example lsusb can have woken the driver before. > > What is the problem in the logic you are seeing? > > Regards > Oliver > -- 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