Skip to content

Commit 616a839

Browse files
sgruszkalinvjw
authored andcommitted
rt2x00: fix rfkill regression on rt2500pci
As reported by Niels, starting rfkill polling during device probe (commit e2bc7c5, 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: e2bc7c5 ("rt2x00: Fix rfkill_polling register function.") Cc: stable@vger.kernel.org Bisected-by: Niels <nille0386@googlemail.com> Reported-and-tested-by: Niels <nille0386@googlemail.com> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 2fc68eb commit 616a839

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

drivers/net/wireless/rt2x00/rt2500pci.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,8 +1681,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
16811681
/*
16821682
* Detect if this device has an hardware controlled radio.
16831683
*/
1684-
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
1684+
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) {
16851685
__set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
1686+
/*
1687+
* On this device RFKILL initialized during probe does not work.
1688+
*/
1689+
__set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags);
1690+
}
16861691

16871692
/*
16881693
* Check if the BBP tuning should be enabled.

drivers/net/wireless/rt2x00/rt2x00.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ enum rt2x00_capability_flags {
693693
REQUIRE_SW_SEQNO,
694694
REQUIRE_HT_TX_DESC,
695695
REQUIRE_PS_AUTOWAKE,
696+
REQUIRE_DELAYED_RFKILL,
696697

697698
/*
698699
* Capabilities

drivers/net/wireless/rt2x00/rt2x00dev.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,9 +1126,10 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
11261126
return;
11271127

11281128
/*
1129-
* Unregister extra components.
1129+
* Stop rfkill polling.
11301130
*/
1131-
rt2x00rfkill_unregister(rt2x00dev);
1131+
if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1132+
rt2x00rfkill_unregister(rt2x00dev);
11321133

11331134
/*
11341135
* Allow the HW to uninitialize.
@@ -1166,6 +1167,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
11661167

11671168
set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
11681169

1170+
/*
1171+
* Start rfkill polling.
1172+
*/
1173+
if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1174+
rt2x00rfkill_register(rt2x00dev);
1175+
11691176
return 0;
11701177
}
11711178

@@ -1375,7 +1382,12 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
13751382
rt2x00link_register(rt2x00dev);
13761383
rt2x00leds_register(rt2x00dev);
13771384
rt2x00debug_register(rt2x00dev);
1378-
rt2x00rfkill_register(rt2x00dev);
1385+
1386+
/*
1387+
* Start rfkill polling.
1388+
*/
1389+
if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1390+
rt2x00rfkill_register(rt2x00dev);
13791391

13801392
return 0;
13811393

@@ -1390,6 +1402,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
13901402
{
13911403
clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
13921404

1405+
/*
1406+
* Stop rfkill polling.
1407+
*/
1408+
if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1409+
rt2x00rfkill_unregister(rt2x00dev);
1410+
13931411
/*
13941412
* Disable radio.
13951413
*/

0 commit comments

Comments
 (0)