aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/net/zd1201.c
diff options
context:
space:
mode:
authorColin Leroy <colin@colino.net>2005-04-24 19:37:15 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-27 17:43:47 -0400
commita3c900bb8cbacfecf0be51313e43f330663266a1 (patch)
tree31351207f18014c9d925422db2efff936b959c0e /drivers/usb/net/zd1201.c
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/usb/net/zd1201.c')
-rw-r--r--drivers/usb/net/zd1201.c38
1 files changed, 38 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
1889static 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
1904static 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
1887static struct usb_driver zd1201_usb = { 1923static 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
1895static int __init zd1201_init(void) 1933static int __init zd1201_init(void)