diff options
author | Colin Leroy <colin@colino.net> | 2005-04-24 19:37:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-27 17:43:47 -0400 |
commit | a3c900bb8cbacfecf0be51313e43f330663266a1 (patch) | |
tree | 31351207f18014c9d925422db2efff936b959c0e /drivers | |
parent | 507ca9bc0476662f3463888d583864834eab1e11 (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.c | 38 | ||||
-rw-r--r-- | drivers/usb/net/zd1201.h | 1 |
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) | |||
1884 | kfree(zd); | 1884 | kfree(zd); |
1885 | } | 1885 | } |
1886 | 1886 | ||
1887 | #ifdef CONFIG_PM | ||
1888 | |||
1889 | static int zd1201_suspend(struct usb_interface *interface, | ||
1890 | pm_message_t message) | ||
1891 | { | ||
1892 | struct zd1201 *zd = usb_get_intfdata(interface); | ||
1893 | |||
1894 | netif_device_detach(zd->dev); | ||
1895 | |||
1896 | zd->was_enabled = zd->mac_enabled; | ||
1897 | |||
1898 | if (zd->was_enabled) | ||
1899 | return zd1201_disable(zd); | ||
1900 | else | ||
1901 | return 0; | ||
1902 | } | ||
1903 | |||
1904 | static int zd1201_resume(struct usb_interface *interface) | ||
1905 | { | ||
1906 | struct zd1201 *zd = usb_get_intfdata(interface); | ||
1907 | |||
1908 | netif_device_attach(zd->dev); | ||
1909 | |||
1910 | if (zd->was_enabled) | ||
1911 | return zd1201_enable(zd); | ||
1912 | else | ||
1913 | return 0; | ||
1914 | } | ||
1915 | |||
1916 | #else | ||
1917 | |||
1918 | #define zd1201_suspend NULL | ||
1919 | #define zd1201_resume NULL | ||
1920 | |||
1921 | #endif | ||
1922 | |||
1887 | static struct usb_driver zd1201_usb = { | 1923 | static struct usb_driver zd1201_usb = { |
1888 | .owner = THIS_MODULE, | 1924 | .owner = THIS_MODULE, |
1889 | .name = "zd1201", | 1925 | .name = "zd1201", |
1890 | .probe = zd1201_probe, | 1926 | .probe = zd1201_probe, |
1891 | .disconnect = zd1201_disconnect, | 1927 | .disconnect = zd1201_disconnect, |
1892 | .id_table = zd1201_table, | 1928 | .id_table = zd1201_table, |
1929 | .suspend = zd1201_suspend, | ||
1930 | .resume = zd1201_resume, | ||
1893 | }; | 1931 | }; |
1894 | 1932 | ||
1895 | static int __init zd1201_init(void) | 1933 | 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 { | |||
46 | char essid[IW_ESSID_MAX_SIZE+1]; | 46 | char essid[IW_ESSID_MAX_SIZE+1]; |
47 | int essidlen; | 47 | int essidlen; |
48 | int mac_enabled; | 48 | int mac_enabled; |
49 | int was_enabled; | ||
49 | int monitor; | 50 | int monitor; |
50 | int encode_enabled; | 51 | int encode_enabled; |
51 | int encode_restricted; | 52 | int encode_restricted; |