diff options
Diffstat (limited to 'drivers/net/wireless/b43/rfkill.c')
-rw-r--r-- | drivers/net/wireless/b43/rfkill.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c index 4cca203992e8..fec5645944a4 100644 --- a/drivers/net/wireless/b43/rfkill.c +++ b/drivers/net/wireless/b43/rfkill.c | |||
@@ -43,6 +43,23 @@ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev) | |||
43 | return 0; | 43 | return 0; |
44 | } | 44 | } |
45 | 45 | ||
46 | /* Update the rfkill state */ | ||
47 | static void b43_rfkill_update_state(struct b43_wldev *dev) | ||
48 | { | ||
49 | struct b43_rfkill *rfk = &(dev->wl->rfkill); | ||
50 | |||
51 | if (!dev->radio_hw_enable) { | ||
52 | rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED; | ||
53 | return; | ||
54 | } | ||
55 | |||
56 | if (!dev->phy.radio_on) | ||
57 | rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED; | ||
58 | else | ||
59 | rfk->rfkill->state = RFKILL_STATE_UNBLOCKED; | ||
60 | |||
61 | } | ||
62 | |||
46 | /* The poll callback for the hardware button. */ | 63 | /* The poll callback for the hardware button. */ |
47 | static void b43_rfkill_poll(struct input_polled_dev *poll_dev) | 64 | static void b43_rfkill_poll(struct input_polled_dev *poll_dev) |
48 | { | 65 | { |
@@ -60,6 +77,7 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev) | |||
60 | if (unlikely(enabled != dev->radio_hw_enable)) { | 77 | if (unlikely(enabled != dev->radio_hw_enable)) { |
61 | dev->radio_hw_enable = enabled; | 78 | dev->radio_hw_enable = enabled; |
62 | report_change = 1; | 79 | report_change = 1; |
80 | b43_rfkill_update_state(dev); | ||
63 | b43info(wl, "Radio hardware status changed to %s\n", | 81 | b43info(wl, "Radio hardware status changed to %s\n", |
64 | enabled ? "ENABLED" : "DISABLED"); | 82 | enabled ? "ENABLED" : "DISABLED"); |
65 | } | 83 | } |
@@ -135,7 +153,7 @@ void b43_rfkill_init(struct b43_wldev *dev) | |||
135 | snprintf(rfk->name, sizeof(rfk->name), | 153 | snprintf(rfk->name, sizeof(rfk->name), |
136 | "b43-%s", wiphy_name(wl->hw->wiphy)); | 154 | "b43-%s", wiphy_name(wl->hw->wiphy)); |
137 | rfk->rfkill->name = rfk->name; | 155 | rfk->rfkill->name = rfk->name; |
138 | rfk->rfkill->state = RFKILL_STATE_ON; | 156 | rfk->rfkill->state = RFKILL_STATE_UNBLOCKED; |
139 | rfk->rfkill->data = dev; | 157 | rfk->rfkill->data = dev; |
140 | rfk->rfkill->toggle_radio = b43_rfkill_soft_toggle; | 158 | rfk->rfkill->toggle_radio = b43_rfkill_soft_toggle; |
141 | rfk->rfkill->user_claim_unsupported = 1; | 159 | rfk->rfkill->user_claim_unsupported = 1; |