提交 e5842cdb 编写于 作者: P Peter Hurley 提交者: Gustavo F. Padovan

Bluetooth: rfcomm: Remove unnecessary krfcommd event

Removed superfluous event handling which was used to signal
that the rfcomm kthread had been woken. This appears to have been
used to prevent lost wakeups. Correctly ordering when the task
state is set to TASK_INTERRUPTIBLE is sufficient to prevent lost wakeups.

To prevent wakeups which occurred prior to initially setting
TASK_INTERRUPTIBLE from being lost, the main work of the thread loop -
rfcomm_process_sessions() - is performed prior to sleeping.
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
上级 8e7c3d2e
...@@ -62,7 +62,6 @@ static DEFINE_MUTEX(rfcomm_mutex); ...@@ -62,7 +62,6 @@ static DEFINE_MUTEX(rfcomm_mutex);
#define rfcomm_lock() mutex_lock(&rfcomm_mutex) #define rfcomm_lock() mutex_lock(&rfcomm_mutex)
#define rfcomm_unlock() mutex_unlock(&rfcomm_mutex) #define rfcomm_unlock() mutex_unlock(&rfcomm_mutex)
static unsigned long rfcomm_event;
static LIST_HEAD(session_list); static LIST_HEAD(session_list);
...@@ -120,7 +119,6 @@ static inline void rfcomm_schedule(void) ...@@ -120,7 +119,6 @@ static inline void rfcomm_schedule(void)
{ {
if (!rfcomm_thread) if (!rfcomm_thread)
return; return;
set_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
wake_up_process(rfcomm_thread); wake_up_process(rfcomm_thread);
} }
...@@ -2038,19 +2036,18 @@ static int rfcomm_run(void *unused) ...@@ -2038,19 +2036,18 @@ static int rfcomm_run(void *unused)
rfcomm_add_listener(BDADDR_ANY); rfcomm_add_listener(BDADDR_ANY);
while (!kthread_should_stop()) { while (1) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
/* No pending events. Let's sleep. if (kthread_should_stop())
* Incoming connections and data will wake us up. */ break;
schedule();
}
set_current_state(TASK_RUNNING);
/* Process stuff */ /* Process stuff */
clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
rfcomm_process_sessions(); rfcomm_process_sessions();
schedule();
} }
__set_current_state(TASK_RUNNING);
rfcomm_kill_listener(); rfcomm_kill_listener();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册