Sorry for last patch have no description. 1. when driver init, rfkill_state was setted, but because the flag valid may not be true, this will cause rfkill_state not synchronous with the true rf state, and will cause some issues when we do rfkill. and now in driver init we will set rfkill_state to rf_on, and at the same time we tell rfkill to set rf_on also. 2. for rtl8192ce you can check GPIO any time, not only after up_first_time == true. so we delete rtlpci->up_first_time in rtl92ce_gpio_radio_on_off_checking. Signed-off-by: chaoming_li <chaoming_li@xxxxxxxxxxxxxx> --- drivers/net/wireless/rtlwifi/base.c | 13 ++++++++----- drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index cf0b73e..33323b4 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c @@ -251,15 +251,18 @@ void rtl_init_rfkill(struct ieee80211_hw *hw) bool blocked; u8 valid = 0; - radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid); + /*1. set init state to on */ + rtlpriv->rfkill.rfkill_state = 1; + wiphy_rfkill_set_hw_state(hw->wiphy, 0); - /*set init state to that of switch */ - rtlpriv->rfkill.rfkill_state = radio_state; - printk(KERN_INFO "rtlwifi: wireless switch is %s\n", - rtlpriv->rfkill.rfkill_state ? "on" : "off"); + /*2. check gpio for rf state */ + radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid); + /*3. if valid, change state based on gpio */ if (valid) { rtlpriv->rfkill.rfkill_state = radio_state; + printk(KERN_INFO "rtlwifi: wireless switch is %s\n", + rtlpriv->rfkill.rfkill_state ? "on" : "off"); blocked = (rtlpriv->rfkill.rfkill_state == 1) ? 0 : 1; wiphy_rfkill_set_hw_state(hw->wiphy, blocked); diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c index 1c41a0c..cb2e01a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c @@ -1943,7 +1943,7 @@ bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid) bool b_actuallyset = false; unsigned long flag; - if ((rtlpci->up_first_time == 1) || (rtlpci->being_init_adapter)) + if (rtlpci->being_init_adapter) return false; if (ppsc->b_swrf_processing) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html