mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 14:52:34 +00:00
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>
This commit is contained in:
parent
dc288520a2
commit
5005657cbd
4 changed files with 152 additions and 40 deletions
|
@ -84,7 +84,8 @@ static void rfkill_schedule_toggle(struct rfkill_task *task)
|
|||
spin_lock_irqsave(&task->lock, flags);
|
||||
|
||||
if (time_after(jiffies, task->last + msecs_to_jiffies(200))) {
|
||||
task->desired_state = !task->desired_state;
|
||||
task->desired_state =
|
||||
rfkill_state_complement(task->desired_state);
|
||||
task->last = jiffies;
|
||||
schedule_work(&task->work);
|
||||
}
|
||||
|
@ -92,14 +93,14 @@ static void rfkill_schedule_toggle(struct rfkill_task *task)
|
|||
spin_unlock_irqrestore(&task->lock, flags);
|
||||
}
|
||||
|
||||
#define DEFINE_RFKILL_TASK(n, t) \
|
||||
struct rfkill_task n = { \
|
||||
.work = __WORK_INITIALIZER(n.work, \
|
||||
rfkill_task_handler), \
|
||||
.type = t, \
|
||||
.mutex = __MUTEX_INITIALIZER(n.mutex), \
|
||||
.lock = __SPIN_LOCK_UNLOCKED(n.lock), \
|
||||
.desired_state = RFKILL_STATE_ON, \
|
||||
#define DEFINE_RFKILL_TASK(n, t) \
|
||||
struct rfkill_task n = { \
|
||||
.work = __WORK_INITIALIZER(n.work, \
|
||||
rfkill_task_handler), \
|
||||
.type = t, \
|
||||
.mutex = __MUTEX_INITIALIZER(n.mutex), \
|
||||
.lock = __SPIN_LOCK_UNLOCKED(n.lock), \
|
||||
.desired_state = RFKILL_STATE_UNBLOCKED, \
|
||||
}
|
||||
|
||||
static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN);
|
||||
|
@ -135,15 +136,15 @@ static void rfkill_event(struct input_handle *handle, unsigned int type,
|
|||
/* handle EPO (emergency power off) through shortcut */
|
||||
if (data) {
|
||||
rfkill_schedule_set(&rfkill_wwan,
|
||||
RFKILL_STATE_ON);
|
||||
RFKILL_STATE_UNBLOCKED);
|
||||
rfkill_schedule_set(&rfkill_wimax,
|
||||
RFKILL_STATE_ON);
|
||||
RFKILL_STATE_UNBLOCKED);
|
||||
rfkill_schedule_set(&rfkill_uwb,
|
||||
RFKILL_STATE_ON);
|
||||
RFKILL_STATE_UNBLOCKED);
|
||||
rfkill_schedule_set(&rfkill_bt,
|
||||
RFKILL_STATE_ON);
|
||||
RFKILL_STATE_UNBLOCKED);
|
||||
rfkill_schedule_set(&rfkill_wlan,
|
||||
RFKILL_STATE_ON);
|
||||
RFKILL_STATE_UNBLOCKED);
|
||||
} else
|
||||
rfkill_schedule_epo();
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue