[PATCH] rt2x00: Store "STARTED" state during suspend
authorIvo van Doorn <ivdoorn@gmail.com>
Sat, 6 Oct 2007 12:12:42 +0000 (14:12 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:55:09 +0000 (16:55 -0700)
Store the started state into a new flag DEVICE_STARTED_SUSPEND
and set this when suspending while the device was started.
We can't check for is_interface_present() since only mac80211
knows if there are monitor interfaces present.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00dev.c

index 5d30ca6680b69060fe1b3e2cc6f940a6dac8d49d..d280d0ec90420c4dd0ee3af474dbd686143795a6 100644 (file)
@@ -508,6 +508,7 @@ struct rt2x00_dev {
 #define CONFIG_EXTERNAL_LNA_BG         13
 #define CONFIG_DOUBLE_ANTENNA          14
 #define CONFIG_DISABLE_LINK_TUNING     15
+#define DEVICE_STARTED_SUSPEND         16
 
        /*
         * Chipset identification.
index b6a5c3481126d6cd5477093bb6880b0a7e0a14bb..f25475318c9b5ce3937bb497ea379a6cd4f8d2bb 100644 (file)
@@ -1088,12 +1088,13 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
         */
        if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
                goto exit;
+       __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags);
 
        /*
         * Disable radio and unitialize all items
         * that must be recreated on resume.
         */
-       rt2x00lib_disable_radio(rt2x00dev);
+       rt2x00mac_stop(rt2x00dev->hw);
        rt2x00lib_uninitialize(rt2x00dev);
        rt2x00debug_deregister(rt2x00dev);
 
@@ -1123,9 +1124,9 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
        rt2x00debug_register(rt2x00dev);
 
        /*
-        * Only continue if mac80211 has open interfaces.
+        * Only continue if mac80211 had open interfaces.
         */
-       if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
+       if (!__test_and_clear_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags))
                return 0;
 
        /*