Currently, shadow_power is just used to determine if the device is active or suspended. Is there a function is_usb_device_suspended() or something along the lines of that? I see that the usb_device has a 'state' variable which could be 'USB_STATE_SUSPENDED' which is what shadow_power is reflecting. I didn't know if that was considered "private" and should not use it. Can I? When the suspend(), reset_resume(), and resume() functions (in the usb_driver struct) execute the actual device is currently non suspended right? So the usb_device->state != USB_STATE_SUSPENDED ? If that is the case, it should eliminate the use of shadow_power. Harry Metzger On Tue, Mar 9, 2010 at 10:21 AM, Oliver Neukum <oliver@xxxxxxxxxx> wrote: > Am Montag, 8. März 2010 16:15:14 schrieb Harrison Metzger: >> Also, the old logic would call usb_autopm_put_interface() if >> shadow_power == 1 and the user requested the display to be off ("echo >> 0 > /sys/$DEVICE/powered"). If usb autosuspend was disabled the >> suspend() function would never be called, and the shadow_power >> variable would still be 1. So the user could "echo 0" multiple times >> (even though the display is already off) and this would really screw >> up the reference count (it would be negative from calling >> usb_autopm_put_interface() multiple times). >> >> This is why there is a separate variable to track if we have called >> usb_autopm_get/put_interface(). > > OK, why not remove shadow_power? > > 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