diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2009-07-01 09:17:35 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:02:27 -0400 |
commit | e47a5cddf893815e7da16e3226b959af785d8aaf (patch) | |
tree | 15766b50789f0a9ebffabd8ba0c57f47eff99130 /drivers/net/wireless/rt2x00 | |
parent | b623a9f7c488e51dbe4320d8b5cdd0ba242d0067 (diff) |
rt2x00: use wiphy rfkill interface
Remove the input_polldev from rt2x00 and replace it with
the rfkill interface offered by the wiphy structure. This
simplifies the entire rfkill handling in rt2x00 and allows
us to remove the CONFIG_RT2X00_LIB_RFKILL option and always
enables rfkill capabilities.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r-- | drivers/net/wireless/rt2x00/Kconfig | 8 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/Makefile | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 13 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00lib.h | 21 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00mac.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00rfkill.c | 127 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 7 |
13 files changed, 20 insertions, 203 deletions
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 8aab3e6754bd..f970aa25326a 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
@@ -112,14 +112,6 @@ config RT2X00_LIB_FIRMWARE | |||
112 | config RT2X00_LIB_CRYPTO | 112 | config RT2X00_LIB_CRYPTO |
113 | boolean | 113 | boolean |
114 | 114 | ||
115 | config RT2X00_LIB_RFKILL | ||
116 | boolean | ||
117 | default y if (RT2X00_LIB=y && INPUT=y) || (RT2X00_LIB=m && INPUT!=n) | ||
118 | select INPUT_POLLDEV | ||
119 | |||
120 | comment "rt2x00 rfkill support disabled due to modularized INPUT and built-in rt2x00" | ||
121 | depends on RT2X00_LIB=y && INPUT=m | ||
122 | |||
123 | config RT2X00_LIB_LEDS | 115 | config RT2X00_LIB_LEDS |
124 | boolean | 116 | boolean |
125 | default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n) | 117 | default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n) |
diff --git a/drivers/net/wireless/rt2x00/Makefile b/drivers/net/wireless/rt2x00/Makefile index bfc7226f0afe..13043ea97667 100644 --- a/drivers/net/wireless/rt2x00/Makefile +++ b/drivers/net/wireless/rt2x00/Makefile | |||
@@ -5,7 +5,6 @@ rt2x00lib-y += rt2x00queue.o | |||
5 | rt2x00lib-y += rt2x00link.o | 5 | rt2x00lib-y += rt2x00link.o |
6 | rt2x00lib-$(CONFIG_RT2X00_LIB_DEBUGFS) += rt2x00debug.o | 6 | rt2x00lib-$(CONFIG_RT2X00_LIB_DEBUGFS) += rt2x00debug.o |
7 | rt2x00lib-$(CONFIG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o | 7 | rt2x00lib-$(CONFIG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o |
8 | rt2x00lib-$(CONFIG_RT2X00_LIB_RFKILL) += rt2x00rfkill.o | ||
9 | rt2x00lib-$(CONFIG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o | 8 | rt2x00lib-$(CONFIG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o |
10 | rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o | 9 | rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o |
11 | rt2x00lib-$(CONFIG_RT2X00_LIB_HT) += rt2x00ht.o | 10 | rt2x00lib-$(CONFIG_RT2X00_LIB_HT) += rt2x00ht.o |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 435f945fe64d..d8035e3575e8 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -199,7 +199,6 @@ static const struct rt2x00debug rt2400pci_rt2x00debug = { | |||
199 | }; | 199 | }; |
200 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 200 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |
201 | 201 | ||
202 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
203 | static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) | 202 | static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) |
204 | { | 203 | { |
205 | u32 reg; | 204 | u32 reg; |
@@ -207,9 +206,6 @@ static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
207 | rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); | 206 | rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); |
208 | return rt2x00_get_field32(reg, GPIOCSR_BIT0); | 207 | return rt2x00_get_field32(reg, GPIOCSR_BIT0); |
209 | } | 208 | } |
210 | #else | ||
211 | #define rt2400pci_rfkill_poll NULL | ||
212 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
213 | 209 | ||
214 | #ifdef CONFIG_RT2X00_LIB_LEDS | 210 | #ifdef CONFIG_RT2X00_LIB_LEDS |
215 | static void rt2400pci_brightness_set(struct led_classdev *led_cdev, | 211 | static void rt2400pci_brightness_set(struct led_classdev *led_cdev, |
@@ -1391,10 +1387,8 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1391 | /* | 1387 | /* |
1392 | * Detect if this device has an hardware controlled radio. | 1388 | * Detect if this device has an hardware controlled radio. |
1393 | */ | 1389 | */ |
1394 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
1395 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1390 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) |
1396 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 1391 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
1397 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
1398 | 1392 | ||
1399 | /* | 1393 | /* |
1400 | * Check if the BBP tuning should be enabled. | 1394 | * Check if the BBP tuning should be enabled. |
@@ -1573,6 +1567,7 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = { | |||
1573 | .get_tx_stats = rt2x00mac_get_tx_stats, | 1567 | .get_tx_stats = rt2x00mac_get_tx_stats, |
1574 | .get_tsf = rt2400pci_get_tsf, | 1568 | .get_tsf = rt2400pci_get_tsf, |
1575 | .tx_last_beacon = rt2400pci_tx_last_beacon, | 1569 | .tx_last_beacon = rt2400pci_tx_last_beacon, |
1570 | .rfkill_poll = rt2x00mac_rfkill_poll, | ||
1576 | }; | 1571 | }; |
1577 | 1572 | ||
1578 | static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { | 1573 | static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 08b30d01e67d..c123e28396d0 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -199,7 +199,6 @@ static const struct rt2x00debug rt2500pci_rt2x00debug = { | |||
199 | }; | 199 | }; |
200 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 200 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |
201 | 201 | ||
202 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
203 | static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) | 202 | static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) |
204 | { | 203 | { |
205 | u32 reg; | 204 | u32 reg; |
@@ -207,9 +206,6 @@ static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
207 | rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); | 206 | rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); |
208 | return rt2x00_get_field32(reg, GPIOCSR_BIT0); | 207 | return rt2x00_get_field32(reg, GPIOCSR_BIT0); |
209 | } | 208 | } |
210 | #else | ||
211 | #define rt2500pci_rfkill_poll NULL | ||
212 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
213 | 209 | ||
214 | #ifdef CONFIG_RT2X00_LIB_LEDS | 210 | #ifdef CONFIG_RT2X00_LIB_LEDS |
215 | static void rt2500pci_brightness_set(struct led_classdev *led_cdev, | 211 | static void rt2500pci_brightness_set(struct led_classdev *led_cdev, |
@@ -1548,10 +1544,8 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1548 | /* | 1544 | /* |
1549 | * Detect if this device has an hardware controlled radio. | 1545 | * Detect if this device has an hardware controlled radio. |
1550 | */ | 1546 | */ |
1551 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
1552 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1547 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) |
1553 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 1548 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
1554 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
1555 | 1549 | ||
1556 | /* | 1550 | /* |
1557 | * Check if the BBP tuning should be enabled. | 1551 | * Check if the BBP tuning should be enabled. |
@@ -1872,6 +1866,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = { | |||
1872 | .get_tx_stats = rt2x00mac_get_tx_stats, | 1866 | .get_tx_stats = rt2x00mac_get_tx_stats, |
1873 | .get_tsf = rt2500pci_get_tsf, | 1867 | .get_tsf = rt2500pci_get_tsf, |
1874 | .tx_last_beacon = rt2500pci_tx_last_beacon, | 1868 | .tx_last_beacon = rt2500pci_tx_last_beacon, |
1869 | .rfkill_poll = rt2x00mac_rfkill_poll, | ||
1875 | }; | 1870 | }; |
1876 | 1871 | ||
1877 | static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { | 1872 | static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 66daf68ff0ee..795706d63b94 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -277,7 +277,6 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = { | |||
277 | }; | 277 | }; |
278 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 278 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |
279 | 279 | ||
280 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
281 | static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) | 280 | static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) |
282 | { | 281 | { |
283 | u16 reg; | 282 | u16 reg; |
@@ -285,9 +284,6 @@ static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
285 | rt2500usb_register_read(rt2x00dev, MAC_CSR19, ®); | 284 | rt2500usb_register_read(rt2x00dev, MAC_CSR19, ®); |
286 | return rt2x00_get_field32(reg, MAC_CSR19_BIT7); | 285 | return rt2x00_get_field32(reg, MAC_CSR19_BIT7); |
287 | } | 286 | } |
288 | #else | ||
289 | #define rt2500usb_rfkill_poll NULL | ||
290 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
291 | 287 | ||
292 | #ifdef CONFIG_RT2X00_LIB_LEDS | 288 | #ifdef CONFIG_RT2X00_LIB_LEDS |
293 | static void rt2500usb_brightness_set(struct led_classdev *led_cdev, | 289 | static void rt2500usb_brightness_set(struct led_classdev *led_cdev, |
@@ -1601,10 +1597,8 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1601 | /* | 1597 | /* |
1602 | * Detect if this device has an hardware controlled radio. | 1598 | * Detect if this device has an hardware controlled radio. |
1603 | */ | 1599 | */ |
1604 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
1605 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1600 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) |
1606 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 1601 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
1607 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
1608 | 1602 | ||
1609 | /* | 1603 | /* |
1610 | * Check if the BBP tuning should be disabled. | 1604 | * Check if the BBP tuning should be disabled. |
@@ -1905,6 +1899,7 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = { | |||
1905 | .bss_info_changed = rt2x00mac_bss_info_changed, | 1899 | .bss_info_changed = rt2x00mac_bss_info_changed, |
1906 | .conf_tx = rt2x00mac_conf_tx, | 1900 | .conf_tx = rt2x00mac_conf_tx, |
1907 | .get_tx_stats = rt2x00mac_get_tx_stats, | 1901 | .get_tx_stats = rt2x00mac_get_tx_stats, |
1902 | .rfkill_poll = rt2x00mac_rfkill_poll, | ||
1908 | }; | 1903 | }; |
1909 | 1904 | ||
1910 | static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { | 1905 | static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 37561667925b..a204e66753c2 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -264,7 +264,6 @@ static const struct rt2x00debug rt2800usb_rt2x00debug = { | |||
264 | }; | 264 | }; |
265 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 265 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |
266 | 266 | ||
267 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
268 | static int rt2800usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) | 267 | static int rt2800usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) |
269 | { | 268 | { |
270 | u32 reg; | 269 | u32 reg; |
@@ -272,9 +271,6 @@ static int rt2800usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
272 | rt2x00usb_register_read(rt2x00dev, GPIO_CTRL_CFG, ®); | 271 | rt2x00usb_register_read(rt2x00dev, GPIO_CTRL_CFG, ®); |
273 | return rt2x00_get_field32(reg, GPIO_CTRL_CFG_BIT2); | 272 | return rt2x00_get_field32(reg, GPIO_CTRL_CFG_BIT2); |
274 | } | 273 | } |
275 | #else | ||
276 | #define rt2800usb_rfkill_poll NULL | ||
277 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
278 | 274 | ||
279 | #ifdef CONFIG_RT2X00_LIB_LEDS | 275 | #ifdef CONFIG_RT2X00_LIB_LEDS |
280 | static void rt2800usb_brightness_set(struct led_classdev *led_cdev, | 276 | static void rt2800usb_brightness_set(struct led_classdev *led_cdev, |
@@ -2385,10 +2381,8 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2385 | /* | 2381 | /* |
2386 | * Detect if this device has an hardware controlled radio. | 2382 | * Detect if this device has an hardware controlled radio. |
2387 | */ | 2383 | */ |
2388 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
2389 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO)) | 2384 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO)) |
2390 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 2385 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
2391 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
2392 | 2386 | ||
2393 | /* | 2387 | /* |
2394 | * Store led settings, for correct led behaviour. | 2388 | * Store led settings, for correct led behaviour. |
@@ -2800,6 +2794,7 @@ static const struct ieee80211_ops rt2800usb_mac80211_ops = { | |||
2800 | .conf_tx = rt2800usb_conf_tx, | 2794 | .conf_tx = rt2800usb_conf_tx, |
2801 | .get_tx_stats = rt2x00mac_get_tx_stats, | 2795 | .get_tx_stats = rt2x00mac_get_tx_stats, |
2802 | .get_tsf = rt2800usb_get_tsf, | 2796 | .get_tsf = rt2800usb_get_tsf, |
2797 | .rfkill_poll = rt2x00mac_rfkill_poll, | ||
2803 | }; | 2798 | }; |
2804 | 2799 | ||
2805 | static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { | 2800 | static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index a498dde024e1..71f37cb476b0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -651,18 +651,6 @@ struct rt2x00_dev { | |||
651 | enum ieee80211_band curr_band; | 651 | enum ieee80211_band curr_band; |
652 | 652 | ||
653 | /* | 653 | /* |
654 | * rfkill structure for RF state switching support. | ||
655 | * This will only be compiled in when required. | ||
656 | */ | ||
657 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
658 | unsigned long rfkill_state; | ||
659 | #define RFKILL_STATE_ALLOCATED 1 | ||
660 | #define RFKILL_STATE_REGISTERED 2 | ||
661 | #define RFKILL_STATE_BLOCKED 3 | ||
662 | struct input_polled_dev *rfkill_poll_dev; | ||
663 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
664 | |||
665 | /* | ||
666 | * If enabled, the debugfs interface structures | 654 | * If enabled, the debugfs interface structures |
667 | * required for deregistration of debugfs. | 655 | * required for deregistration of debugfs. |
668 | */ | 656 | */ |
@@ -992,6 +980,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, | |||
992 | u32 changes); | 980 | u32 changes); |
993 | int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | 981 | int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue, |
994 | const struct ieee80211_tx_queue_params *params); | 982 | const struct ieee80211_tx_queue_params *params); |
983 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); | ||
995 | 984 | ||
996 | /* | 985 | /* |
997 | * Driver allocation handlers. | 986 | * Driver allocation handlers. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 41e33798adb5..4fff3a83f7df 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -871,7 +871,6 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
871 | */ | 871 | */ |
872 | rt2x00link_register(rt2x00dev); | 872 | rt2x00link_register(rt2x00dev); |
873 | rt2x00leds_register(rt2x00dev); | 873 | rt2x00leds_register(rt2x00dev); |
874 | rt2x00rfkill_allocate(rt2x00dev); | ||
875 | rt2x00debug_register(rt2x00dev); | 874 | rt2x00debug_register(rt2x00dev); |
876 | 875 | ||
877 | set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | 876 | set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
@@ -903,7 +902,6 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
903 | * Free extra components | 902 | * Free extra components |
904 | */ | 903 | */ |
905 | rt2x00debug_deregister(rt2x00dev); | 904 | rt2x00debug_deregister(rt2x00dev); |
906 | rt2x00rfkill_free(rt2x00dev); | ||
907 | rt2x00leds_unregister(rt2x00dev); | 905 | rt2x00leds_unregister(rt2x00dev); |
908 | 906 | ||
909 | /* | 907 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 0bf2715fa93a..512fa2bc3a10 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -30,10 +30,8 @@ | |||
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Interval defines | 32 | * Interval defines |
33 | * Both the link tuner as the rfkill will be called once per second. | ||
34 | */ | 33 | */ |
35 | #define LINK_TUNE_INTERVAL round_jiffies_relative(HZ) | 34 | #define LINK_TUNE_INTERVAL round_jiffies_relative(HZ) |
36 | #define RFKILL_POLL_INTERVAL 1000 | ||
37 | 35 | ||
38 | /* | 36 | /* |
39 | * rt2x00_rate: Per rate device information | 37 | * rt2x00_rate: Per rate device information |
@@ -386,29 +384,18 @@ static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, | |||
386 | /* | 384 | /* |
387 | * RFkill handlers. | 385 | * RFkill handlers. |
388 | */ | 386 | */ |
389 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
390 | void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); | ||
391 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); | ||
392 | void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); | ||
393 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); | ||
394 | #else | ||
395 | static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | 387 | static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) |
396 | { | 388 | { |
389 | if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | ||
390 | wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy); | ||
397 | } | 391 | } |
398 | 392 | ||
399 | static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) | 393 | static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) |
400 | { | 394 | { |
395 | if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | ||
396 | wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy); | ||
401 | } | 397 | } |
402 | 398 | ||
403 | static inline void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | ||
404 | { | ||
405 | } | ||
406 | |||
407 | static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) | ||
408 | { | ||
409 | } | ||
410 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
411 | |||
412 | /* | 399 | /* |
413 | * LED handlers | 400 | * LED handlers |
414 | */ | 401 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 475a3ed76468..b7e0ddda38f5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -688,3 +688,12 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx, | |||
688 | return 0; | 688 | return 0; |
689 | } | 689 | } |
690 | EXPORT_SYMBOL_GPL(rt2x00mac_conf_tx); | 690 | EXPORT_SYMBOL_GPL(rt2x00mac_conf_tx); |
691 | |||
692 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw) | ||
693 | { | ||
694 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
695 | bool blocked = !!rt2x00dev->ops->lib->rfkill_poll(rt2x00dev); | ||
696 | |||
697 | wiphy_rfkill_set_hw_state(hw->wiphy, blocked); | ||
698 | } | ||
699 | EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c deleted file mode 100644 index b6d4c6700bf3..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c +++ /dev/null | |||
@@ -1,127 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (C) 2004 - 2009 rt2x00 SourceForge Project | ||
3 | <http://rt2x00.serialmonkey.com> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the | ||
17 | Free Software Foundation, Inc., | ||
18 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | Module: rt2x00rfkill | ||
23 | Abstract: rt2x00 rfkill routines. | ||
24 | */ | ||
25 | |||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/module.h> | ||
28 | |||
29 | #include "rt2x00.h" | ||
30 | #include "rt2x00lib.h" | ||
31 | |||
32 | static void rt2x00rfkill_poll(struct input_polled_dev *poll_dev) | ||
33 | { | ||
34 | struct rt2x00_dev *rt2x00dev = poll_dev->private; | ||
35 | int state, old_state; | ||
36 | |||
37 | if (!test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state) || | ||
38 | !test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | ||
39 | return; | ||
40 | |||
41 | /* | ||
42 | * Poll latest state, if the state is different then the previous state, | ||
43 | * we should generate an input event. | ||
44 | */ | ||
45 | state = !!rt2x00dev->ops->lib->rfkill_poll(rt2x00dev); | ||
46 | old_state = !!test_bit(RFKILL_STATE_BLOCKED, &rt2x00dev->rfkill_state); | ||
47 | |||
48 | if (old_state != state) { | ||
49 | input_report_switch(poll_dev->input, SW_RFKILL_ALL, state); | ||
50 | change_bit(RFKILL_STATE_BLOCKED, &rt2x00dev->rfkill_state); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | ||
55 | { | ||
56 | if (!test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state) || | ||
57 | test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state)) | ||
58 | return; | ||
59 | |||
60 | if (input_register_polled_device(rt2x00dev->rfkill_poll_dev)) { | ||
61 | ERROR(rt2x00dev, "Failed to register polled device.\n"); | ||
62 | return; | ||
63 | } | ||
64 | |||
65 | __set_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state); | ||
66 | |||
67 | /* | ||
68 | * Force initial poll which will detect the initial device state, | ||
69 | * and correctly sends the signal to the input layer about this | ||
70 | * state. | ||
71 | */ | ||
72 | rt2x00rfkill_poll(rt2x00dev->rfkill_poll_dev); | ||
73 | } | ||
74 | |||
75 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) | ||
76 | { | ||
77 | if (!test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state) || | ||
78 | !test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state)) | ||
79 | return; | ||
80 | |||
81 | input_unregister_polled_device(rt2x00dev->rfkill_poll_dev); | ||
82 | |||
83 | __clear_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state); | ||
84 | } | ||
85 | |||
86 | void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | ||
87 | { | ||
88 | struct input_polled_dev *poll_dev; | ||
89 | |||
90 | if (test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state) || | ||
91 | !test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | ||
92 | return; | ||
93 | |||
94 | poll_dev = input_allocate_polled_device(); | ||
95 | if (!poll_dev) { | ||
96 | ERROR(rt2x00dev, "Failed to allocate polled device.\n"); | ||
97 | return; | ||
98 | } | ||
99 | |||
100 | poll_dev->private = rt2x00dev; | ||
101 | poll_dev->poll = rt2x00rfkill_poll; | ||
102 | poll_dev->poll_interval = RFKILL_POLL_INTERVAL; | ||
103 | |||
104 | poll_dev->input->name = rt2x00dev->ops->name; | ||
105 | poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy); | ||
106 | poll_dev->input->id.bustype = BUS_HOST; | ||
107 | poll_dev->input->id.vendor = 0x1814; | ||
108 | poll_dev->input->id.product = rt2x00dev->chip.rt; | ||
109 | poll_dev->input->id.version = rt2x00dev->chip.rev; | ||
110 | poll_dev->input->dev.parent = wiphy_dev(rt2x00dev->hw->wiphy); | ||
111 | poll_dev->input->evbit[0] = BIT(EV_SW); | ||
112 | poll_dev->input->swbit[0] = BIT(SW_RFKILL_ALL); | ||
113 | |||
114 | rt2x00dev->rfkill_poll_dev = poll_dev; | ||
115 | |||
116 | __set_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state); | ||
117 | } | ||
118 | |||
119 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) | ||
120 | { | ||
121 | if (!__test_and_clear_bit(RFKILL_STATE_ALLOCATED, | ||
122 | &rt2x00dev->rfkill_state)) | ||
123 | return; | ||
124 | |||
125 | input_free_polled_device(rt2x00dev->rfkill_poll_dev); | ||
126 | rt2x00dev->rfkill_poll_dev = NULL; | ||
127 | } | ||
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 49b29ff90c47..8a49d99df682 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -237,7 +237,6 @@ static const struct rt2x00debug rt61pci_rt2x00debug = { | |||
237 | }; | 237 | }; |
238 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 238 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |
239 | 239 | ||
240 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
241 | static int rt61pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) | 240 | static int rt61pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) |
242 | { | 241 | { |
243 | u32 reg; | 242 | u32 reg; |
@@ -245,9 +244,6 @@ static int rt61pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
245 | rt2x00pci_register_read(rt2x00dev, MAC_CSR13, ®); | 244 | rt2x00pci_register_read(rt2x00dev, MAC_CSR13, ®); |
246 | return rt2x00_get_field32(reg, MAC_CSR13_BIT5); | 245 | return rt2x00_get_field32(reg, MAC_CSR13_BIT5); |
247 | } | 246 | } |
248 | #else | ||
249 | #define rt61pci_rfkill_poll NULL | ||
250 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
251 | 247 | ||
252 | #ifdef CONFIG_RT2X00_LIB_LEDS | 248 | #ifdef CONFIG_RT2X00_LIB_LEDS |
253 | static void rt61pci_brightness_set(struct led_classdev *led_cdev, | 249 | static void rt61pci_brightness_set(struct led_classdev *led_cdev, |
@@ -2338,10 +2334,8 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2338 | /* | 2334 | /* |
2339 | * Detect if this device has an hardware controlled radio. | 2335 | * Detect if this device has an hardware controlled radio. |
2340 | */ | 2336 | */ |
2341 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
2342 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 2337 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) |
2343 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 2338 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
2344 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
2345 | 2339 | ||
2346 | /* | 2340 | /* |
2347 | * Read frequency offset and RF programming sequence. | 2341 | * Read frequency offset and RF programming sequence. |
@@ -2728,6 +2722,7 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = { | |||
2728 | .conf_tx = rt61pci_conf_tx, | 2722 | .conf_tx = rt61pci_conf_tx, |
2729 | .get_tx_stats = rt2x00mac_get_tx_stats, | 2723 | .get_tx_stats = rt2x00mac_get_tx_stats, |
2730 | .get_tsf = rt61pci_get_tsf, | 2724 | .get_tsf = rt61pci_get_tsf, |
2725 | .rfkill_poll = rt2x00mac_rfkill_poll, | ||
2731 | }; | 2726 | }; |
2732 | 2727 | ||
2733 | static const struct rt2x00lib_ops rt61pci_rt2x00_ops = { | 2728 | static const struct rt2x00lib_ops rt61pci_rt2x00_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index c18848836f2d..ad2898ca8677 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -183,7 +183,6 @@ static const struct rt2x00debug rt73usb_rt2x00debug = { | |||
183 | }; | 183 | }; |
184 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 184 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |
185 | 185 | ||
186 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
187 | static int rt73usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) | 186 | static int rt73usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) |
188 | { | 187 | { |
189 | u32 reg; | 188 | u32 reg; |
@@ -191,9 +190,6 @@ static int rt73usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
191 | rt2x00usb_register_read(rt2x00dev, MAC_CSR13, ®); | 190 | rt2x00usb_register_read(rt2x00dev, MAC_CSR13, ®); |
192 | return rt2x00_get_field32(reg, MAC_CSR13_BIT7); | 191 | return rt2x00_get_field32(reg, MAC_CSR13_BIT7); |
193 | } | 192 | } |
194 | #else | ||
195 | #define rt73usb_rfkill_poll NULL | ||
196 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
197 | 193 | ||
198 | #ifdef CONFIG_RT2X00_LIB_LEDS | 194 | #ifdef CONFIG_RT2X00_LIB_LEDS |
199 | static void rt73usb_brightness_set(struct led_classdev *led_cdev, | 195 | static void rt73usb_brightness_set(struct led_classdev *led_cdev, |
@@ -1863,10 +1859,8 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1863 | /* | 1859 | /* |
1864 | * Detect if this device has an hardware controlled radio. | 1860 | * Detect if this device has an hardware controlled radio. |
1865 | */ | 1861 | */ |
1866 | #ifdef CONFIG_RT2X00_LIB_RFKILL | ||
1867 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1862 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) |
1868 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 1863 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
1869 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | ||
1870 | 1864 | ||
1871 | /* | 1865 | /* |
1872 | * Read frequency offset. | 1866 | * Read frequency offset. |
@@ -2253,6 +2247,7 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = { | |||
2253 | .conf_tx = rt73usb_conf_tx, | 2247 | .conf_tx = rt73usb_conf_tx, |
2254 | .get_tx_stats = rt2x00mac_get_tx_stats, | 2248 | .get_tx_stats = rt2x00mac_get_tx_stats, |
2255 | .get_tsf = rt73usb_get_tsf, | 2249 | .get_tsf = rt73usb_get_tsf, |
2250 | .rfkill_poll = rt2x00mac_rfkill_poll, | ||
2256 | }; | 2251 | }; |
2257 | 2252 | ||
2258 | static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | 2253 | static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { |