Commit 616a8394 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville

rt2x00: fix rfkill regression on rt2500pci

As reported by Niels, starting rfkill polling during device probe
(commit e2bc7c5f, generally sane change) broke rfkill on rt2500pci
device. I considered that bug as some initalization issue, which
should be fixed on rt2500pci specific code. But after several
attempts (see bug report for details) we fail to find working solution.
Hence I decided to revert to old behaviour on rt2500pci to fix
regression.

Additionally patch also unregister rfkill on device remove instead
of ifconfig down, what was another issue introduced by bad commit.

Bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=73821

Fixes: e2bc7c5f ("rt2x00: Fix rfkill_polling register function.")
Cc: stable@vger.kernel.org
Bisected-by: default avatarNiels <nille0386@googlemail.com>
Reported-and-tested-by: default avatarNiels <nille0386@googlemail.com>
Signed-off-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 2fc68eb1
...@@ -1681,8 +1681,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) ...@@ -1681,8 +1681,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
/* /*
* Detect if this device has an hardware controlled radio. * Detect if this device has an hardware controlled radio.
*/ */
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) {
__set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
/*
* On this device RFKILL initialized during probe does not work.
*/
__set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags);
}
/* /*
* Check if the BBP tuning should be enabled. * Check if the BBP tuning should be enabled.
......
...@@ -693,6 +693,7 @@ enum rt2x00_capability_flags { ...@@ -693,6 +693,7 @@ enum rt2x00_capability_flags {
REQUIRE_SW_SEQNO, REQUIRE_SW_SEQNO,
REQUIRE_HT_TX_DESC, REQUIRE_HT_TX_DESC,
REQUIRE_PS_AUTOWAKE, REQUIRE_PS_AUTOWAKE,
REQUIRE_DELAYED_RFKILL,
/* /*
* Capabilities * Capabilities
......
...@@ -1126,8 +1126,9 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) ...@@ -1126,8 +1126,9 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
return; return;
/* /*
* Unregister extra components. * Stop rfkill polling.
*/ */
if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
rt2x00rfkill_unregister(rt2x00dev); rt2x00rfkill_unregister(rt2x00dev);
/* /*
...@@ -1166,6 +1167,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) ...@@ -1166,6 +1167,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
/*
* Start rfkill polling.
*/
if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
rt2x00rfkill_register(rt2x00dev);
return 0; return 0;
} }
...@@ -1375,6 +1382,11 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) ...@@ -1375,6 +1382,11 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
rt2x00link_register(rt2x00dev); rt2x00link_register(rt2x00dev);
rt2x00leds_register(rt2x00dev); rt2x00leds_register(rt2x00dev);
rt2x00debug_register(rt2x00dev); rt2x00debug_register(rt2x00dev);
/*
* Start rfkill polling.
*/
if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
rt2x00rfkill_register(rt2x00dev); rt2x00rfkill_register(rt2x00dev);
return 0; return 0;
...@@ -1390,6 +1402,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) ...@@ -1390,6 +1402,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
{ {
clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
/*
* Stop rfkill polling.
*/
if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
rt2x00rfkill_unregister(rt2x00dev);
/* /*
* Disable radio. * Disable radio.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment