aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdel Gadllah <adel.gadllah@gmail.com>2008-06-29 13:20:21 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-30 17:37:37 -0400
commitbc19d6e0b74ef03a3baf035412c95192b54dfc6f (patch)
tree1b31688f378377c721082ff743113478c7bc5ba1
parentf97d1f489d8b44a2c6e8529af855e5e0a2ceaf1e (diff)
b43/b43legacy: add RFKILL_STATE_HARD_BLOCKED support
This patch sets the rfkill state to RFKILL_STATE_HARD_BLOCKED when the radio is killed by the hardware switch. Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/b43/rfkill.c18
-rw-r--r--drivers/net/wireless/b43legacy/rfkill.c18
2 files changed, 36 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 34ae125d538..fec5645944a 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 */
47static 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. */
47static void b43_rfkill_poll(struct input_polled_dev *poll_dev) 64static 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 }
diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c
index b32bf6a94f1..476add97e97 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 }