Commit fa366ad5d7fe05abaae44a1cd216348669e42ef8

Authored by Serge E. Hallyn
Committed by Linus Torvalds
1 parent c7b2eff059

[PATCH] kthread: convert smbiod

Update smbiod to use kthread instead of deprecated kernel_thread.

[akpm@osdl.org: cleanup]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 17 additions and 9 deletions Side-by-side Diff

... ... @@ -20,6 +20,7 @@
20 20 #include <linux/smp_lock.h>
21 21 #include <linux/module.h>
22 22 #include <linux/net.h>
  23 +#include <linux/kthread.h>
23 24 #include <net/ip.h>
24 25  
25 26 #include <linux/smb_fs.h>
... ... @@ -40,7 +41,7 @@
40 41 };
41 42  
42 43 static enum smbiod_state smbiod_state = SMBIOD_DEAD;
43   -static pid_t smbiod_pid;
  44 +static struct task_struct *smbiod_thread;
44 45 static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait);
45 46 static LIST_HEAD(smb_servers);
46 47 static DEFINE_SPINLOCK(servers_lock);
47 48  
48 49  
49 50  
... ... @@ -67,20 +68,29 @@
67 68 */
68 69 static int smbiod_start(void)
69 70 {
70   - pid_t pid;
  71 + struct task_struct *tsk;
  72 + int err = 0;
  73 +
71 74 if (smbiod_state != SMBIOD_DEAD)
72 75 return 0;
73 76 smbiod_state = SMBIOD_STARTING;
74 77 __module_get(THIS_MODULE);
75 78 spin_unlock(&servers_lock);
76   - pid = kernel_thread(smbiod, NULL, 0);
77   - if (pid < 0)
  79 + tsk = kthread_run(smbiod, NULL, "smbiod");
  80 + if (IS_ERR(tsk)) {
  81 + err = PTR_ERR(tsk);
78 82 module_put(THIS_MODULE);
  83 + }
79 84  
80 85 spin_lock(&servers_lock);
81   - smbiod_state = pid < 0 ? SMBIOD_DEAD : SMBIOD_RUNNING;
82   - smbiod_pid = pid;
83   - return pid;
  86 + if (err < 0) {
  87 + smbiod_state = SMBIOD_DEAD;
  88 + smbiod_thread = NULL;
  89 + } else {
  90 + smbiod_state = SMBIOD_RUNNING;
  91 + smbiod_thread = tsk;
  92 + }
  93 + return err;
84 94 }
85 95  
86 96 /*
... ... @@ -290,8 +300,6 @@
290 300 */
291 301 static int smbiod(void *unused)
292 302 {
293   - daemonize("smbiod");
294   -
295 303 allow_signal(SIGKILL);
296 304  
297 305 VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid);