On Fri, Oct 25, 2013 at 01:17:59PM +0200, Johannes Berg wrote: > On Fri, 2013-10-25 at 12:37 +0200, Stanislaw Gruszka wrote: > > We can mess logs if user space try to open device again and again if > > RFKILL switch is on. Do not print message and return ERFKILL error > > instead to indicate where the problem is. > > Are you maybe not calling wiphy_rfkill_set_hw_state() in the right > places? This is done from work scheduled every 2 second if rfkill state change, but is possible that initial state is not provided to upper layer. Dietmar or Pedro, could you test attached patch (my old laptop with 3945 does not work any longer). It is alternative to previous patch posted before, does rfkill work ok with it? Stanislaw
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index dea3b50..74e2b0a 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c @@ -2202,6 +2202,9 @@ il3945_alive_start(struct il_priv *il) } else set_bit(S_RFKILL, &il->status); + wiphy_rfkill_set_hw_state(il->hw->wiphy, + test_bit(S_RFKILL, &il->status)); + /* After the ALIVE response, we can send commands to 3945 uCode */ set_bit(S_ALIVE, &il->status); @@ -2397,7 +2400,7 @@ __il3945_up(struct il_priv *il) else { set_bit(S_RFKILL, &il->status); IL_WARN("Radio disabled by HW RF Kill switch\n"); - return -ENODEV; + return 0; } _il_wr(il, CSR_INT, 0xFFFFFFFF); @@ -2825,6 +2828,9 @@ il3945_mac_start(struct ieee80211_hw *hw) if (ret) goto out_release_irq; + if (il_is_rfkill(il)) + goto out; + D_INFO("Start UP work.\n"); /* Wait for START_ALIVE from ucode. Otherwise callbacks from @@ -2845,6 +2851,7 @@ il3945_mac_start(struct ieee80211_hw *hw) * no need to poll the killswitch state anymore */ cancel_delayed_work(&il->_3945.rfkill_poll); +out: il->is_open = 1; D_MAC80211("leave\n"); return 0;