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

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

 



On Mon, 30 Jan 2012, Oliver Neukum wrote:

> 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.

I disagree.  Counters are needed only when a resource is being shared, 
and interfaces aren't supposed to be shared between drivers.

If you decide that you have to go against this model, then it is up to
you to figure out how to manage one interface using your two drivers.  
But you shouldn't drag the rest of the USB stack into it.

Alan Stern

--
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