]> git.karo-electronics.de Git - linux-beck.git/blobdiff - net/bluetooth/rfcomm/core.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
[linux-beck.git] / net / bluetooth / rfcomm / core.c
index 64e20dde48372de03b7b77d6e66a7503b97c1e47..73f8c75abe6ec40d5376bdeb5114ab99f2e737f1 100644 (file)
@@ -103,11 +103,11 @@ static struct rfcomm_session *rfcomm_session_del(struct rfcomm_session *s);
 #define __get_rpn_stop_bits(line) (((line) >> 2) & 0x1)
 #define __get_rpn_parity(line)    (((line) >> 3) & 0x7)
 
+static DECLARE_WAIT_QUEUE_HEAD(rfcomm_wq);
+
 static void rfcomm_schedule(void)
 {
-       if (!rfcomm_thread)
-               return;
-       wake_up_process(rfcomm_thread);
+       wake_up_all(&rfcomm_wq);
 }
 
 /* ---- RFCOMM FCS computation ---- */
@@ -2088,24 +2088,22 @@ static void rfcomm_kill_listener(void)
 
 static int rfcomm_run(void *unused)
 {
+       DEFINE_WAIT_FUNC(wait, woken_wake_function);
        BT_DBG("");
 
        set_user_nice(current, -10);
 
        rfcomm_add_listener(BDADDR_ANY);
 
-       while (1) {
-               set_current_state(TASK_INTERRUPTIBLE);
-
-               if (kthread_should_stop())
-                       break;
+       add_wait_queue(&rfcomm_wq, &wait);
+       while (!kthread_should_stop()) {
 
                /* Process stuff */
                rfcomm_process_sessions();
 
-               schedule();
+               wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
        }
-       __set_current_state(TASK_RUNNING);
+       remove_wait_queue(&rfcomm_wq, &wait);
 
        rfcomm_kill_listener();