Re: [PATCH 0/3] usb: cdc-wdm: subdriver support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Montag, 30. Januar 2012, 11:14:12 schrieb Bjørn Mork:
> But if we want the main driver to support autosuspending an active
> device by using remote wakeup, then we need to add some support to
> cdc-wdm for sharing the flag.  One simple way would be to add a counter
> and an interface function to be used by the main driver when it wants
> the flag set/cleared.  Something like (but with locking added...):
> 
> int usb_cdc_wdm_remote_wakeup(struct usb_interface *intf, bool on)
> {
>         struct wdm_device *desc = wdm_find_device(intf);
> 
>         if (on) {
>            if (!desc->remote_wakeup++)
>               intf->needs_remote_wakeup = 1;
>         } else {
>            if (!--desc->remote_wakeup)
>               intf->needs_remote_wakeup = 0;
>         }
>         return desc->remote_wakeup;
> }
> 
> 
> What do you think?  Just document that any driver which uses cdc-wdm as
> a subdriver cannot make use of remote wakeup for now?  Or add some
> interface like the above?  Or something else?

Counters are generally the preffered solution to such problems. You'd better
do it in usbcore and provide three helper functions and a spinlock (or make
it atomic). Then you need to go through all drivers, but this is the cleanest solution
in the long run.

	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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux