aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/rfkill.c16
-rw-r--r--drivers/net/wireless/b43legacy/rfkill.h8
3 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 8133efa5a57e..2b888960c3d7 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3384,7 +3384,6 @@ static int b43legacy_setup_modes(struct b43legacy_wldev *dev,
3384 3384
3385static void b43legacy_wireless_core_detach(struct b43legacy_wldev *dev) 3385static void b43legacy_wireless_core_detach(struct b43legacy_wldev *dev)
3386{ 3386{
3387 b43legacy_rfkill_free(dev);
3388 /* We release firmware that late to not be required to re-request 3387 /* We release firmware that late to not be required to re-request
3389 * is all the time when we reinit the core. */ 3388 * is all the time when we reinit the core. */
3390 b43legacy_release_firmware(dev); 3389 b43legacy_release_firmware(dev);
@@ -3466,7 +3465,6 @@ static int b43legacy_wireless_core_attach(struct b43legacy_wldev *dev)
3466 if (!wl->current_dev) 3465 if (!wl->current_dev)
3467 wl->current_dev = dev; 3466 wl->current_dev = dev;
3468 INIT_WORK(&dev->restart_work, b43legacy_chip_reset); 3467 INIT_WORK(&dev->restart_work, b43legacy_chip_reset);
3469 b43legacy_rfkill_alloc(dev);
3470 3468
3471 b43legacy_radio_turn_off(dev, 1); 3469 b43legacy_radio_turn_off(dev, 1);
3472 b43legacy_switch_analog(dev, 0); 3470 b43legacy_switch_analog(dev, 0);
diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c
index a366129c8b0b..b9d38a4f286d 100644
--- a/drivers/net/wireless/b43legacy/rfkill.c
+++ b/drivers/net/wireless/b43legacy/rfkill.c
@@ -48,18 +48,21 @@ static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
48 struct b43legacy_wldev *dev = poll_dev->private; 48 struct b43legacy_wldev *dev = poll_dev->private;
49 struct b43legacy_wl *wl = dev->wl; 49 struct b43legacy_wl *wl = dev->wl;
50 bool enabled; 50 bool enabled;
51 bool report_change = 0;
51 52
52 mutex_lock(&wl->mutex); 53 mutex_lock(&wl->mutex);
53 B43legacy_WARN_ON(b43legacy_status(dev) < B43legacy_STAT_INITIALIZED); 54 B43legacy_WARN_ON(b43legacy_status(dev) < B43legacy_STAT_INITIALIZED);
54 enabled = b43legacy_is_hw_radio_enabled(dev); 55 enabled = b43legacy_is_hw_radio_enabled(dev);
55 if (unlikely(enabled != dev->radio_hw_enable)) { 56 if (unlikely(enabled != dev->radio_hw_enable)) {
56 dev->radio_hw_enable = enabled; 57 dev->radio_hw_enable = enabled;
58 report_change = 1;
57 b43legacyinfo(wl, "Radio hardware status changed to %s\n", 59 b43legacyinfo(wl, "Radio hardware status changed to %s\n",
58 enabled ? "ENABLED" : "DISABLED"); 60 enabled ? "ENABLED" : "DISABLED");
59 mutex_unlock(&wl->mutex); 61 }
62 mutex_unlock(&wl->mutex);
63
64 if (unlikely(report_change))
60 input_report_key(poll_dev->input, KEY_WLAN, enabled); 65 input_report_key(poll_dev->input, KEY_WLAN, enabled);
61 } else
62 mutex_unlock(&wl->mutex);
63} 66}
64 67
65/* Called when the RFKILL toggled in software. 68/* Called when the RFKILL toggled in software.
@@ -70,10 +73,11 @@ static int b43legacy_rfkill_soft_toggle(void *data, enum rfkill_state state)
70 struct b43legacy_wl *wl = dev->wl; 73 struct b43legacy_wl *wl = dev->wl;
71 int err = 0; 74 int err = 0;
72 75
73 mutex_lock(&wl->mutex); 76 if (!wl->rfkill.registered)
74 if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) 77 return 0;
75 goto out_unlock;
76 78
79 mutex_lock(&wl->mutex);
80 B43legacy_WARN_ON(b43legacy_status(dev) < B43legacy_STAT_INITIALIZED);
77 switch (state) { 81 switch (state) {
78 case RFKILL_STATE_ON: 82 case RFKILL_STATE_ON:
79 if (!dev->radio_hw_enable) { 83 if (!dev->radio_hw_enable) {
diff --git a/drivers/net/wireless/b43legacy/rfkill.h b/drivers/net/wireless/b43legacy/rfkill.h
index b68215e788e2..11150a8032f0 100644
--- a/drivers/net/wireless/b43legacy/rfkill.h
+++ b/drivers/net/wireless/b43legacy/rfkill.h
@@ -16,14 +16,14 @@ struct b43legacy_rfkill {
16 struct rfkill *rfkill; 16 struct rfkill *rfkill;
17 /* The poll device for the RFKILL input button */ 17 /* The poll device for the RFKILL input button */
18 struct input_polled_dev *poll_dev; 18 struct input_polled_dev *poll_dev;
19 /* Did initialization succeed? Used for freeing. */
20 bool registered;
19 /* The unique name of this rfkill switch */ 21 /* The unique name of this rfkill switch */
20 char name[32]; 22 char name[sizeof("b43legacy-phy4294967295")];
21}; 23};
22 24
23/* All the init functions return void, because we are not interested 25/* The init function returns void, because we are not interested
24 * in failing the b43 init process when rfkill init failed. */ 26 * in failing the b43 init process when rfkill init failed. */
25void b43legacy_rfkill_alloc(struct b43legacy_wldev *dev);
26void b43legacy_rfkill_free(struct b43legacy_wldev *dev);
27void b43legacy_rfkill_init(struct b43legacy_wldev *dev); 27void b43legacy_rfkill_init(struct b43legacy_wldev *dev);
28void b43legacy_rfkill_exit(struct b43legacy_wldev *dev); 28void b43legacy_rfkill_exit(struct b43legacy_wldev *dev);
29 29