rt2x00: use wiphy rfkill interface
PATCH 1/1 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 <[email protected]>
--- drivers/net/wireless/rt2x00/Kconfig | 8 -- drivers/net/wireless/rt2x00/Makefile | 1 - drivers/net/wireless/rt2x00/rt2400pci.c | 7 +-- drivers/net/wireless/rt2x00/rt2500pci.c | 7 +-- drivers/net/wireless/rt2x00/rt2500usb.c | 7 +-- drivers/net/wireless/rt2x00/rt2800usb.c | 7 +-- drivers/net/wireless/rt2x00/rt2x00.h | 13 +--- drivers/net/wireless/rt2x00/rt2x00dev.c | 2 - drivers/net/wireless/rt2x00/rt2x00lib.h | 21 +---- drivers/net/wireless/rt2x00/rt2x00mac.c | 9 ++ drivers/net/wireless/rt2x00/rt2x00rfkill.c | 127 ---------------------------- drivers/net/wireless/rt2x00/rt61pci.c | 7 +-- drivers/net/wireless/rt2x00/rt73usb.c | 7 +-- 13 files changed, 20 insertions(+), 203 deletions(-) delete mode 100644 drivers/net/wireless/rt2x00/rt2x00rfkill.c
drivers/net/wireless/rt2x00/Kconfig +0 -8
@@ -142,14 +142,6 @@ config RT2X00_LIB_FIRMWARE config RT2X00_LIB_CRYPTO boolean -config RT2X00_LIB_RFKILL - boolean - default y if (RT2X00_LIB=y && INPUT=y) || (RT2X00_LIB=m && INPUT!=n) - select INPUT_POLLDEV - -comment "rt2x00 rfkill support disabled due to modularized INPUT and built-in rt2x00" - depends on RT2X00_LIB=y && INPUT=m - config RT2X00_LIB_LEDS boolean default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n)
drivers/net/wireless/rt2x00/Makefile +0 -1
@@ -5,7 +5,6 @@ rt2x00lib-y += rt2x00queue.o rt2x00lib-y += rt2x00link.o rt2x00lib-$(CONFIG_RT2X00_LIB_DEBUGFS) += rt2x00debug.o rt2x00lib-$(CONFIG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o -rt2x00lib-$(CONFIG_RT2X00_LIB_RFKILL) += rt2x00rfkill.o rt2x00lib-$(CONFIG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o rt2x00lib-$(CONFIG_RT2X00_LIB_HT) += rt2x00ht.o
drivers/net/wireless/rt2x00/rt2400pci.c +1 -6
@@ -199,7 +199,6 @@ static const struct rt2x00debug rt2400pci_rt2x00debug = { };#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -#ifdef CONFIG_RT2X00_LIB_RFKILL static int rt2400pci_rfkill_poll (struct rt2x00_dev *rt2x00dev) {u32 reg;
@@ -207,9 +206,6 @@ static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)rt2x00pci_register_read (rt2x00dev,GPIOCSR , ®);return rt2x00_get_field32 (reg,GPIOCSR_BIT0 ); } -#else -#define rt2400pci_rfkill_poll NULL -#endif /* CONFIG_RT2X00_LIB_RFKILL */ #ifdef CONFIG_RT2X00_LIB_LEDS static void rt2400pci_brightness_set(struct led_classdev *led_cdev,
@@ -1391,10 +1387,8 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Detect if this device has an hardware controlled radio. */ -#ifdef CONFIG_RT2X00_LIB_RFKILL if (rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_HARDWARE_RADIO ))__set_bit (CONFIG_SUPPORT_HW_BUTTON , &rt2x00dev->flags); -#endif /* CONFIG_RT2X00_LIB_RFKILL */ /* * Check if the BBP tuning should be enabled.
@@ -1573,6 +1567,7 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = { .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt2400pci_get_tsf, .tx_last_beacon = rt2400pci_tx_last_beacon, + .rfkill_poll = rt2x00mac_rfkill_poll, };static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
drivers/net/wireless/rt2x00/rt2500pci.c +1 -6
@@ -199,7 +199,6 @@ static const struct rt2x00debug rt2500pci_rt2x00debug = { };#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -#ifdef CONFIG_RT2X00_LIB_RFKILL static int rt2500pci_rfkill_poll (struct rt2x00_dev *rt2x00dev) {u32 reg;
@@ -207,9 +206,6 @@ static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)rt2x00pci_register_read (rt2x00dev,GPIOCSR , ®);return rt2x00_get_field32 (reg,GPIOCSR_BIT0 ); } -#else -#define rt2500pci_rfkill_poll NULL -#endif /* CONFIG_RT2X00_LIB_RFKILL */ #ifdef CONFIG_RT2X00_LIB_LEDS static void rt2500pci_brightness_set(struct led_classdev *led_cdev,
@@ -1548,10 +1544,8 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Detect if this device has an hardware controlled radio. */ -#ifdef CONFIG_RT2X00_LIB_RFKILL if (rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_HARDWARE_RADIO ))__set_bit (CONFIG_SUPPORT_HW_BUTTON , &rt2x00dev->flags); -#endif /* CONFIG_RT2X00_LIB_RFKILL */ /* * Check if the BBP tuning should be enabled.
@@ -1872,6 +1866,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = { .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt2500pci_get_tsf, .tx_last_beacon = rt2500pci_tx_last_beacon, + .rfkill_poll = rt2x00mac_rfkill_poll, };static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
drivers/net/wireless/rt2x00/rt2500usb.c +1 -6
@@ -277,7 +277,6 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = { };#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -#ifdef CONFIG_RT2X00_LIB_RFKILL static int rt2500usb_rfkill_poll (struct rt2x00_dev *rt2x00dev) {u16 reg;
@@ -285,9 +284,6 @@ static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)rt2500usb_register_read (rt2x00dev,MAC_CSR19 , ®);return rt2x00_get_field32 (reg,MAC_CSR19_BIT7 ); } -#else -#define rt2500usb_rfkill_poll NULL -#endif /* CONFIG_RT2X00_LIB_RFKILL */ #ifdef CONFIG_RT2X00_LIB_LEDS static void rt2500usb_brightness_set(struct led_classdev *led_cdev,
@@ -1601,10 +1597,8 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Detect if this device has an hardware controlled radio. */ -#ifdef CONFIG_RT2X00_LIB_RFKILL if (rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_HARDWARE_RADIO ))__set_bit (CONFIG_SUPPORT_HW_BUTTON , &rt2x00dev->flags); -#endif /* CONFIG_RT2X00_LIB_RFKILL */ /* * Check if the BBP tuning should be disabled.
@@ -1905,6 +1899,7 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = { .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2x00mac_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, + .rfkill_poll = rt2x00mac_rfkill_poll, };static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
drivers/net/wireless/rt2x00/rt2800usb.c +1 -6
@@ -264,7 +264,6 @@ static const struct rt2x00debug rt2800usb_rt2x00debug = { };#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -#ifdef CONFIG_RT2X00_LIB_RFKILL static int rt2800usb_rfkill_poll (struct rt2x00_dev *rt2x00dev) {u32 reg;
@@ -272,9 +271,6 @@ static int rt2800usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)rt2x00usb_register_read (rt2x00dev,GPIO_CTRL_CFG , ®);return rt2x00_get_field32 (reg,GPIO_CTRL_CFG_BIT2 ); } -#else -#define rt2800usb_rfkill_poll NULL -#endif /* CONFIG_RT2X00_LIB_RFKILL */ #ifdef CONFIG_RT2X00_LIB_LEDS static void rt2800usb_brightness_set(struct led_classdev *led_cdev,
@@ -2385,10 +2381,8 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Detect if this device has an hardware controlled radio. */ -#ifdef CONFIG_RT2X00_LIB_RFKILL if (rt2x00_get_field16 (eeprom,EEPROM_NIC_HW_RADIO ))__set_bit (CONFIG_SUPPORT_HW_BUTTON , &rt2x00dev->flags); -#endif /* CONFIG_RT2X00_LIB_RFKILL */ /* * Store led settings, for correct led behaviour.
@@ -2800,6 +2794,7 @@ static const struct ieee80211_ops rt2800usb_mac80211_ops = { .conf_tx = rt2800usb_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt2800usb_get_tsf, + .rfkill_poll = rt2x00mac_rfkill_poll, };static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
drivers/net/wireless/rt2x00/rt2x00.h +1 -12
@@ -657,18 +657,6 @@ struct rt2x00_dev {enum ieee80211_band curr_band;/* -* rfkill structure for RF state switching support. -* This will only be compiled in when required. -*/ -#ifdef CONFIG_RT2X00_LIB_RFKILL -unsigned long rfkill_state; -#define RFKILL_STATE_ALLOCATED 1 -#define RFKILL_STATE_REGISTERED 2 -#define RFKILL_STATE_BLOCKED 3 -struct input_polled_dev *rfkill_poll_dev; -#endif /* CONFIG_RT2X00_LIB_RFKILL */ - -/* * If enabled, the debugfs interface structures * required for deregistration of debugfs. */
@@ -998,6 +986,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, u32 changes);int rt2x00mac_conf_tx (struct ieee80211_hw *hw,u16 queue,const struct ieee80211_tx_queue_params *params); +void rt2x00mac_rfkill_poll (struct ieee80211_hw *hw);/* * Driver allocation handlers.
drivers/net/wireless/rt2x00/rt2x00dev.c +0 -2
@@ -871,7 +871,6 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)*/ rt2x00link_register (rt2x00dev);rt2x00leds_register (rt2x00dev); -rt2x00rfkill_allocate (rt2x00dev);rt2x00debug_register (rt2x00dev);set_bit (DEVICE_STATE_PRESENT , &rt2x00dev->flags);
@@ -903,7 +902,6 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)* Free extra components */ rt2x00debug_deregister (rt2x00dev); -rt2x00rfkill_free (rt2x00dev);rt2x00leds_unregister (rt2x00dev);/*
drivers/net/wireless/rt2x00/rt2x00lib.h +4 -17
@@ -30,10 +30,8 @@/* * Interval defines -* Both the link tuner as the rfkill will be called once per second. */ #define LINK_TUNE_INTERVAL round_jiffies_relative(HZ) -#define RFKILL_POLL_INTERVAL 1000/* * rt2x00_rate: Per rate device information
@@ -386,29 +384,18 @@ static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,/* * RFkill handlers. */ -#ifdef CONFIG_RT2X00_LIB_RFKILL -void rt2x00rfkill_register (struct rt2x00_dev *rt2x00dev); -void rt2x00rfkill_unregister (struct rt2x00_dev *rt2x00dev); -void rt2x00rfkill_allocate (struct rt2x00_dev *rt2x00dev); -void rt2x00rfkill_free (struct rt2x00_dev *rt2x00dev); -#else static inline void rt2x00rfkill_register (struct rt2x00_dev *rt2x00dev) { +if (test_bit (CONFIG_SUPPORT_HW_BUTTON , &rt2x00dev->flags)) +wiphy_rfkill_start_polling (rt2x00dev->hw->wiphy); }static inline void rt2x00rfkill_unregister (struct rt2x00_dev *rt2x00dev) { +if (test_bit (CONFIG_SUPPORT_HW_BUTTON , &rt2x00dev->flags)) +wiphy_rfkill_stop_polling (rt2x00dev->hw->wiphy); } -static inline void rt2x00rfkill_allocate (struct rt2x00_dev *rt2x00dev) -{ -} - -static inline void rt2x00rfkill_free (struct rt2x00_dev *rt2x00dev) -{ -} -#endif /* CONFIG_RT2X00_LIB_RFKILL */ -/* * LED handlers */
drivers/net/wireless/rt2x00/rt2x00mac.c +9 -0
@@ -688,3 +688,12 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,return 0 ; }EXPORT_SYMBOL_GPL (rt2x00mac_conf_tx); + +void rt2x00mac_rfkill_poll (struct ieee80211_hw *hw) +{ +struct rt2x00_dev *rt2x00dev = hw->priv; +bool blocked = !!rt2x00dev->ops->lib->rfkill_poll (rt2x00dev); + +wiphy_rfkill_set_hw_state (hw->wiphy, blocked); +} +EXPORT_SYMBOL_GPL (rt2x00mac_rfkill_poll);
drivers/net/wireless/rt2x00/rt2x00rfkill.c deleted +0 -127
127 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt61pci.c +1 -6
@@ -237,7 +237,6 @@ static const struct rt2x00debug rt61pci_rt2x00debug = { };#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -#ifdef CONFIG_RT2X00_LIB_RFKILL static int rt61pci_rfkill_poll (struct rt2x00_dev *rt2x00dev) {u32 reg;
@@ -245,9 +244,6 @@ static int rt61pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)rt2x00pci_register_read (rt2x00dev,MAC_CSR13 , ®);return rt2x00_get_field32 (reg,MAC_CSR13_BIT5 ); } -#else -#define rt61pci_rfkill_poll NULL -#endif /* CONFIG_RT2X00_LIB_RFKILL */ #ifdef CONFIG_RT2X00_LIB_LEDS static void rt61pci_brightness_set(struct led_classdev *led_cdev,
@@ -2338,10 +2334,8 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Detect if this device has an hardware controlled radio. */ -#ifdef CONFIG_RT2X00_LIB_RFKILL if (rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_HARDWARE_RADIO ))__set_bit (CONFIG_SUPPORT_HW_BUTTON , &rt2x00dev->flags); -#endif /* CONFIG_RT2X00_LIB_RFKILL */ /* * Read frequency offset and RF programming sequence.
@@ -2728,6 +2722,7 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = { .conf_tx = rt61pci_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt61pci_get_tsf, + .rfkill_poll = rt2x00mac_rfkill_poll, };static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
drivers/net/wireless/rt2x00/rt73usb.c +1 -6
@@ -183,7 +183,6 @@ static const struct rt2x00debug rt73usb_rt2x00debug = { };#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -#ifdef CONFIG_RT2X00_LIB_RFKILL static int rt73usb_rfkill_poll (struct rt2x00_dev *rt2x00dev) {u32 reg;
@@ -191,9 +190,6 @@ static int rt73usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)rt2x00usb_register_read (rt2x00dev,MAC_CSR13 , ®);return rt2x00_get_field32 (reg,MAC_CSR13_BIT7 ); } -#else -#define rt73usb_rfkill_poll NULL -#endif /* CONFIG_RT2X00_LIB_RFKILL */ #ifdef CONFIG_RT2X00_LIB_LEDS static void rt73usb_brightness_set(struct led_classdev *led_cdev,
@@ -1863,10 +1859,8 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Detect if this device has an hardware controlled radio. */ -#ifdef CONFIG_RT2X00_LIB_RFKILL if (rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_HARDWARE_RADIO ))__set_bit (CONFIG_SUPPORT_HW_BUTTON , &rt2x00dev->flags); -#endif /* CONFIG_RT2X00_LIB_RFKILL */ /* * Read frequency offset.
@@ -2253,6 +2247,7 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = { .conf_tx = rt73usb_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt73usb_get_tsf, + .rfkill_poll = rt2x00mac_rfkill_poll, };static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
Signature · 1 line
1.6.3.1
Hi Ivo,
Quoted 5 lines
Remove the
input_polldevfrom 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 theCONFIG_RT2X00_LIB_RFKILLoption and always enables rfkill capabilities.
as I mentioned in Berlin last week, I think this is the right way of doing this. So ACK.
Regards
Marcel