diff options
| author | Fabien Crespel <fabien@crespel.net> | 2008-06-23 16:23:06 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2008-06-26 14:21:21 -0400 |
| commit | fbc6af2f3c46df4722f5161d0ad20dd87cd7dfa9 (patch) | |
| tree | 441db97c020be4af753823be8991df86454f92a8 /net/rfkill | |
| parent | ffb67c34e436fb163c4067936ccec797354fa6c6 (diff) | |
rfkill: drop current_state from tasks in rfkill-input
The whole current_state thing seems completely useless and a source of
problems in rfkill-input, since state comparison is already done in rfkill,
and rfkill-input is more than likely to become out of sync with the real
state.
Signed-off-by: Fabien Crespel <fabien@crespel.net>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/rfkill')
| -rw-r--r-- | net/rfkill/rfkill-input.c | 15 |
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 | ||
| 36 | static void rfkill_task_handler(struct work_struct *work) | 35 | static 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 | ||
| 100 | static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN); | 87 | static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN); |
