diff options
author | Oliver Neukum <oliver@neukum.org> | 2012-10-10 22:50:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-11 15:19:21 -0400 |
commit | 5d9d01a30204c99edf99189018953ee84c5f5017 (patch) | |
tree | 3bb2f17fca9de90c003dd1ab37a017299414733d /drivers/net | |
parent | e7d491a19d3e3aac544070293891a2542ae0c565 (diff) |
usbnet: Support devices reporting idleness
Some device types support a form of power management in which
the device suggests to the host that the device may be suspended
now. Support for that is best located in usbnet.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/usb/cdc_eem.c | 4 | ||||
-rw-r--r-- | drivers/net/usb/usbnet.c | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c index 434d5af8e6fb..c81e278629ff 100644 --- a/drivers/net/usb/cdc_eem.c +++ b/drivers/net/usb/cdc_eem.c | |||
@@ -244,8 +244,12 @@ static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
244 | * - suspend: peripheral ready to suspend | 244 | * - suspend: peripheral ready to suspend |
245 | * - response: suggest N millisec polling | 245 | * - response: suggest N millisec polling |
246 | * - response complete: suggest N sec polling | 246 | * - response complete: suggest N sec polling |
247 | * | ||
248 | * Suspend is reported and maybe heeded. | ||
247 | */ | 249 | */ |
248 | case 2: /* Suspend hint */ | 250 | case 2: /* Suspend hint */ |
251 | usbnet_device_suggests_idle(dev); | ||
252 | continue; | ||
249 | case 3: /* Response hint */ | 253 | case 3: /* Response hint */ |
250 | case 4: /* Response complete hint */ | 254 | case 4: /* Response complete hint */ |
251 | continue; | 255 | continue; |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index fc9f578a1e25..f9819d10b1f9 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1588,10 +1588,27 @@ int usbnet_resume (struct usb_interface *intf) | |||
1588 | tasklet_schedule (&dev->bh); | 1588 | tasklet_schedule (&dev->bh); |
1589 | } | 1589 | } |
1590 | } | 1590 | } |
1591 | |||
1592 | if (test_and_clear_bit(EVENT_DEVICE_REPORT_IDLE, &dev->flags)) | ||
1593 | usb_autopm_get_interface_no_resume(intf); | ||
1594 | |||
1591 | return 0; | 1595 | return 0; |
1592 | } | 1596 | } |
1593 | EXPORT_SYMBOL_GPL(usbnet_resume); | 1597 | EXPORT_SYMBOL_GPL(usbnet_resume); |
1594 | 1598 | ||
1599 | /* | ||
1600 | * Either a subdriver implements manage_power, then it is assumed to always | ||
1601 | * be ready to be suspended or it reports the readiness to be suspended | ||
1602 | * explicitly | ||
1603 | */ | ||
1604 | void usbnet_device_suggests_idle(struct usbnet *dev) | ||
1605 | { | ||
1606 | if (!test_and_set_bit(EVENT_DEVICE_REPORT_IDLE, &dev->flags)) { | ||
1607 | dev->intf->needs_remote_wakeup = 1; | ||
1608 | usb_autopm_put_interface_async(dev->intf); | ||
1609 | } | ||
1610 | } | ||
1611 | EXPORT_SYMBOL(usbnet_device_suggests_idle); | ||
1595 | 1612 | ||
1596 | /*-------------------------------------------------------------------------*/ | 1613 | /*-------------------------------------------------------------------------*/ |
1597 | 1614 | ||