summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorColin Leroy <colin@colino.net>2005-04-24 16:37:15 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-27 14:43:47 -0700
commita3c900bb8cbacfecf0be51313e43f330663266a1 (patch)
tree31351207f18014c9d925422db2efff936b959c0e /drivers
parent507ca9bc0476662f3463888d583864834eab1e11 (diff)
[PATCH] USB: PM support for zd1201
This patch enables power management (suspend, resume) support for zd1201. It fixes problems after wakeup for me, but these problems did not appear everytime without this patch. it's a bit empirical, based on what the usbnet does, so maybe not correct... Maybe someone can give it a look before it's applied. Signed-off-by: Colin Leroy <colin@colino.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/net/zd1201.c38
-rw-r--r--drivers/usb/net/zd1201.h1
2 files changed, 39 insertions, 0 deletions
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c
index 341ae5f732dd..eb0bff535b3c 100644
--- a/drivers/usb/net/zd1201.c
+++ b/drivers/usb/net/zd1201.c
@@ -1884,12 +1884,50 @@ static void zd1201_disconnect(struct usb_interface *interface)
kfree(zd);
}
+#ifdef CONFIG_PM
+
+static int zd1201_suspend(struct usb_interface *interface,
+ pm_message_t message)
+{
+ struct zd1201 *zd = usb_get_intfdata(interface);
+
+ netif_device_detach(zd->dev);
+
+ zd->was_enabled = zd->mac_enabled;
+
+ if (zd->was_enabled)
+ return zd1201_disable(zd);
+ else
+ return 0;
+}
+
+static int zd1201_resume(struct usb_interface *interface)
+{
+ struct zd1201 *zd = usb_get_intfdata(interface);
+
+ netif_device_attach(zd->dev);
+
+ if (zd->was_enabled)
+ return zd1201_enable(zd);
+ else
+ return 0;
+}
+
+#else
+
+#define zd1201_suspend NULL
+#define zd1201_resume NULL
+
+#endif
+
static struct usb_driver zd1201_usb = {
.owner = THIS_MODULE,
.name = "zd1201",
.probe = zd1201_probe,
.disconnect = zd1201_disconnect,
.id_table = zd1201_table,
+ .suspend = zd1201_suspend,
+ .resume = zd1201_resume,
};
static int __init zd1201_init(void)
diff --git a/drivers/usb/net/zd1201.h b/drivers/usb/net/zd1201.h
index 1627c71e8052..235f0ee34b24 100644
--- a/drivers/usb/net/zd1201.h
+++ b/drivers/usb/net/zd1201.h
@@ -46,6 +46,7 @@ struct zd1201 {
char essid[IW_ESSID_MAX_SIZE+1];
int essidlen;
int mac_enabled;
+ int was_enabled;
int monitor;
int encode_enabled;
int encode_restricted;