Am Samstag, 28. Oktober 2006 17:22 schrieb Alan Stern:
> Oliver:
>
> Here's an improved API for managing autosuspend calls. It lets you do
> what you want and it saves code space at the same time!
>
> Your usb_autopm_enable() and usb_autopm_disable() routines can easily be
> implemented using this API as follows:
>
> #define usb_autopm_enable(intf) do { \
> (intf)->pm_usage_cnt = 0; \
> usb_autopm_set_interface(intf); } while (0)
>
> #define usb_autopm_disable(intf) do { \
> (intf)->pm_usage_cnt = 1; \
> usb_autopm_set_interface(intf); } while (0)
>
> Yes, this does involve setting pm_usage_cnt outside the protection of
> udev->pm_mutex, but I think that won't hurt anything. The call to
> usb_autopm_set_interface() will do the right thing regardless.
>
> What do you think of this approach?
Clever. I like it.
[..]
> +static int usb_autopm_do_device(struct usb_device *udev, int inc_usage_cnt)
> +{
> + int status;
> +
> + usb_pm_lock(udev);
> + udev->pm_usage_cnt += inc_usage_cnt;
> + if (udev->pm_usage_cnt > 0) {
> + udev->auto_pm = 1;
> + status = usb_resume_both(udev);
> + if (status != 0)
> + udev->pm_usage_cnt -= inc_usage_cnt;
Is this a good idea? If I want to disable autopm I want to do so even
if the device cannot be woken.
Regards
Oliver
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel