diff options
author | Szymon Janc <szymon.janc@tieto.com> | 2011-03-21 09:20:06 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-05 11:40:47 -0400 |
commit | fada4ac33992b1f953d95584e36f6ca7860aea40 (patch) | |
tree | 2e5f23109278c91c8b90433c87556c5f996499ab /net/bluetooth/cmtp/core.c | |
parent | f4d7cd4a4c25cb4a5c30a675d4cc0052c93b925a (diff) |
Bluetooth: Use kthread API in cmtp
kernel_thread() is a low-level implementation detail and
EXPORT_SYMBOL(kernel_thread) is scheduled for removal.
Use the <linux/kthread.h> API instead.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/cmtp/core.c')
-rw-r--r-- | net/bluetooth/cmtp/core.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 16aa6bd039b..cce99b0919f 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/ioctl.h> | 35 | #include <linux/ioctl.h> |
36 | #include <linux/file.h> | 36 | #include <linux/file.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/kthread.h> | ||
38 | #include <net/sock.h> | 39 | #include <net/sock.h> |
39 | 40 | ||
40 | #include <linux/isdn/capilli.h> | 41 | #include <linux/isdn/capilli.h> |
@@ -287,12 +288,11 @@ static int cmtp_session(void *arg) | |||
287 | 288 | ||
288 | BT_DBG("session %p", session); | 289 | BT_DBG("session %p", session); |
289 | 290 | ||
290 | daemonize("kcmtpd_ctr_%d", session->num); | ||
291 | set_user_nice(current, -15); | 291 | set_user_nice(current, -15); |
292 | 292 | ||
293 | init_waitqueue_entry(&wait, current); | 293 | init_waitqueue_entry(&wait, current); |
294 | add_wait_queue(sk_sleep(sk), &wait); | 294 | add_wait_queue(sk_sleep(sk), &wait); |
295 | while (!atomic_read(&session->terminate)) { | 295 | while (!kthread_should_stop()) { |
296 | set_current_state(TASK_INTERRUPTIBLE); | 296 | set_current_state(TASK_INTERRUPTIBLE); |
297 | 297 | ||
298 | if (sk->sk_state != BT_CONNECTED) | 298 | if (sk->sk_state != BT_CONNECTED) |
@@ -370,9 +370,12 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) | |||
370 | 370 | ||
371 | __cmtp_link_session(session); | 371 | __cmtp_link_session(session); |
372 | 372 | ||
373 | err = kernel_thread(cmtp_session, session, CLONE_KERNEL); | 373 | session->task = kthread_run(cmtp_session, session, "kcmtpd_ctr_%d", |
374 | if (err < 0) | 374 | session->num); |
375 | if (IS_ERR(session->task)) { | ||
376 | err = PTR_ERR(session->task); | ||
375 | goto unlink; | 377 | goto unlink; |
378 | } | ||
376 | 379 | ||
377 | if (!(session->flags & (1 << CMTP_LOOPBACK))) { | 380 | if (!(session->flags & (1 << CMTP_LOOPBACK))) { |
378 | err = cmtp_attach_device(session); | 381 | err = cmtp_attach_device(session); |
@@ -409,9 +412,8 @@ int cmtp_del_connection(struct cmtp_conndel_req *req) | |||
409 | /* Flush the transmit queue */ | 412 | /* Flush the transmit queue */ |
410 | skb_queue_purge(&session->transmit); | 413 | skb_queue_purge(&session->transmit); |
411 | 414 | ||
412 | /* Kill session thread */ | 415 | /* Stop session thread */ |
413 | atomic_inc(&session->terminate); | 416 | kthread_stop(session->task); |
414 | cmtp_schedule(session); | ||
415 | } else | 417 | } else |
416 | err = -ENOENT; | 418 | err = -ENOENT; |
417 | 419 | ||