On Mon, 30 Oct 2006, Oliver Neukum wrote:
> > Take a look at usb-skeleton.c to see how they can be used. They are well
> > suited to the drivers which present a simple character-device interface to
> > userspace.
>
> It seems to me that those drivers use:
>
> if (desc->counter++) {
> ...
> }
>
> in open()
>
> and
>
> if (--desc->counter) {
> ...
> }
>
> in close()
>
> But, this may be a matter of taste and viewpoint.
> However, it seems to me that you cannot limit the API to only
> the versions with counter and if push comes to shove the versions
> without counters are more basic and hence must be supported.
I don't understand. A driver can simply do
if (usb_autopm_get_interface(intf) < 0)
goto fail;
in its open() routine and
usb_autopm_put_interface(intf);
in its release() routine. The driver doesn't need to maintain its own
counter; that purpose is served by intf->pm_usage_cnt.
The difficulty arises when the driver doesn't have simple events like
open() and release() to indicate when to autosuspend or autoresume. It's
for those situations that we need usb_autopm_set_interface().
Alan Stern
-------------------------------------------------------------------------
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