aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/rfkill/rfkill-input.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index 29c13d308b31..d285f9a9d829 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -30,27 +30,15 @@ struct rfkill_task {
30 spinlock_t lock; /* for accessing last and desired state */ 30 spinlock_t lock; /* for accessing last and desired state */
31 unsigned long last; /* last schedule */ 31 unsigned long last; /* last schedule */
32 enum rfkill_state desired_state; /* on/off */ 32 enum rfkill_state desired_state; /* on/off */
33 enum rfkill_state current_state; /* on/off */
34}; 33};
35 34
36static void rfkill_task_handler(struct work_struct *work) 35static void rfkill_task_handler(struct work_struct *work)
37{ 36{
38 struct rfkill_task *task = container_of(work, struct rfkill_task, work); 37 struct rfkill_task *task = container_of(work, struct rfkill_task, work);
39 enum rfkill_state state;
40 38
41 mutex_lock(&task->mutex); 39 mutex_lock(&task->mutex);
42 40
43 /* 41 rfkill_switch_all(task->type, task->desired_state);
44 * Use temp variable to fetch desired state to keep it
45 * consistent even if rfkill_schedule_toggle() runs in
46 * another thread or interrupts us.
47 */
48 state = task->desired_state;
49
50 if (state != task->current_state) {
51 rfkill_switch_all(task->type, state);
52 task->current_state = state;
53 }
54 42
55 mutex_unlock(&task->mutex); 43 mutex_unlock(&task->mutex);
56} 44}
@@ -94,7 +82,6 @@ static void rfkill_schedule_toggle(struct rfkill_task *task)
94 .mutex = __MUTEX_INITIALIZER(n.mutex), \ 82 .mutex = __MUTEX_INITIALIZER(n.mutex), \
95 .lock = __SPIN_LOCK_UNLOCKED(n.lock), \ 83 .lock = __SPIN_LOCK_UNLOCKED(n.lock), \
96 .desired_state = RFKILL_STATE_ON, \ 84 .desired_state = RFKILL_STATE_ON, \
97 .current_state = RFKILL_STATE_ON, \
98 } 85 }
99 86
100static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN); 87static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN);