Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbc6af2f authored by Fabien Crespel's avatar Fabien Crespel Committed by John W. Linville
Browse files

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: default avatarFabien Crespel <fabien@crespel.net>
Acked-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ffb67c34
Loading
Loading
Loading
Loading
+1 −14
Original line number Original line Diff line number Diff line
@@ -30,27 +30,15 @@ struct rfkill_task {
	spinlock_t lock; /* for accessing last and desired state */
	spinlock_t lock; /* for accessing last and desired state */
	unsigned long last; /* last schedule */
	unsigned long last; /* last schedule */
	enum rfkill_state desired_state; /* on/off */
	enum rfkill_state desired_state; /* on/off */
	enum rfkill_state current_state; /* on/off */
};
};


static void rfkill_task_handler(struct work_struct *work)
static void rfkill_task_handler(struct work_struct *work)
{
{
	struct rfkill_task *task = container_of(work, struct rfkill_task, work);
	struct rfkill_task *task = container_of(work, struct rfkill_task, work);
	enum rfkill_state state;


	mutex_lock(&task->mutex);
	mutex_lock(&task->mutex);


	/*
	rfkill_switch_all(task->type, task->desired_state);
	 * Use temp variable to fetch desired state to keep it
	 * consistent even if rfkill_schedule_toggle() runs in
	 * another thread or interrupts us.
	 */
	state = task->desired_state;

	if (state != task->current_state) {
		rfkill_switch_all(task->type, state);
		task->current_state = state;
	}


	mutex_unlock(&task->mutex);
	mutex_unlock(&task->mutex);
}
}
@@ -94,7 +82,6 @@ static void rfkill_schedule_toggle(struct rfkill_task *task)
		.mutex = __MUTEX_INITIALIZER(n.mutex),	\
		.mutex = __MUTEX_INITIALIZER(n.mutex),	\
		.lock = __SPIN_LOCK_UNLOCKED(n.lock),	\
		.lock = __SPIN_LOCK_UNLOCKED(n.lock),	\
		.desired_state = RFKILL_STATE_ON,	\
		.desired_state = RFKILL_STATE_ON,	\
		.current_state = RFKILL_STATE_ON,	\
	}
	}


static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN);
static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN);