Skip to contentSkip to conversation

usbnet & cdc-ether: Autosuspend for online devices

PATCH In review Oliver Neukum 3 participants 3 messages Dec 3, 2009

Subsystems (6)
lore
Share & tools
lore

Oliver Neukum

author maintainer
#0 lore raw

PATCH 2/2 usbnet & cdc-ether: Autosuspend for online devices

commit 17b97d1c24a061843a8f707e80f23a7b0b7647df

Author: Oliver Neukum <[email protected]>
Date:   Thu Dec 3 22:08:12 2009 +0100

usbnet & cdc-ether: Autosuspend for online devices

Using remote wakeup and delayed transmission to allow online device to go into usb autosuspend. Minimal alternate support for devices that don't support remote wakeup.

drivers/net/usb/cdc_ether.c +8 -0
index 075e33f..11f73dd 100644
@@ -411,6 +411,12 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)
 	return 0;
 }
 
+static int cdc_manage_power(struct usbnet *dev, int on)
+{
+	dev->intf->needs_remote_wakeup = on;
+	return 0;
+}
+
 static const struct driver_info	cdc_info = {
 	.description =	"CDC Ethernet Device",
 	.flags =	FLAG_ETHER,
@@ -418,6 +424,7 @@ static const struct driver_info	cdc_info = {
 	.bind =		cdc_bind,
 	.unbind =	usbnet_cdc_unbind,
 	.status =	cdc_status,
+	.manage_power =	cdc_manage_power,
 };
 
 /*-------------------------------------------------------------------------*/
@@ -611,6 +618,7 @@ static struct usb_driver cdc_driver = {
 	.suspend =	usbnet_suspend,
 	.resume =	usbnet_resume,
 	.reset_resume =	usbnet_resume,
+	.supports_autosuspend = 1,
 };
 
 
drivers/net/usb/usbnet.c +126 -29

287 lines not on this page · raw message

include/linux/usb/usbnet.h +6 -0
index f814730..aa174df 100644
@@ -55,6 +55,7 @@ struct usbnet {
 	struct sk_buff_head	done;
 	struct sk_buff_head	rxq_pause;
 	struct urb		*interrupt;
+	struct usb_anchor	deferred;
 	struct tasklet_struct	bh;
 
 	struct work_struct	kevent;
@@ -65,6 +66,8 @@ struct usbnet {
 #		define EVENT_STS_SPLIT	3
 #		define EVENT_LINK_RESET	4
 #		define EVENT_RX_PAUSED	5
+#		define EVENT_DEV_WAKING 6
+#		define EVENT_DEV_ASLEEP 7
 };
 
 static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -107,6 +110,9 @@ struct driver_info {
 	/* see if peer is connected ... can sleep */
 	int	(*check_connect)(struct usbnet *);
 
+	/* (dis)activate runtime power management */
+	int	(*manage_power)(struct usbnet *, int);
+
 	/* for status polling */
 	void	(*status)(struct usbnet *, struct urb *);
 
maintainer
#1 lore raw

From: Oliver Neukum <[email protected]>
Date: Thu, 3 Dec 2009 22:10:55 +0100

Quoted 4 lines

commit 17b97d1c24a061843a8f707e80f23a7b0b7647df

Author: Oliver Neukum <[email protected]>
Date:   Thu Dec 3 22:08:12 2009 +0100
Quoted 8 lines

usbnet & cdc-ether: Autosuspend for online devices

Using remote wakeup and delayed transmission to allow online device to go into usb autosuspend. Minimal alternate support for devices that don't support remote wakeup.

Oliver, this patch still doesn't apply after patch #1 is added.

davem@sunset:~/src/GIT/net-next-2.6$ git am --signoff bundle-735.mbox 
Applying: cdc-ether:Implement reset_resume()
Applying: usbnet & cdc-ether: Autosuspend for online devices
error: patch failed: drivers/net/usb/cdc_ether.c:411
error: drivers/net/usb/cdc_ether.c: patch does not apply
error: patch failed: drivers/net/usb/usbnet.c:353
error: drivers/net/usb/usbnet.c: patch does not apply
Patch failed at 0002 usbnet & cdc-ether: Autosuspend for online devices
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
You have new mail in /var/mail/davem
#2 lore raw

Hi Oliver,

Quoted 11 lines
Quoted 11 lines

commit 17b97d1c24a061843a8f707e80f23a7b0b7647df

Author: Oliver Neukum <[email protected]>
Date:   Thu Dec 3 22:08:12 2009 +0100

usbnet & cdc-ether: Autosuspend for online devices

Using remote wakeup and delayed transmission to allow online device to go into usb autosuspend. Minimal alternate support for devices that don't support remote wakeup.

Quoted 4 lines
Quoted 1 line

Oliver, this patch still doesn't apply after patch #1 is added.

why don't you use git format-patch and git send-email. With that combination it is almost impossible to screw up.

Regards

Marcel