diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-06-23 16:46:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-26 14:21:22 -0400 |
commit | 5005657cbd0fd6f277f807c0612a6b6d4396a02c (patch) | |
tree | e6ed81f07a1a85ed2c440ac8631ca19cc77907c1 /net/rfkill/rfkill-input.c | |
parent | dc288520a21879c6540f3249e9532c5e032da4e8 (diff) |
rfkill: rename the rfkill_state states and add block-locked state
The current naming of rfkill_state causes a lot of confusion: not only the
"kill" in rfkill suggests negative logic, but also the fact that rfkill cannot
turn anything on (it can just force something off or stop forcing something
off) is often forgotten.
Rename RFKILL_STATE_OFF to RFKILL_STATE_SOFT_BLOCKED (transmitter is blocked
and will not operate; state can be changed by a toggle_radio request), and
RFKILL_STATE_ON to RFKILL_STATE_UNBLOCKED (transmitter is not blocked, and may
operate).
Also, add a new third state, RFKILL_STATE_HARD_BLOCKED (transmitter is blocked
and will not operate; state cannot be changed through a toggle_radio request),
which is used by drivers to indicate a wireless transmiter was blocked by a
hardware rfkill line that accepts no overrides.
Keep the old names as #defines, but document them as deprecated. This way,
drivers can be converted to the new names *and* verified to actually use rfkill
correctly one by one.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/rfkill/rfkill-input.c')
-rw-r--r-- | net/rfkill/rfkill-input.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c index 5d4c8b2446f7..8aa822730145 100644 --- a/net/rfkill/rfkill-input.c +++ b/net/rfkill/rfkill-input.c | |||
@@ -84,7 +84,8 @@ static void rfkill_schedule_toggle(struct rfkill_task *task) | |||
84 | spin_lock_irqsave(&task->lock, flags); | 84 | spin_lock_irqsave(&task->lock, flags); |
85 | 85 | ||
86 | if (time_after(jiffies, task->last + msecs_to_jiffies(200))) { | 86 | if (time_after(jiffies, task->last + msecs_to_jiffies(200))) { |
87 | task->desired_state = !task->desired_state; | 87 | task->desired_state = |
88 | rfkill_state_complement(task->desired_state); | ||
88 | task->last = jiffies; | 89 | task->last = jiffies; |
89 | schedule_work(&task->work); | 90 | schedule_work(&task->work); |
90 | } | 91 | } |
@@ -92,14 +93,14 @@ static void rfkill_schedule_toggle(struct rfkill_task *task) | |||
92 | spin_unlock_irqrestore(&task->lock, flags); | 93 | spin_unlock_irqrestore(&task->lock, flags); |
93 | } | 94 | } |
94 | 95 | ||
95 | #define DEFINE_RFKILL_TASK(n, t) \ | 96 | #define DEFINE_RFKILL_TASK(n, t) \ |
96 | struct rfkill_task n = { \ | 97 | struct rfkill_task n = { \ |
97 | .work = __WORK_INITIALIZER(n.work, \ | 98 | .work = __WORK_INITIALIZER(n.work, \ |
98 | rfkill_task_handler), \ | 99 | rfkill_task_handler), \ |
99 | .type = t, \ | 100 | .type = t, \ |
100 | .mutex = __MUTEX_INITIALIZER(n.mutex), \ | 101 | .mutex = __MUTEX_INITIALIZER(n.mutex), \ |
101 | .lock = __SPIN_LOCK_UNLOCKED(n.lock), \ | 102 | .lock = __SPIN_LOCK_UNLOCKED(n.lock), \ |
102 | .desired_state = RFKILL_STATE_ON, \ | 103 | .desired_state = RFKILL_STATE_UNBLOCKED, \ |
103 | } | 104 | } |
104 | 105 | ||
105 | static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN); | 106 | static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN); |
@@ -135,15 +136,15 @@ static void rfkill_event(struct input_handle *handle, unsigned int type, | |||
135 | /* handle EPO (emergency power off) through shortcut */ | 136 | /* handle EPO (emergency power off) through shortcut */ |
136 | if (data) { | 137 | if (data) { |
137 | rfkill_schedule_set(&rfkill_wwan, | 138 | rfkill_schedule_set(&rfkill_wwan, |
138 | RFKILL_STATE_ON); | 139 | RFKILL_STATE_UNBLOCKED); |
139 | rfkill_schedule_set(&rfkill_wimax, | 140 | rfkill_schedule_set(&rfkill_wimax, |
140 | RFKILL_STATE_ON); | 141 | RFKILL_STATE_UNBLOCKED); |
141 | rfkill_schedule_set(&rfkill_uwb, | 142 | rfkill_schedule_set(&rfkill_uwb, |
142 | RFKILL_STATE_ON); | 143 | RFKILL_STATE_UNBLOCKED); |
143 | rfkill_schedule_set(&rfkill_bt, | 144 | rfkill_schedule_set(&rfkill_bt, |
144 | RFKILL_STATE_ON); | 145 | RFKILL_STATE_UNBLOCKED); |
145 | rfkill_schedule_set(&rfkill_wlan, | 146 | rfkill_schedule_set(&rfkill_wlan, |
146 | RFKILL_STATE_ON); | 147 | RFKILL_STATE_UNBLOCKED); |
147 | } else | 148 | } else |
148 | rfkill_schedule_epo(); | 149 | rfkill_schedule_epo(); |
149 | break; | 150 | break; |