Skip to contentSkip to conversation

driver rfkill to cfg80211 ports

PATCH In review Johannes Berg 5 participants 24 messages Jun 2, 2009 – Jun 11, 2009

Subsystems (2)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

cover driver rfkill to cfg80211 ports

This ports all drivers that have rfkill to cfg80211's rfkill integration.

johannes

author maintainer
#1 lore raw

PATCH 1/3 iwlwifi: port to cfg80211 rfkill

This ports the iwlwifi rfkill code to the new API offered by cfg80211 and thus removes a lot of useless stuff. The soft- rfkill is completely removed since that is now handled by setting the interfaces down.

Cc Reinette Chatre <[email protected]>
---
 drivers/net/wireless/iwlwifi/Kconfig        |    4 
 drivers/net/wireless/iwlwifi/Makefile       |    1 
 drivers/net/wireless/iwlwifi/iwl-3945.h     |    5 -
 drivers/net/wireless/iwlwifi/iwl-agn.c      |   42 ++------
 drivers/net/wireless/iwlwifi/iwl-core.c     |  138 ----------------------------
 drivers/net/wireless/iwlwifi/iwl-core.h     |   16 ---
 drivers/net/wireless/iwlwifi/iwl-debugfs.c  |    2 
 drivers/net/wireless/iwlwifi/iwl-dev.h      |    5 -
 drivers/net/wireless/iwlwifi/iwl-rfkill.c   |  131 --------------------------
 drivers/net/wireless/iwlwifi/iwl-rfkill.h   |   48 ---------
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   41 +-------
 11 files changed, 19 insertions(+), 414 deletions(-)
drivers/net/wireless/iwlwifi/Kconfig +0 -4
@@ -10,10 +10,6 @@ config IWLWIFI_LEDS
 	bool "Enable LED support in iwlagn and iwl3945 drivers"
 	depends on IWLWIFI
 
-config IWLWIFI_RFKILL
-	def_bool y
-	depends on IWLWIFI && RFKILL
-
 config IWLWIFI_SPECTRUM_MEASUREMENT
 	bool "Enable Spectrum Measurement in iwlagn driver"
 	depends on IWLWIFI
drivers/net/wireless/iwlwifi/iwl-3945.h +0 -5
@@ -36,10 +36,6 @@
 #include <linux/kernel.h>
 #include <net/ieee80211_radiotap.h>
 
-/*used for rfkill*/
-#include <linux/rfkill.h>
-#include <linux/input.h>
-
 /* Hardware specific file defines the PCI IDs table for that hardware module */
 extern struct pci_device_id iwl3945_hw_card_ids[];
 
@@ -155,7 +151,6 @@ struct iwl3945_frame {
 #define STATUS_HCMD_SYNC_ACTIVE	1	/* sync host command in progress */
 #define STATUS_INT_ENABLED	2
 #define STATUS_RF_KILL_HW	3
-#define STATUS_RF_KILL_SW	4
 #define STATUS_INIT		5
 #define STATUS_ALIVE		6
 #define STATUS_READY		7
drivers/net/wireless/iwlwifi/iwl-agn.c +12 -30

118 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-core.c +0 -138

156 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-core.h +1 -15
@@ -358,14 +358,6 @@ int iwl_txq_check_empty(struct iwl_priv 
  ****************************************************/
 int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force);
 
-/*****************************************************
- * RF -Kill - here and not in iwl-rfkill.h to be available when
- * RF-kill subsystem is not compiled.
- ****************************************************/
-void iwl_bg_rf_kill(struct work_struct *work);
-void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv);
-int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv);
-
 /*******************************************************************************
  * Rate
  ******************************************************************************/
@@ -508,7 +500,6 @@ void iwlcore_free_geos(struct iwl_priv *
 #define STATUS_HCMD_SYNC_ACTIVE	1	/* sync host command in progress */
 #define STATUS_INT_ENABLED	2
 #define STATUS_RF_KILL_HW	3
-#define STATUS_RF_KILL_SW	4
 #define STATUS_INIT		5
 #define STATUS_ALIVE		6
 #define STATUS_READY		7
@@ -543,11 +534,6 @@ static inline int iwl_is_init(struct iwl
 	return test_bit(STATUS_INIT, &priv->status);
 }
 
-static inline int iwl_is_rfkill_sw(struct iwl_priv *priv)
-{
-	return test_bit(STATUS_RF_KILL_SW, &priv->status);
-}
-
 static inline int iwl_is_rfkill_hw(struct iwl_priv *priv)
 {
 	return test_bit(STATUS_RF_KILL_HW, &priv->status);
@@ -555,7 +541,7 @@ static inline int iwl_is_rfkill_hw(struc
 
 static inline int iwl_is_rfkill(struct iwl_priv *priv)
 {
-	return iwl_is_rfkill_hw(priv) || iwl_is_rfkill_sw(priv);
+	return iwl_is_rfkill_hw(priv);
 }
 
 static inline int iwl_is_ready_rf(struct iwl_priv *priv)
drivers/net/wireless/iwlwifi/iwl-debugfs.c +0 -2
@@ -449,8 +449,6 @@ static ssize_t iwl_dbgfs_status_read(str
 		test_bit(STATUS_INT_ENABLED, &priv->status));
 	pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
 		test_bit(STATUS_RF_KILL_HW, &priv->status));
-	pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_SW:\t %d\n",
-		test_bit(STATUS_RF_KILL_SW, &priv->status));
 	pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
 		test_bit(STATUS_INIT, &priv->status));
 	pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
drivers/net/wireless/iwlwifi/iwl-dev.h +0 -5
@@ -41,7 +41,6 @@
 #include "iwl-prph.h"
 #include "iwl-fh.h"
 #include "iwl-debug.h"
-#include "iwl-rfkill.h"
 #include "iwl-4965-hw.h"
 #include "iwl-3945-hw.h"
 #include "iwl-3945-led.h"
@@ -937,9 +936,6 @@ struct iwl_priv {
 	 * 4965's initialize alive response contains some calibration data. */
 	struct iwl_init_alive_resp card_alive_init;
 	struct iwl_alive_resp card_alive;
-#if defined(CONFIG_IWLWIFI_RFKILL)
-	struct rfkill *rfkill;
-#endif
 
 #ifdef CONFIG_IWLWIFI_LEDS
 	unsigned long last_blink_time;
@@ -1073,7 +1069,6 @@ struct iwl_priv {
 	struct work_struct calibrated_work;
 	struct work_struct scan_completed;
 	struct work_struct rx_replenish;
-	struct work_struct rf_kill;
 	struct work_struct abort_scan;
 	struct work_struct update_link_led;
 	struct work_struct auth_work;
drivers/net/wireless/iwlwifi/iwl3945-base.c +6 -35

112 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-rfkill.c deleted +0 -131

131 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-rfkill.h deleted +0 -48

48 lines not on this page · raw message

drivers/net/wireless/iwlwifi/Makefile +0 -1
@@ -4,7 +4,6 @@ iwlcore-objs 		+= iwl-rx.o iwl-tx.o iwl-
 iwlcore-objs 		+= iwl-scan.o
 iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
 iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o
-iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o
 iwlcore-$(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) += iwl-spectrum.o
 
 obj-$(CONFIG_IWLAGN)	+= iwlagn.o
author maintainer
#5 lore raw

PATCH 2/3 ath9k: port to cfg80211 rfkill

In reply to Johannes Berg

This ports the ath9k rfkill code to the new API offered by cfg80211 and thus removes a lot of useless stuff.

---
 drivers/net/wireless/ath/ath9k/Kconfig |    1 
 drivers/net/wireless/ath/ath9k/ath9k.h |    9 ---
 drivers/net/wireless/ath/ath9k/hw.c    |   29 ++++------
 drivers/net/wireless/ath/ath9k/hw.h    |    3 -
 drivers/net/wireless/ath/ath9k/main.c  |   93 ++++-----------------------------
 5 files changed, 26 insertions(+), 109 deletions(-)
drivers/net/wireless/ath/ath9k/Kconfig +0 -1
@@ -1,7 +1,6 @@
 config ATH9K
 	tristate "Atheros 802.11n wireless cards support"
 	depends on PCI && MAC80211 && WLAN_80211
-	depends on RFKILL || RFKILL=n
 	select ATH_COMMON
 	select MAC80211_LEDS
 	select LEDS_CLASS
drivers/net/wireless/ath/ath9k/ath9k.h +0 -9
@@ -21,7 +21,6 @@
 #include <linux/device.h>
 #include <net/mac80211.h>
 #include <linux/leds.h>
-#include <linux/rfkill.h>
 
 #include "hw.h"
 #include "rc.h"
@@ -464,12 +463,6 @@ struct ath_led {
 	bool registered;
 };
 
-struct ath_rfkill {
-	struct rfkill *rfkill;
-	struct rfkill_ops ops;
-	char rfkill_name[32];
-};
-
 /********************/
 /* Main driver core */
 /********************/
@@ -509,7 +502,6 @@ struct ath_rfkill {
 #define SC_OP_PROTECT_ENABLE    BIT(6)
 #define SC_OP_RXFLUSH           BIT(7)
 #define SC_OP_LED_ASSOCIATED    BIT(8)
-#define SC_OP_RFKILL_REGISTERED BIT(9)
 #define SC_OP_WAIT_FOR_BEACON   BIT(12)
 #define SC_OP_LED_ON            BIT(13)
 #define SC_OP_SCANNING          BIT(14)
@@ -595,7 +587,6 @@ struct ath_softc {
 
 	int beacon_interval;
 
-	struct ath_rfkill rf_kill;
 	struct ath_ani ani;
 	struct ath9k_node_stats nodestats;
 #ifdef CONFIG_ATH9K_DEBUG
drivers/net/wireless/ath/ath9k/hw.c +13 -16
@@ -2186,6 +2186,18 @@ static void ath9k_hw_spur_mitigate(struc
 	REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
 }
 
+static void ath9k_enable_rfkill(struct ath_hw *ah)
+{
+	REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
+		    AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
+
+	REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
+		    AR_GPIO_INPUT_MUX2_RFSILENT);
+
+	ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
+	REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
+}
+
 int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
 		    bool bChannelChange)
 {
@@ -2313,10 +2325,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
 	ath9k_hw_init_interrupt_masks(ah, ah->opmode);
 	ath9k_hw_init_qos(ah);
 
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
 	if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
 		ath9k_enable_rfkill(ah);
-#endif
+
 	ath9k_hw_init_user_settings(ah);
 
 	REG_WRITE(ah, AR_STA_ID1,
@@ -3613,20 +3624,6 @@ void ath9k_hw_set_gpio(struct ath_hw *ah
 		AR_GPIO_BIT(gpio));
 }
 
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-void ath9k_enable_rfkill(struct ath_hw *ah)
-{
-	REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
-		    AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
-
-	REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
-		    AR_GPIO_INPUT_MUX2_RFSILENT);
-
-	ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
-	REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
-}
-#endif
-
 u32 ath9k_hw_getdefantenna(struct ath_hw *ah)
 {
 	return REG_READ(ah, AR_DEF_ANTENNA) & 0x7;
drivers/net/wireless/ath/ath9k/hw.h +0 -3
@@ -565,9 +565,6 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah,
 void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
 			 u32 ah_signal_type);
 void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-void ath9k_enable_rfkill(struct ath_hw *ah);
-#endif
 u32 ath9k_hw_getdefantenna(struct ath_hw *ah);
 void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
 bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
drivers/net/wireless/ath/ath9k/main.c +13 -80

146 lines not on this page · raw message

author maintainer
#15 lore raw

PATCH 3/3 b43/legacy: port to cfg80211 rfkill

In reply to Johannes Berg

This ports the b43/legacy rfkill code to the new API offered by cfg80211 and thus removes a lot of useless stuff.

Cc Michael Buesch <[email protected]>
Cc Larry Finger <[email protected]>
---
 drivers/net/wireless/b43/Kconfig           |    7 --
 drivers/net/wireless/b43/Makefile          |    2 
 drivers/net/wireless/b43/b43.h             |    3 
 drivers/net/wireless/b43/leds.c            |    2 
 drivers/net/wireless/b43/main.c            |   27 ++-----
 drivers/net/wireless/b43/phy_common.h      |    2 
 drivers/net/wireless/b43/rfkill.c          |   94 +--------------------------
 drivers/net/wireless/b43/rfkill.h          |   46 -------------
 drivers/net/wireless/b43legacy/Kconfig     |    8 --
 drivers/net/wireless/b43legacy/Makefile    |    2 
 drivers/net/wireless/b43legacy/b43legacy.h |    3 
 drivers/net/wireless/b43legacy/leds.c      |    2 
 drivers/net/wireless/b43legacy/main.c      |   17 +---
 drivers/net/wireless/b43legacy/rfkill.c    |   99 +----------------------------
 drivers/net/wireless/b43legacy/rfkill.h    |   51 --------------
 15 files changed, 29 insertions(+), 336 deletions(-)
drivers/net/wireless/b43/Kconfig +0 -7
@@ -98,13 +98,6 @@ config B43_LEDS
 	depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43)
 	default y
 
-# This config option automatically enables b43 RFKILL support,
-# if it's possible.
-config B43_RFKILL
-	bool
-	depends on B43 && (RFKILL = y || RFKILL = B43)
-	default y
-
 # This config option automatically enables b43 HW-RNG support,
 # if the HW-RNG core is enabled.
 config B43_HWRNG
drivers/net/wireless/b43/b43.h +0 -3
@@ -631,9 +631,6 @@ struct b43_wl {
 	char rng_name[30 + 1];
 #endif /* CONFIG_B43_HWRNG */
 
-	/* The RF-kill button */
-	struct b43_rfkill rfkill;
-
 	/* List of all wireless devices on this chip */
 	struct list_head devlist;
 	u8 nr_devs;
drivers/net/wireless/b43/main.c +8 -19
@@ -4298,7 +4298,6 @@ static int b43_op_start(struct ieee80211
 	struct b43_wldev *dev = wl->current_dev;
 	int did_init = 0;
 	int err = 0;
-	bool do_rfkill_exit = 0;
 
 	/* Kill all old instance specific information to make sure
 	 * the card won't use it in the short timeframe between start
@@ -4312,18 +4311,12 @@ static int b43_op_start(struct ieee80211
 	wl->beacon1_uploaded = 0;
 	wl->beacon_templates_virgin = 1;
 
-	/* First register RFkill.
-	 * LEDs that are registered later depend on it. */
-	b43_rfkill_init(dev);
-
 	mutex_lock(&wl->mutex);
 
 	if (b43_status(dev) < B43_STAT_INITIALIZED) {
 		err = b43_wireless_core_init(dev);
-		if (err) {
-			do_rfkill_exit = 1;
+		if (err)
 			goto out_mutex_unlock;
-		}
 		did_init = 1;
 	}
 
@@ -4332,17 +4325,16 @@ static int b43_op_start(struct ieee80211
 		if (err) {
 			if (did_init)
 				b43_wireless_core_exit(dev);
-			do_rfkill_exit = 1;
 			goto out_mutex_unlock;
 		}
 	}
 
+	/* XXX: only do if device doesn't support rfkill irq */
+	wiphy_rfkill_start_polling(hw->wiphy);
+
  out_mutex_unlock:
 	mutex_unlock(&wl->mutex);
 
-	if (do_rfkill_exit)
-		b43_rfkill_exit(dev);
-
 	return err;
 }
 
@@ -4351,7 +4343,6 @@ static void b43_op_stop(struct ieee80211
 	struct b43_wl *wl = hw_to_b43_wl(hw);
 	struct b43_wldev *dev = wl->current_dev;
 
-	b43_rfkill_exit(dev);
 	cancel_work_sync(&(wl->beacon_update_trigger));
 
 	mutex_lock(&wl->mutex);
@@ -4433,6 +4424,7 @@ static const struct ieee80211_ops b43_hw
 	.sta_notify		= b43_op_sta_notify,
 	.sw_scan_start		= b43_op_sw_scan_start_notifier,
 	.sw_scan_complete	= b43_op_sw_scan_complete_notifier,
+	.rfkill_poll		= b43_rfkill_poll,
 };
 
 /* Hard-reset the chip. Do not call this directly.
@@ -4920,7 +4912,7 @@ static struct ssb_driver b43_ssb_driver 
 static void b43_print_driverinfo(void)
 {
 	const char *feat_pci = "", *feat_pcmcia = "", *feat_nphy = "",
-		   *feat_leds = "", *feat_rfkill = "";
+		   *feat_leds = "";
 
 #ifdef CONFIG_B43_PCI_AUTOSELECT
 	feat_pci = "P";
@@ -4934,14 +4926,11 @@ static void b43_print_driverinfo(void)
 #ifdef CONFIG_B43_LEDS
 	feat_leds = "L";
 #endif
-#ifdef CONFIG_B43_RFKILL
-	feat_rfkill = "R";
-#endif
 	printk(KERN_INFO "Broadcom 43xx driver loaded "
-	       "[ Features: %s%s%s%s%s, Firmware-ID: "
+	       "[ Features: %s%s%s%s, Firmware-ID: "
 	       B43_SUPPORTED_FIRMWARE_ID " ]\n",
 	       feat_pci, feat_pcmcia, feat_nphy,
-	       feat_leds, feat_rfkill);
+	       feat_leds);
 }
 
 static int __init b43_init(void)
drivers/net/wireless/b43/rfkill.c +4 -90

115 lines not on this page · raw message

drivers/net/wireless/b43/rfkill.h +2 -44

51 lines not on this page · raw message

drivers/net/wireless/b43/Makefile +1 -1
@@ -13,7 +13,7 @@ b43-y				+= lo.o
 b43-y				+= wa.o
 b43-y				+= dma.o
 b43-$(CONFIG_B43_PIO)		+= pio.o
-b43-$(CONFIG_B43_RFKILL)	+= rfkill.o
+b43-y				+= rfkill.o
 b43-$(CONFIG_B43_LEDS)		+= leds.o
 b43-$(CONFIG_B43_PCMCIA)	+= pcmcia.o
 b43-$(CONFIG_B43_DEBUG)		+= debugfs.o
drivers/net/wireless/b43legacy/Kconfig +0 -8
@@ -42,14 +42,6 @@ config B43LEGACY_LEDS
 	depends on B43LEGACY && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43LEGACY)
 	default y
 
-# RFKILL support
-# This config option automatically enables b43legacy RFKILL support,
-# if it's possible.
-config B43LEGACY_RFKILL
-	bool
-	depends on B43LEGACY && (RFKILL = y || RFKILL = B43LEGACY)
-	default y
-
 # This config option automatically enables b43 HW-RNG support,
 # if the HW-RNG core is enabled.
 config B43LEGACY_HWRNG
drivers/net/wireless/b43legacy/Makefile +1 -1
@@ -6,7 +6,7 @@ b43legacy-y				+= radio.o
 b43legacy-y				+= sysfs.o
 b43legacy-y				+= xmit.o
 # b43 RFKILL button support
-b43legacy-$(CONFIG_B43LEGACY_RFKILL)	+= rfkill.o
+b43legacy-y				+= rfkill.o
 # b43legacy LED support
 b43legacy-$(CONFIG_B43LEGACY_LEDS)	+= leds.o
 # b43legacy debugging
drivers/net/wireless/b43legacy/main.c +4 -13
@@ -3431,11 +3431,6 @@ static int b43legacy_op_start(struct iee
 	struct b43legacy_wldev *dev = wl->current_dev;
 	int did_init = 0;
 	int err = 0;
-	bool do_rfkill_exit = 0;
-
-	/* First register RFkill.
-	 * LEDs that are registered later depend on it. */
-	b43legacy_rfkill_init(dev);
 
 	/* Kill all old instance specific information to make sure
 	 * the card won't use it in the short timeframe between start
@@ -3451,10 +3446,8 @@ static int b43legacy_op_start(struct iee
 
 	if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) {
 		err = b43legacy_wireless_core_init(dev);
-		if (err) {
-			do_rfkill_exit = 1;
+		if (err)
 			goto out_mutex_unlock;
-		}
 		did_init = 1;
 	}
 
@@ -3463,17 +3456,15 @@ static int b43legacy_op_start(struct iee
 		if (err) {
 			if (did_init)
 				b43legacy_wireless_core_exit(dev);
-			do_rfkill_exit = 1;
 			goto out_mutex_unlock;
 		}
 	}
 
+	wiphy_rfkill_start_polling(hw->wiphy);
+
 out_mutex_unlock:
 	mutex_unlock(&wl->mutex);
 
-	if (do_rfkill_exit)
-		b43legacy_rfkill_exit(dev);
-
 	return err;
 }
 
@@ -3482,7 +3473,6 @@ static void b43legacy_op_stop(struct iee
 	struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
 	struct b43legacy_wldev *dev = wl->current_dev;
 
-	b43legacy_rfkill_exit(dev);
 	cancel_work_sync(&(wl->beacon_update_trigger));
 
 	mutex_lock(&wl->mutex);
@@ -3518,6 +3508,7 @@ static const struct ieee80211_ops b43leg
 	.start			= b43legacy_op_start,
 	.stop			= b43legacy_op_stop,
 	.set_tim		= b43legacy_op_beacon_set_tim,
+	.rfkill_poll		= b43legacy_rfkill_poll,
 };
 
 /* Hard-reset the chip. Do not call this directly.
drivers/net/wireless/b43legacy/rfkill.c +4 -95

121 lines not on this page · raw message

drivers/net/wireless/b43legacy/rfkill.h +2 -49

57 lines not on this page · raw message

drivers/net/wireless/b43legacy/b43legacy.h +0 -3
@@ -602,9 +602,6 @@ struct b43legacy_wl {
 	char rng_name[30 + 1];
 #endif
 
-	/* The RF-kill button */
-	struct b43legacy_rfkill rfkill;
-
 	/* List of all wireless devices on this chip */
 	struct list_head devlist;
 	u8 nr_devs;
drivers/net/wireless/b43/phy_common.h +1 -1
@@ -1,7 +1,7 @@
 #ifndef LINUX_B43_PHY_COMMON_H_
 #define LINUX_B43_PHY_COMMON_H_
 
-#include <linux/rfkill.h>
+#include <linux/types.h>
 
 struct b43_wldev;
 
drivers/net/wireless/b43/leds.c +1 -1
@@ -164,7 +164,7 @@ static void b43_map_led(struct b43_wldev
 		snprintf(name, sizeof(name),
 			 "b43-%s::radio", wiphy_name(hw->wiphy));
 		b43_register_led(dev, &dev->led_radio, name,
-				 b43_rfkill_led_name(dev),
+				 ieee80211_get_radio_led_name(hw),
 				 led_index, activelow);
 		/* Sync the RF-kill LED state with the switch state. */
 		if (dev->radio_hw_enable)
drivers/net/wireless/b43legacy/leds.c +1 -1
@@ -164,7 +164,7 @@ static void b43legacy_map_led(struct b43
 		snprintf(name, sizeof(name),
 			 "b43legacy-%s::radio", wiphy_name(hw->wiphy));
 		b43legacy_register_led(dev, &dev->led_radio, name,
-				 b43legacy_rfkill_led_name(dev),
+				 ieee80211_get_radio_led_name(hw),
 				 led_index, activelow);
 		/* Sync the RF-kill LED state with the switch state. */
 		if (dev->radio_hw_enable)
#16 lore raw

Re: [RFT 3/3] b43/legacy: port to cfg80211 rfkill

Quoted 27 lines · On Tuesday 02 June 2009 13:10:30 Johannes Berg wrote:

This ports the b43/legacy rfkill code to the new API offered by cfg80211 and thus removes a lot of useless stuff.

Cc Michael Buesch <[email protected]>
Cc Larry Finger <[email protected]>
---
 drivers/net/wireless/b43/Kconfig           |    7 --
 drivers/net/wireless/b43/Makefile          |    2 
 drivers/net/wireless/b43/b43.h             |    3 
 drivers/net/wireless/b43/leds.c            |    2 
 drivers/net/wireless/b43/main.c            |   27 ++-----
 drivers/net/wireless/b43/phy_common.h      |    2 
 drivers/net/wireless/b43/rfkill.c          |   94 +--------------------------
 drivers/net/wireless/b43/rfkill.h          |   46 -------------
 drivers/net/wireless/b43legacy/Kconfig     |    8 --
 drivers/net/wireless/b43legacy/Makefile    |    2 
 drivers/net/wireless/b43legacy/b43legacy.h |    3 
 drivers/net/wireless/b43legacy/leds.c      |    2 
 drivers/net/wireless/b43legacy/main.c      |   17 +---
 drivers/net/wireless/b43legacy/rfkill.c    |   99 +----------------------------
 drivers/net/wireless/b43legacy/rfkill.h    |   51 --------------
 15 files changed, 29 insertions(+), 336 deletions(-)

drivers/net/wireless/b43/Kconfig config B43_LEDS · line 106

Quoted 9 lines
drivers/net/wireless/b43/Kconfig +0 -6
@@ -98,13 +98,6 @@ config B43_LEDS
 	depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43)
 	default y
 
-# This config option automatically enables b43 RFKILL support,
-# if it's possible.
-config B43_RFKILL
-	bool
-	depends on B43 && (RFKILL = y || RFKILL = B43)
-	default y

Don't you need to add a new "depends on" to "B43", if you remove this? Or is rfkill always compiled in if wireless is present?

Signature · 1 line
Greetings, Michael.
author maintainer
#17 lore raw

Re: [RFT 3/3] b43/legacy: port to cfg80211 rfkill

Quoted 6 lines · Michael Buesch
Quoted 6 lines
drivers/net/wireless/b43/Kconfig +0 -0
@@ -98,13 +98,6 @@ config B43_LEDS
 	depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43)
 	default y
 
Quoted 9 lines

drivers/net/wireless/b43/Kconfig config B43_LEDS · line 106

Quoted 6 lines
drivers/net/wireless/b43/Kconfig +0 -6
-# This config option automatically enables b43 RFKILL support,
-# if it's possible.
-config B43_RFKILL
-	bool
-	depends on B43 && (RFKILL = y || RFKILL = B43)
-	default y

Don't you need to add a new "depends on" to "B43", if you remove this? Or is rfkill always compiled in if wireless is present?

Well, rfkill isn't always present but the APIs are always present.

johannes

#18 lore raw

Re: [RFT 3/3] b43/legacy: port to cfg80211 rfkill

Quoted 18 lines · On Tuesday 02 June 2009 22:04:39 Johannes Berg wrote:
Quoted 6 lines · Michael Buesch
Quoted 6 lines
drivers/net/wireless/b43/Kconfig +0 -0
@@ -98,13 +98,6 @@ config B43_LEDS
 	depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43)
 	default y
 
Quoted 9 lines

drivers/net/wireless/b43/Kconfig config B43_LEDS · line 106

Quoted 6 lines
drivers/net/wireless/b43/Kconfig +0 -6
-# This config option automatically enables b43 RFKILL support,
-# if it's possible.
-config B43_RFKILL
-	bool
-	depends on B43 && (RFKILL = y || RFKILL = B43)
-	default y

Don't you need to add a new "depends on" to "B43", if you remove this? Or is rfkill always compiled in if wireless is present?

Quoted 1 line

Well, rfkill isn't always present but the APIs are always present.

Ok, makes sense, so I guess you rewrote the API. ;)

I'll ack this, if somebody with rfkill device tests it. Unfortunately I don't have such a device.

Signature · 1 line
Greetings, Michael.
author maintainer
#19 lore raw

Re: [RFT 3/3] b43/legacy: port to cfg80211 rfkill

Quoted 6 lines · Michael Buesch
Quoted 1 line

Well, rfkill isn't always present but the APIs are always present.

Ok, makes sense, so I guess you rewrote the API. ;)

I'll ack this, if somebody with rfkill device tests it. Unfortunately I don't have such a device.

Me neither, so I really need somebody to test this... I suspect there will be problems when the device is set down because of rfkill, and then we can no longer poll the rfkill hw state? But that might have been a problem before too, since if my suspicion is right we could never do:
* hw rfkill
* set if down
* hw un-rfkill
* set if up

and have it show the events to userspace as expected, or something...

johannes

#20 lore raw

Re: [RFT 3/3] b43/legacy: port to cfg80211 rfkill

Quoted 11 lines · Johannes Berg

Me neither, so I really need somebody to test this... I suspect there will be problems when the device is set down because of rfkill, and then we can no longer poll the rfkill hw state? But that might have been a problem before too, since if my suspicion is right we could never do:
* hw rfkill
* set if down
* hw un-rfkill
* set if up

and have it show the events to userspace as expected, or something...

I'm trying to test, but I get an oops on boot. I'm still tracking it and I lose the reason off the top of the screen, but the trace is:

queue_work + 0x1a
schedule_work + 0x16
rfkill_resume_polling + 0x23
wiphy_rfkill_start_polling + 0x35 (Line 452 of net/wireless/core.c) b43_op_start + 0x172 (Line 4336 of drivers/net/wireless/b43/main.c)

The offsets are appropriate for wireless-testing and x86_64. The line in b43_op_start is the one just before the mutex_unlock.

Is it possible that we reached this point without hw->wiphy being set?

Larry

author maintainer
#21 lore raw

Re: [RFT 3/3] b43/legacy: port to cfg80211 rfkill

Quoted 9 lines · Larry Finger

I'm trying to test, but I get an oops on boot. I'm still tracking it and I lose the reason off the top of the screen, but the trace is:

queue_work + 0x1a
schedule_work + 0x16
rfkill_resume_polling + 0x23
wiphy_rfkill_start_polling + 0x35 (Line 452 of net/wireless/core.c) b43_op_start + 0x172 (Line 4336 of drivers/net/wireless/b43/main.c)

Quoted 4 lines

The offsets are appropriate for wireless-testing and x86_64. The line in b43_op_start is the one just before the mutex_unlock.

Is it possible that we reached this point without hw->wiphy being set?

Thanks for testing. This doesn't happen on a current wireless-testing tree I hope? I'll look more into it tomorrow, need some sleep now.

johannes

#22 lore raw

Re: [RFT 3/3] b43/legacy: port to cfg80211 rfkill

Quoted 3 lines · Johannes Berg

Thanks for testing. This doesn't happen on a current wireless-testing tree I hope? I'll look more into it tomorrow, need some sleep now.

Unfortunately it does happen on the current w-t tree.

The oops is the statement BUG_ON(!list_empty(&work->entry)); at kernel/workqueue.c:192.

The following hack lets the computer boot with the BCM43XX device working, but obviously the radio kill switch does not work.

Larry

drivers/net/wireless/b43/main.c +1 -1
Index: wireless-testing/drivers/net/wireless/b43/main.c
===================================================================
@@ -4330,7 +4330,7 @@ static int b43_op_start(struct ieee80211
        }
 
        /* XXX: only do if device doesn't support rfkill irq */
-       wiphy_rfkill_start_polling(hw->wiphy);
+//     wiphy_rfkill_start_polling(hw->wiphy);
 
  out_mutex_unlock:
        mutex_unlock(&wl->mutex);
author maintainer
#23 lore raw

Re: [RFT 3/3] b43/legacy: port to cfg80211 rfkill

In reply to Larry Finger
Quoted 11 lines · Larry Finger

I'm trying to test, but I get an oops on boot. I'm still tracking it and I lose the reason off the top of the screen, but the trace is:

queue_work + 0x1a
schedule_work + 0x16
rfkill_resume_polling + 0x23
wiphy_rfkill_start_polling + 0x35 (Line 452 of net/wireless/core.c) b43_op_start + 0x172 (Line 4336 of drivers/net/wireless/b43/main.c)

The offsets are appropriate for wireless-testing and x86_64. The line in b43_op_start is the one just before the mutex_unlock.

Thanks for the hint about the BUG_ON() -- that was easy, I'm kinda abusing the rfkill API in cfg80211 but I think that ought to be possible. I'll send a patch.

johannes

#2 lore raw

Re: [RFT 1/3] iwlwifi: port to cfg80211 rfkill

In reply to Johannes Berg

Johannes,

Quoted 8 lines · Johannes Berg

This ports the iwlwifi rfkill code to the new API offered by cfg80211 and thus removes a lot of useless stuff. The soft- rfkill is completely removed since that is now handled by setting the interfaces down.

Cc Reinette Chatre <[email protected]>

---

* I tried this patch on top of latest wireless-testing (rc8 based) on a Sony laptop. After I bring the interface up I enabled rfkill and saw a gpf in the sony-laptop module (log is below). I tried this test many times after this and did not see this gpf again.

* I tried to load the modules with rfkill enabled and then disabled rfkill after interface up - that worked fine.

* In another test I had rfkill disabled and successfully associated with AP. I then enabled rfkill and was disassociated as expected. I then disabled rfkill again and used "iwconfig" to reassociate successfully.

* In another test rfkill was disabled and I associated with AP. I then enabled and disabled rfkill rapidly and did not loose association.

In summary the testing went very well. There was that one gpf that clouded the testing a bit. I have no idea how it can be connected to the rfkill work though because the error appear to be contained in the sony-laptop module.

Reinette

[  680.856249] PM: Adding info for platform:regulatory.0
[  680.856351] cfg80211: Using static regulatory domain info
[  680.856358] cfg80211: Regulatory domain: US
[  680.856362] 	(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[  680.856371] 	(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
[  680.856378] 	(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[  680.856386] 	(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[  680.856393] 	(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[  680.856400] 	(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[  680.856407] 	(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
[  680.856897] cfg80211: Calling CRDA for country: US
[  680.946854] cfg80211: Regulatory domain changed to country: US
[  680.946862] 	(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[  680.946871] 	(2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
[  680.946878] 	(5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
[  680.946886] 	(5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[  680.946893] 	(5490000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[  680.946901] 	(5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
[  681.002106] iwlagn: Intel(R) Wireless WiFi Link AGN driver for Linux, 1.3.27kds
[  681.002109] iwlagn: Copyright(c) 2003-2009 Intel Corporation
[  681.002262] iwlagn 0000:06:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[  681.002301] iwlagn 0000:06:00.0: setting latency timer to 64
[  681.002356] iwlagn 0000:06:00.0: Detected Intel Wireless WiFi Link 5100AGN REV=0x54
[  681.042422] iwlagn 0000:06:00.0: Tunable channels: 13 802.11bg, 24 802.11a channels
[  681.042514] iwlagn 0000:06:00.0: irq 30 for MSI/MSI-X
[  681.042840] PM: Adding info for No Bus:phy0
[  681.043112] PM: Adding info for No Bus:rfkill4
[  681.046709] PM: Adding info for No Bus:wmaster0
[  681.047776] phy0: Selected rate control algorithm 'iwl-agn-rs'
[  681.049477] PM: Adding info for No Bus:wlan0
[  681.050843] PM: Adding info for No Bus:rfkill5
[  688.674007] iwlagn 0000:06:00.0: firmware: requesting iwlwifi-5000-2.ucode
[  688.674495] PM: Adding info for No Bus:0000:06:00.0
[  688.706155] PM: Removing info for No Bus:0000:06:00.0
[  688.706893] iwlagn 0000:06:00.0: loaded firmware version 8.24.2.12
[  688.966303] PM: Adding info for No Bus:iwl-phy0::radio
[  688.967144] Registered led device: iwl-phy0::radio
[  688.967231] PM: Adding info for No Bus:iwl-phy0::assoc
[  688.967341] Registered led device: iwl-phy0::assoc
[  688.967453] PM: Adding info for No Bus:iwl-phy0::RX
[  688.967561] Registered led device: iwl-phy0::RX
[  688.967642] PM: Adding info for No Bus:iwl-phy0::TX
[  688.967749] Registered led device: iwl-phy0::TX
[  689.180640] phy0: device now idle
[  689.182350] ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  692.451576] phy0: device no longer idle - scanning
[  692.997766] cfg80211: Found new beacon on frequency: 5180 MHz (Ch 36) on phy0
[  693.031112] cfg80211: Found new beacon on frequency: 5200 MHz (Ch 40) on phy0
[  693.077197] cfg80211: Found new beacon on frequency: 5220 MHz (Ch 44) on phy0
[  693.142511] cfg80211: Found new beacon on frequency: 5240 MHz (Ch 48) on phy0
[  694.820445] cfg80211: Found new beacon on frequency: 5745 MHz (Ch 149) on phy0
[  694.851276] cfg80211: Found new beacon on frequency: 5765 MHz (Ch 153) on phy0
[  694.887420] cfg80211: Found new beacon on frequency: 5785 MHz (Ch 157) on phy0
[  694.911855] cfg80211: Found new beacon on frequency: 5805 MHz (Ch 161) on phy0
[  695.050393] phy0: device now idle
[  709.268874] iwlagn 0000:06:00.0: Radio Frequency Kill Switch is On:
[  709.268879] Kill switch must be turned off for wireless networking to work.
[  709.366404] general protection fault: 0000 [#1] SMP 
[  709.366551] last sysfs file: /sys/class/rfkill/rfkill5/state
[  709.366616] CPU 1 
[  709.366707] Modules linked in: iwlagn iwlcore led_class mac80211 cfg80211 i915 drm i2c_algo_bit i2c_core ppdev ipv6 acpi_cpufreq cpufreq_userspace cpufreq_powersave cpufreq_ondemand cpufreq_conservative cpufreq_stats freq_table container sbs sbshc lp parport arc4 ecb pcmcia joydev yenta_socket rsrc_nonstatic af_packet tpm_infineon sony_laptop psmouse iTCO_wdt iTCO_vendor_support pcmcia_core intel_agp video output tpm tpm_bios rfkill pcspkr serio_raw processor battery button ac evdev ext3 jbd mbcache sg sr_mod sd_mod cdrom ahci libata scsi_mod ehci_hcd uhci_hcd usbcore thermal fan thermal_sys fuse [last unloaded: cfg80211]
[  709.369182] Pid: 66, comm: kacpi_notify Not tainted 2.6.30-rc8-wl #40 VGN-Z540N
[  709.369182] RIP: 0010:[<ffffffffa0200dda>]  [<ffffffffa0200dda>] sony_nc_rfkill_set+0xa/0x40 [sony_laptop]
[  709.369182] RSP: 0018:ffff8800bb663dc0  EFLAGS: 00010286
[  709.369182] RAX: 0000000000000001 RBX: 0000000000000000 RCX: 0000000000000001
[  709.369182] RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff880036f74480
[  709.369182] RBP: ffff8800bb663dd0 R08: 0000000000000000 R09: 0000000000000000
[  709.369182] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
[  709.369182] R13: 0000000000000000 R14: 0000000000000000 R15: ffff8800bb663df0
[  709.369182] FS:  0000000000000000(0000) GS:ffff88000105e000(0000) knlGS:0000000000000000
[  709.369182] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[  709.369182] CR2: 00007ffff2051000 CR3: 00000000ba6b6000 CR4: 00000000000006e0
[  709.369182] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  709.369182] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  709.369182] Process kacpi_notify (pid: 66, threadinfo ffff8800bb662000, task ffff8800bb658f40)
[  709.369182] Stack:
[  709.369182]  0000000000000000 0000000000000000 ffff8800bb663e20 ffffffffa0203292
[  709.369182]  ffff8800bb659548 0000000000000246 0000000000000202 ffff8800b729e2f8
[  709.369182]  ffff8800b5371898 ffff8800bb658f40 ffff880001058ec0 ffffffff803b5596
[  709.369182] Call Trace:
[  709.369182]  [<ffffffffa0203292>] sony_nc_notify+0x222/0x260 [sony_laptop]
[  709.369182]  [<ffffffff803b5596>] ? acpi_os_execute_deferred+0x0/0x39
[  709.369182]  [<ffffffff803b8192>] acpi_device_notify+0x14/0x16
[  709.369182]  [<ffffffff803c5690>] acpi_ev_notify_dispatch+0x5f/0x6b
[  709.369182]  [<ffffffff803b55c2>] acpi_os_execute_deferred+0x2c/0x39
[  709.369182]  [<ffffffff8024d720>] worker_thread+0x1f0/0x340
[  709.369182]  [<ffffffff8024d6cd>] ? worker_thread+0x19d/0x340
[  709.369182]  [<ffffffff802525a0>] ? autoremove_wake_function+0x0/0x40
[  709.369182]  [<ffffffff80263a8d>] ? trace_hardirqs_on+0xd/0x10
[  709.369182]  [<ffffffff8024d530>] ? worker_thread+0x0/0x340
[  709.369182]  [<ffffffff8024d530>] ? worker_thread+0x0/0x340
[  709.369182]  [<ffffffff80252156>] kthread+0x56/0x90
[  709.369182]  [<ffffffff8020ce7a>] child_rip+0xa/0x20
[  709.369182]  [<ffffffff8020c87c>] ? restore_args+0x0/0x30
[  709.369182]  [<ffffffff80252100>] ? kthread+0x0/0x90
[  709.369182]  [<ffffffff8020ce70>] ? child_rip+0x0/0x20
[  709.369182] Code: e1 89 c2 48 c7 c6 36 4e 20 a0 e8 b2 fe ff ff 89 c2 89 d0 48 8b 1c 24 4c 8b 64 24 08 c9 c3 0f 1f 00 55 89 f2 48 89 e5 48 83 ec 10 <8b> 34 bd 80 3e 20 a0 bf 24 01 00 00 81 c6 00 01 00 00 89 f0 0d 
[  709.369182] RIP  [<ffffffffa0200dda>] sony_nc_rfkill_set+0xa/0x40 [sony_laptop]
[  709.369182]  RSP <ffff8800bb663dc0>
[  709.375883] ---[ end trace 6c116875da7d6347 ]---
[  709.432645] usb 6-2: USB disconnect, address 2
[  709.432753] PM: Removing info for No Bus:usbdev6.2_ep81
[  709.433263] PM: Removing info for No Bus:usbdev6.2_ep82
[  709.433600] PM: Removing info for No Bus:usbdev6.2_ep02
[  709.433922] PM: Removing info for usb:6-2:1.0
[  709.434237] PM: Removing info for No Bus:usbdev6.2_ep83
[  709.434548] PM: Removing info for No Bus:usbdev6.2_ep03
[  709.435449] PM: Removing info for usb:6-2:1.1
[  709.435886] PM: Removing info for No Bus:usbdev6.2_ep84
[  709.436237] PM: Removing info for No Bus:usbdev6.2_ep04
[  709.436596] PM: Removing info for usb:6-2:1.2
[  709.436932] PM: Removing info for usb:6-2:1.3
[  709.437280] PM: Removing info for No Bus:usbdev6.2_ep00
[  709.437654] PM: Removing info for usb:6-2
author maintainer
#3 lore raw

Re: [RFT 1/3] iwlwifi: port to cfg80211 rfkill

Reinette,

Thanks for the comprehensive test.

Quoted 12 lines

* I tried this patch on top of latest wireless-testing (rc8 based) on a Sony laptop. After I bring the interface up I enabled rfkill and saw a gpf in the sony-laptop module (log is below). I tried this test many times after this and did not see this gpf again.

* I tried to load the modules with rfkill enabled and then disabled rfkill after interface up - that worked fine.

* In another test I had rfkill disabled and successfully associated with AP. I then enabled rfkill and was disassociated as expected. I then disabled rfkill again and used "iwconfig" to reassociate successfully.

Quoted 7 lines

* In another test rfkill was disabled and I associated with AP. I then enabled and disabled rfkill rapidly and did not loose association.

In summary the testing went very well. There was that one gpf that clouded the testing a bit. I have no idea how it can be connected to the rfkill work though because the error appear to be contained in the sony-laptop module.

That looks like an error in sony-laptop, indeed. Should we go ahead with the iwlwifi part then?

Quoted 18 lines
[  709.366404] general protection fault: 0000 [#1] SMP 
[  709.366551] last sysfs file: /sys/class/rfkill/rfkill5/state
[  709.366616] CPU 1 
[  709.369182] Pid: 66, comm: kacpi_notify Not tainted 2.6.30-rc8-wl #40 VGN-Z540N
[  709.369182] RIP: 0010:[<ffffffffa0200dda>]  [<ffffffffa0200dda>] sony_nc_rfkill_set+0xa/0x40 [sony_laptop]
[  709.369182] RSP: 0018:ffff8800bb663dc0  EFLAGS: 00010286
[  709.369182] RAX: 0000000000000001 RBX: 0000000000000000 RCX: 0000000000000001
[  709.369182] RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff880036f74480
[  709.369182] RBP: ffff8800bb663dd0 R08: 0000000000000000 R09: 0000000000000000
[  709.369182] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
[  709.369182] R13: 0000000000000000 R14: 0000000000000000 R15: ffff8800bb663df0
[  709.369182] FS:  0000000000000000(0000) GS:ffff88000105e000(0000) knlGS:0000000000000000
[  709.369182] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[  709.369182] CR2: 00007ffff2051000 CR3: 00000000ba6b6000 CR4: 00000000000006e0
[  709.369182] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  709.369182] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  709.369182] Process kacpi_notify (pid: 66, threadinfo ffff8800bb662000, task ffff8800bb658f40)
Quoted 8 lines
[  709.369182] Stack:
[  709.369182]  0000000000000000 0000000000000000 ffff8800bb663e20 ffffffffa0203292
[  709.369182]  ffff8800bb659548 0000000000000246 0000000000000202 ffff8800b729e2f8
[  709.369182]  ffff8800b5371898 ffff8800bb658f40 ffff880001058ec0 ffffffff803b5596
[  709.369182] Call Trace:
[  709.369182]  [<ffffffffa0203292>] sony_nc_notify+0x222/0x260 [sony_laptop]
[  709.369182]  [<ffffffff803b5596>] ? acpi_os_execute_deferred+0x0/0x39
[  709.369182]  [<ffffffff803b8192>] acpi_device_notify+0x14/0x16

I wonder if sony has a race condition somewhere against itself.

johannes

#4 lore raw

Re: [RFT 1/3] iwlwifi: port to cfg80211 rfkill

Hi Johannes,

Quoted 7 lines · Johannes Berg
Quoted 4 lines

In summary the testing went very well. There was that one gpf that clouded the testing a bit. I have no idea how it can be connected to the rfkill work though because the error appear to be contained in the sony-laptop module.

That looks like an error in sony-laptop, indeed. Should we go ahead with the iwlwifi part then?

Please do. Please feel free to add my "tested-by" when you do so. Is it possible to get this into 2.6.31?

I'll submit a bug for the issue I saw in sony-laptop and try to help to get it resolved independently.

Reinette

#6 lore raw

Re: [RFT 2/3] ath9k: port to cfg80211 rfkill

In reply to Johannes Berg
Quoted 3 lines · Johannes Berg

This ports the ath9k rfkill code to the new API offered by cfg80211 and thus removes a lot of useless stuff.

I get the following lockdep warning few times when tried to scan after rfkill on/off. One more issue is, when rfkill is enabled before reboot, I could not bring up the interface when the rfkill is turned off after reboot. Apart from this it looks good, fixes a panic which used to happen during module unload.

757.714408]

[  757.714410]
=======================================================
[  757.714414] [ INFO: possible circular locking dependency detected
]
[  757.714418] 2.6.30-rc8-wl #87
[  757.714420]
-------------------------------------------------------
[  757.714423] iwlist/3121 is trying to acquire lock:
[  757.714425]  (cfg80211_mutex){+.+.+.}, at: [<f8952c1d>]
cfg80211_get_dev_from_ifindex+0x1d/0x80 [cfg80211]
[  757.714439] 
[  757.714440] but task is already holding lock:
[  757.714443]  (rtnl_mutex){+.+.+.}, at: [<c0307824>]
rtnl_lock+0x14/0x20
[  757.714453] 
[  757.714453] which lock already depends on the new lock.
[  757.714454] 
[  757.714457] 
[  757.714457] the existing dependency chain (in reverse order) is:
[  757.714460] 
[  757.714461] -> #2 (rtnl_mutex){+.+.+.}:
[  757.714466]        [<c015e17e>] __lock_acquire+0xece/0x1780
[  757.714473]        [<c015eb10>] lock_acquire+0xe0/0x110
[  757.714477]        [<c03bac0e>] mutex_lock_nested+0x5e/0x360
[  757.714484]        [<c0307824>] rtnl_lock+0x14/0x20
[  757.714488]        [<fbfc99cd>] 0xfbfc99cd
[  757.714501]        [<f9d2d975>] rfkill_set_block+0x65/0xd0
[rfkill]
[  757.714509]        [<f9d2dcd4>] rfkill_epo+0x44/0xa0 [rfkill]
[  757.714515]        [<f9d2e7ed>] rfkill_op_handler+0x5d/0x1c0
[rfkill]
[  757.714522]        [<c01459b0>] worker_thread+0x1c0/0x2f0
[  757.714528]        [<c0149deb>] kthread+0x4b/0x80
[  757.714532]        [<c01045e3>] kernel_thread_helper+0x7/0x10
[  757.714538]        [<ffffffff>] 0xffffffff
[  757.714545] 
[  757.714545] -> #1 (rfkill_global_mutex){+.+.+.}:
[  757.714550]        [<c015e17e>] __lock_acquire+0xece/0x1780
[  757.714555]        [<c015eb10>] lock_acquire+0xe0/0x110
[  757.714559]        [<c03bac0e>] mutex_lock_nested+0x5e/0x360
[  757.714564]        [<f9d2e3c4>] rfkill_register+0x24/0x270
[rfkill]
[  757.714572]        [<f89526e1>] wiphy_register+0x181/0x230
[cfg80211]
[  757.714579]        [<f8a05376>] ieee80211_register_hw+0x136/0x4d0
[mac80211]
[  757.714593]        [<f8a6b02c>] ath_attach+0x74c/0xa20 [ath9k]
[  757.714605]        [<f8a7300c>] ath_pci_probe+0x12c/0x2e0 [ath9k]
[  757.714614]        [<c02650c3>] local_pci_probe+0x13/0x20
[  757.714620]        [<c0265f78>] pci_device_probe+0x68/0x90
[  757.714625]        [<c02ce131>] driver_probe_device+0x71/0x170
[  757.714631]        [<c02ce2b9>] __driver_attach+0x89/0xa0
[  757.714635]        [<c02cd9bb>] bus_for_each_dev+0x5b/0x80
[  757.714639]        [<c02cdfde>] driver_attach+0x1e/0x20
[  757.714644]        [<c02cd2f7>] bus_add_driver+0x237/0x2f0
[  757.714648]        [<c02ce59a>] driver_register+0x7a/0x150
[  757.714652]        [<c02663d3>] __pci_register_driver+0x53/0xc0
[  757.714657]        [<f8a731dc>] ath_pci_init+0x1c/0x20 [ath9k]
[  757.714666]        [<f88c0022>] 0xf88c0022
[  757.714678]        [<c010112b>] do_one_initcall+0x2b/0x1c0
[  757.714682]        [<c0167c2a>] sys_init_module+0x8a/0x1d0
[  757.714687]        [<c0103b08>] sysenter_do_call+0x12/0x3c
[  757.714691]        [<ffffffff>] 0xffffffff
[  757.714709] 
[  757.714710] -> #0 (cfg80211_mutex){+.+.+.}:
[  757.714715]        [<c015e2b3>] __lock_acquire+0x1003/0x1780
[  757.714720]        [<c015eb10>] lock_acquire+0xe0/0x110
[  757.714724]        [<c03bac0e>] mutex_lock_nested+0x5e/0x360
[  757.714729]        [<f8952c1d>]
cfg80211_get_dev_from_ifindex+0x1d/0x80 [cfg80211]
[  757.714737]        [<f8956053>] cfg80211_wext_siwscan+0x43/0x210
[cfg80211]
[  757.714746]        [<c03a32a1>] ioctl_standard_call+0x1a1/0x3a0
[  757.714751]        [<c03a2daf>] wext_handle_ioctl+0x14f/0x220
[  757.714756]        [<c02ff325>] dev_ioctl+0x485/0x560
[  757.714760]        [<c02ec105>] sock_ioctl+0xf5/0x270
[  757.714765]        [<c01d22dd>] vfs_ioctl+0x2d/0x90
[  757.714771]        [<c01d23ba>] do_vfs_ioctl+0x7a/0x590
[  757.714775]        [<c01d293b>] sys_ioctl+0x6b/0x70
[  757.714779]        [<c0103b08>] sysenter_do_call+0x12/0x3c
[  757.714784]        [<ffffffff>] 0xffffffff
[  757.714795] 
[  757.714796] other info that might help us debug this:
[  757.714797] 
[  757.714799] 1 lock held by iwlist/3121:
[  757.714802]  #0:  (rtnl_mutex){+.+.+.}, at: [<c0307824>]
rtnl_lock+0x14/0x20
[  757.714809] 
[  757.714810] stack backtrace:
[  757.714813] Pid: 3121, comm: iwlist Not tainted 2.6.30-rc8-wl #87
[  757.714816] Call Trace:
[  757.714820]  [<c03b8f7f>] ? printk+0x1d/0x26
[  757.714825]  [<c015cddc>] print_circular_bug_tail+0xbc/0xc0
[  757.714829]  [<c015cb1b>] ? print_circular_bug_entry+0x4b/0x50
[  757.714834]  [<c015e2b3>] __lock_acquire+0x1003/0x1780
[  757.714839]  [<c015d3fd>] ? __lock_acquire+0x14d/0x1780
[  757.714848]  [<f8952c1d>] ?
cfg80211_get_dev_from_ifindex+0x1d/0x80 [cfg80211]
[  757.714852]  [<c015eb10>] lock_acquire+0xe0/0x110
[  757.714859]  [<f8952c1d>] ?
cfg80211_get_dev_from_ifindex+0x1d/0x80 [cfg80211]
[  757.714867]  [<f8952c1d>] ?
cfg80211_get_dev_from_ifindex+0x1d/0x80 [cfg80211]
[  757.714871]  [<c03bac0e>] mutex_lock_nested+0x5e/0x360
[  757.714878]  [<f8952c1d>] ?
cfg80211_get_dev_from_ifindex+0x1d/0x80 [cfg80211]
[  757.714883]  [<c015c282>] ? mark_held_locks+0x62/0x80
[  757.714888]  [<c01bf89c>] ? __kmalloc+0x9c/0x250
[  757.714895]  [<f8952c1d>] cfg80211_get_dev_from_ifindex+0x1d/0x80
[cfg80211]
[  757.714903]  [<f8956053>] cfg80211_wext_siwscan+0x43/0x210
[cfg80211]
[  757.714907]  [<c03a326b>] ? ioctl_standard_call+0x16b/0x3a0
[  757.714912]  [<c03a326b>] ? ioctl_standard_call+0x16b/0x3a0
[  757.714916]  [<c03a32a1>] ioctl_standard_call+0x1a1/0x3a0
[  757.714920]  [<c0307824>] ? rtnl_lock+0x14/0x20
[  757.714926]  [<c02fa905>] ? __dev_get_by_name+0x85/0xb0
[  757.714930]  [<c03a2daf>] wext_handle_ioctl+0x14f/0x220
[  757.714938]  [<f8956010>] ? cfg80211_wext_siwscan+0x0/0x210
[cfg80211]
[  757.714942]  [<c02ff325>] dev_ioctl+0x485/0x560
[  757.714947]  [<c02ec010>] ? sock_ioctl+0x0/0x270
[  757.714951]  [<c02ec105>] sock_ioctl+0xf5/0x270
[  757.714955]  [<c02ec010>] ? sock_ioctl+0x0/0x270
[  757.714959]  [<c01d22dd>] vfs_ioctl+0x2d/0x90
[  757.714964]  [<c01d23ba>] do_vfs_ioctl+0x7a/0x590
[  757.714969]  [<c01abf26>] ? handle_mm_fault+0x126/0x740
[  757.714975]  [<c0120bce>] ? do_page_fault+0x17e/0x2c0
[  757.714980]  [<c02555fc>] ? trace_hardirqs_off_thunk+0xc/0x10
[  757.714984]  [<c02555ec>] ? trace_hardirqs_on_thunk+0xc/0x10
[  757.714989]  [<c014e8bb>] ? up_read+0x1b/0x30
[  757.714993]  [<c0103b41>] ? sysenter_exit+0xf/0x1a
[  757.714997]  [<c01d293b>] sys_ioctl+0x6b/0x70
[  757.715001]  [<c0103b08>] sysenter_do_call+0x12/0x3c
[  757.715011] phy0: device no longer idle - scanning
[  758.876667] wlan0: dropped data frame to not associated station
00:00:00:00:00:00
[  763.813869] phy0: device now idle
#7 lore raw

Re: [RFT 2/3] ath9k: port to cfg80211 rfkill

Quoted 46 lines · Vasanth Thiagarajan
Quoted 3 lines · Johannes Berg

This ports the ath9k rfkill code to the new API offered by cfg80211 and thus removes a lot of useless stuff.

I get the following lockdep warning few times when tried to scan after rfkill on/off. One more issue is, when rfkill is enabled before reboot, I could not bring up the interface when the rfkill is turned off after reboot. Apart from this it looks good, fixes a panic which used to happen during module unload.

[  757.714466]        [<c015e17e>] __lock_acquire+0xece/0x1780
[  757.714473]        [<c015eb10>] lock_acquire+0xe0/0x110
[  757.714477]        [<c03bac0e>] mutex_lock_nested+0x5e/0x360
[  757.714484]        [<c0307824>] rtnl_lock+0x14/0x20
[  757.714488]        [<fbfc99cd>] 0xfbfc99cd
[  757.714501]        [<f9d2d975>] rfkill_set_block+0x65/0xd0
[rfkill]
[  757.714509]        [<f9d2dcd4>] rfkill_epo+0x44/0xa0 [rfkill]
[  757.714515]        [<f9d2e7ed>] rfkill_op_handler+0x5d/0x1c0
[rfkill]
[  757.714522]        [<c01459b0>] worker_thread+0x1c0/0x2f0
[  757.714528]        [<c0149deb>] kthread+0x4b/0x80
[  757.714532]        [<c01045e3>] kernel_thread_helper+0x7/0x10
[  757.714538]        [<ffffffff>] 0xffffffff
[  757.714545]
[  757.714545] -> #1 (rfkill_global_mutex){+.+.+.}:
[  757.714550]        [<c015e17e>] __lock_acquire+0xece/0x1780
[  757.714555]        [<c015eb10>] lock_acquire+0xe0/0x110
[  757.714559]        [<c03bac0e>] mutex_lock_nested+0x5e/0x360
[  757.714564]        [<f9d2e3c4>] rfkill_register+0x24/0x270
[rfkill]
[  757.714572]        [<f89526e1>] wiphy_register+0x181/0x230
[cfg80211]
[  757.714579]        [<f8a05376>] ieee80211_register_hw+0x136/0x4d0
[mac80211]
[  757.714593]        [<f8a6b02c>] ath_attach+0x74c/0xa20 [ath9k]
[  757.714605]        [<f8a7300c>] ath_pci_probe+0x12c/0x2e0 [ath9k]
[  757.714614]        [<c02650c3>] local_pci_probe+0x13/0x20
[  757.714620]        [<c0265f78>] pci_device_probe+0x68/0x90
[  757.714625]        [<c02ce131>] driver_probe_device+0x71/0x170
[  757.714631]        [<c02ce2b9>] __driver_attach+0x89/0xa0
[  757.714635]        [<c02cd9bb>] bus_for_each_dev+0x5b/0x80
[  757.714639]        [<c02cdfde>] driver_attach+0x1e/0x20
[  757.714644]        [<c02cd2f7>] bus_add_driver+0x237/0x2f0
[  757.714648]        [<c02ce59a>] driver_register+0x7a/0x150
Quoted 8 lines
[  757.714652]        [<c02663d3>] __pci_register_driver+0x53/0xc0
[  757.714657]        [<f8a731dc>] ath_pci_init+0x1c/0x20 [ath9k]
[  757.714666]        [<f88c0022>] 0xf88c0022
[  757.714678]        [<c010112b>] do_one_initcall+0x2b/0x1c0
[  757.714682]        [<c0167c2a>] sys_init_module+0x8a/0x1d0
[  757.714687]        [<c0103b08>] sysenter_do_call+0x12/0x3c
[  757.714691]        [<ffffffff>] 0xffffffff
[  757.714709]

I was doing load/unload along with rf on/off and scan.

author maintainer
#8 lore raw

Re: [RFT 2/3] ath9k: port to cfg80211 rfkill

In reply to Vasanthakumar Thiagarajan
Quoted 7 lines · Vasanthakumar Thiagarajan
Quoted 3 lines · Johannes Berg

This ports the ath9k rfkill code to the new API offered by cfg80211 and thus removes a lot of useless stuff.

I get the following lockdep warning few times when tried to scan after rfkill on/off.

Thanks, will fix, this doesn't seem to be ath9k specific. It's the dreaded locking in rfkill. I can work around it easily in cfg80211, or fix rfkill, will see what's easier.

Quoted 3 lines

One more issue is, when rfkill is enabled before
reboot, I could not bring up the interface when the rfkill is turned off after reboot.

Sounds like the driver doesn't initialise properly. Hmm, maybe we just need to move ath_start_rfkill_poll() to ath_attach(), could you please try that?

Quoted 2 lines

Apart from this it looks good, fixes a panic which used to happen during module unload.

Heh.

Thanks,
johannes

#9 lore raw

Re: [RFT 2/3] ath9k: port to cfg80211 rfkill

Quoted 4 lines · Johannes Berg

Thanks, will fix, this doesn't seem to be ath9k specific. It's the dreaded locking in rfkill. I can work around it easily in cfg80211, or fix rfkill, will see what's easier.

Thanks.

Quoted 6 lines
Quoted 4 lines

One more issue is, when rfkill is enabled before
reboot, I could not bring up the interface when the rfkill is turned off after reboot.

Sounds like the driver doesn't initialise properly.

I dont think this one is driver specific as this happens only when module is loaded at boot time. I works fine after ath9k is reloaded.

Quoted 2 lines

need to move ath_start_rfkill_poll() to ath_attach(), could you please try that?

We do hw reset during radio enable/disable, this needs current channel to be configured but i'm not sure if we need to do all these during attach time.

Thanks,

Vasanth

author maintainer
#10 lore raw

Re: [RFT 2/3] ath9k: port to cfg80211 rfkill

Quoted 9 lines · Vasanthakumar Thiagarajan
Quoted 5 lines
Quoted 3 lines

One more issue is, when rfkill is enabled before
reboot, I could not bring up the interface when the rfkill is turned off after reboot.

Sounds like the driver doesn't initialise properly.

I dont think this one is driver specific as this happens only when module is loaded at boot time. I works fine after ath9k is reloaded.

That's strange. I don't see anything in the core that would behave differently between those two paths.

Quoted 6 lines
Quoted 2 lines

need to move ath_start_rfkill_poll() to ath_attach(), could you please try that?

We do hw reset during radio enable/disable, this needs current channel to be configured but i'm not sure if we need to do all these during attach time.

Well, the thing is that currently ath_start_rfkill_poll() will never be called until you try bringing the interface up, afaict?

johannes

#11 lore raw

Re: [RFT 2/3] ath9k: port to cfg80211 rfkill

Quoted 3 lines · Johannes Berg

Well, the thing is that currently ath_start_rfkill_poll() will never be called until you try bringing the interface up, afaict?

right.

Vasanth

author maintainer
#12 lore raw

Re: [RFT 2/3] ath9k: port to cfg80211 rfkill

Quoted 6 lines · Vasanthakumar Thiagarajan
Quoted 3 lines · Johannes Berg

Well, the thing is that currently ath_start_rfkill_poll() will never be called until you try bringing the interface up, afaict?

right.

But that's undesirable, especially if for some reason we already know it's in rfkill, we really want to know about the rfkill state even when the interface is down so userspace can properly react to it and not even give the user the option of bringing the interfaces up.

Hence my suggestion of moving the start_polling().

johannes

#13 lore raw

Re: [RFT 2/3] ath9k: port to cfg80211 rfkill

Quoted 7 lines · Johannes Berg

But that's undesirable, especially if for some reason we already know it's in rfkill, we really want to know about the rfkill state even when the interface is down so userspace can properly react to it and not even give the user the option of bringing the interfaces up.

Hence my suggestion of moving the start_polling().

I agree, will move it to ath9k_start().

Vasanth

#14 lore raw

Re: [RFT 2/3] ath9k: port to cfg80211 rfkill

Quoted 11 lines · Vasanth Thiagarajan
Quoted 7 lines · Johannes Berg

But that's undesirable, especially if for some reason we already know it's in rfkill, we really want to know about the rfkill state even when the interface is down so userspace can properly react to it and not even give the user the option of bringing the interfaces up.

Hence my suggestion of moving the start_polling().

I agree, will move it to ath9k_start().

sorry, to ath_attach();