Oliver Neukum <oliver@xxxxxxxxxx> writes: > Am Montag, 30. Januar 2012, 19:26:17 schrieb Bjørn Mork: >> Oliver Neukum <oliver@xxxxxxxxxx> writes: >> >> > Bjørn, in this case it is best to provide two helping function >> > pointers when you create the "subdevice" and realize the counters >> > in the network driver. >> >> Do you mean to let the cdc-wdm subdriver call back the main driver when >> it wants to set/clear the needs_remote_wakeup flag? > > Yes. > >> Yes, I can do that but I sort of feel it messes up the interface for >> little gain. We'd need to store the callback pointers and modify >> wdm_open and wdm_release to use them conditionally. Or provide local >> callbacks for use as a normal driver. Not pretty at all. > > Providing local alternatives is pretty clean. probe() can pass them to create() > >> I am currently leaning towards just documenting that cdc-wdm will change >> the needs_remote_wakeup flag and that any driver using cdc-wdm as a >> subdriver therefore will have to prevent autosuspending while being >> active. This can be done without involving neither usb core nor > > We want devices to be able to autosuspend as often as possible. Good. I will add something like that. But does it really need to be two functions, or can we use something similar to usbnet's "manage_power" (which does the same thing)? It is defined as /* (dis)activate runtime power management */ int (*manage_power)(struct usbnet *, int); where the second argument really is a bool telling if we need remote wakeup or not, thereby combining get/put (or on/off) in a single callback. The cdc_ether implementation demostrates the usage: static int cdc_manage_power(struct usbnet *dev, int on) { dev->intf->needs_remote_wakeup = on; return 0; } Having two separate on/off functions wouldn't add anything but complexity. I believe the same goes for the cdc-wdm case. Bjørn -- 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