aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43legacy/rfkill.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43legacy/rfkill.c')
-rw-r--r--drivers/net/wireless/b43legacy/rfkill.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c
index 8935a302b220..476add97e974 100644
--- a/drivers/net/wireless/b43legacy/rfkill.c
+++ b/drivers/net/wireless/b43legacy/rfkill.c
@@ -44,6 +44,23 @@ static bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev)
44 return 0; 44 return 0;
45} 45}
46 46
47/* Update the rfkill state */
48static void b43legacy_rfkill_update_state(struct b43legacy_wldev *dev)
49{
50 struct b43legacy_rfkill *rfk = &(dev->wl->rfkill);
51
52 if (!dev->radio_hw_enable) {
53 rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
54 return;
55 }
56
57 if (!dev->phy.radio_on)
58 rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
59 else
60 rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
61
62}
63
47/* The poll callback for the hardware button. */ 64/* The poll callback for the hardware button. */
48static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev) 65static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
49{ 66{
@@ -61,6 +78,7 @@ static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
61 if (unlikely(enabled != dev->radio_hw_enable)) { 78 if (unlikely(enabled != dev->radio_hw_enable)) {
62 dev->radio_hw_enable = enabled; 79 dev->radio_hw_enable = enabled;
63 report_change = 1; 80 report_change = 1;
81 b43legacy_rfkill_update_state(dev);
64 b43legacyinfo(wl, "Radio hardware status changed to %s\n", 82 b43legacyinfo(wl, "Radio hardware status changed to %s\n",
65 enabled ? "ENABLED" : "DISABLED"); 83 enabled ? "ENABLED" : "DISABLED");
66 } 84 }
@@ -139,7 +157,7 @@ void b43legacy_rfkill_init(struct b43legacy_wldev *dev)
139 snprintf(rfk->name, sizeof(rfk->name), 157 snprintf(rfk->name, sizeof(rfk->name),
140 "b43legacy-%s", wiphy_name(wl->hw->wiphy)); 158 "b43legacy-%s", wiphy_name(wl->hw->wiphy));
141 rfk->rfkill->name = rfk->name; 159 rfk->rfkill->name = rfk->name;
142 rfk->rfkill->state = RFKILL_STATE_ON; 160 rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
143 rfk->rfkill->data = dev; 161 rfk->rfkill->data = dev;
144 rfk->rfkill->toggle_radio = b43legacy_rfkill_soft_toggle; 162 rfk->rfkill->toggle_radio = b43legacy_rfkill_soft_toggle;
145 rfk->rfkill->user_claim_unsupported = 1; 163 rfk->rfkill->user_claim_unsupported = 1;