diff options
Diffstat (limited to 'drivers/usb/net/zd1201.c')
-rw-r--r-- | drivers/usb/net/zd1201.c | 38 |
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 | |||
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) |