Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254884
b: refs/heads/master
c: 7bb59df
h: refs/heads/master
v: v3
  • Loading branch information
Peter Hurley authored and Gustavo F. Padovan committed Jun 30, 2011
1 parent f52344e commit 99b3149
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ac28817536797fd40e9646452183606f9e17f71
refs/heads/master: 7bb59df83b190817f56c4e2fec3078d99d906ad4
18 changes: 11 additions & 7 deletions trunk/net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ static void hidp_idle_timeout(unsigned long arg)
{
struct hidp_session *session = (struct hidp_session *) arg;

kthread_stop(session->task);
atomic_inc(&session->terminate);
wake_up_process(session->task);
}

static void hidp_set_timer(struct hidp_session *session)
Expand Down Expand Up @@ -535,7 +536,8 @@ static void hidp_process_hid_control(struct hidp_session *session,
skb_queue_purge(&session->ctrl_transmit);
skb_queue_purge(&session->intr_transmit);

kthread_stop(session->task);
atomic_inc(&session->terminate);
wake_up_process(current);
}
}

Expand Down Expand Up @@ -706,9 +708,8 @@ static int hidp_session(void *arg)
add_wait_queue(sk_sleep(intr_sk), &intr_wait);
session->waiting_for_startup = 0;
wake_up_interruptible(&session->startup_queue);
while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE);

set_current_state(TASK_INTERRUPTIBLE);
while (!atomic_read(&session->terminate)) {
if (ctrl_sk->sk_state != BT_CONNECTED ||
intr_sk->sk_state != BT_CONNECTED)
break;
Expand All @@ -726,6 +727,7 @@ static int hidp_session(void *arg)
hidp_process_transmit(session);

schedule();
set_current_state(TASK_INTERRUPTIBLE);
}
set_current_state(TASK_RUNNING);
remove_wait_queue(sk_sleep(intr_sk), &intr_wait);
Expand Down Expand Up @@ -1060,7 +1062,8 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
err_add_device:
hid_destroy_device(session->hid);
session->hid = NULL;
kthread_stop(session->task);
atomic_inc(&session->terminate);
wake_up_process(session->task);

unlink:
hidp_del_timer(session);
Expand Down Expand Up @@ -1111,7 +1114,8 @@ int hidp_del_connection(struct hidp_conndel_req *req)
skb_queue_purge(&session->ctrl_transmit);
skb_queue_purge(&session->intr_transmit);

kthread_stop(session->task);
atomic_inc(&session->terminate);
wake_up_process(session->task);
}
} else
err = -ENOENT;
Expand Down
1 change: 1 addition & 0 deletions trunk/net/bluetooth/hidp/hidp.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ struct hidp_session {
uint ctrl_mtu;
uint intr_mtu;

atomic_t terminate;
struct task_struct *task;

unsigned char keys[8];
Expand Down

0 comments on commit 99b3149

Please sign in to comment.