aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtd_blkdevs.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-04-19 03:58:33 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-04-19 17:16:46 -0400
commit99f9b2431ed3da4a66cf1cfe74132a53a9569bba (patch)
tree31c3cccac874716aecf5038029e998d03d378751 /drivers/mtd/mtd_blkdevs.c
parente6be133b68ae2c8f89d46da25ed7b31b84793e7e (diff)
[MTD] mtd_blkdevs: Convert to use the kthread API
thread_run is used intead of kernel_thread, daemonize, and mucking around blocking signals directly. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r--drivers/mtd/mtd_blkdevs.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index b879a66daa9e..1aa018abd332 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -20,6 +20,7 @@
20#include <linux/hdreg.h> 20#include <linux/hdreg.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/kthread.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24 25
25static LIST_HEAD(blktrans_majors); 26static LIST_HEAD(blktrans_majors);
@@ -83,17 +84,6 @@ static int mtd_blktrans_thread(void *arg)
83 /* we might get involved when memory gets low, so use PF_MEMALLOC */ 84 /* we might get involved when memory gets low, so use PF_MEMALLOC */
84 current->flags |= PF_MEMALLOC | PF_NOFREEZE; 85 current->flags |= PF_MEMALLOC | PF_NOFREEZE;
85 86
86 daemonize("%sd", tr->name);
87
88 /* daemonize() doesn't do this for us since some kernel threads
89 actually want to deal with signals. We can't just call
90 exit_sighand() since that'll cause an oops when we finally
91 do exit. */
92 spin_lock_irq(&current->sighand->siglock);
93 sigfillset(&current->blocked);
94 recalc_sigpending();
95 spin_unlock_irq(&current->sighand->siglock);
96
97 spin_lock_irq(rq->queue_lock); 87 spin_lock_irq(rq->queue_lock);
98 88
99 while (!tr->blkcore_priv->exiting) { 89 while (!tr->blkcore_priv->exiting) {
@@ -365,6 +355,7 @@ static struct mtd_notifier blktrans_notifier = {
365 355
366int register_mtd_blktrans(struct mtd_blktrans_ops *tr) 356int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
367{ 357{
358 struct task_struct *task;
368 int ret, i; 359 int ret, i;
369 360
370 /* Register the notifier if/when the first device type is 361 /* Register the notifier if/when the first device type is
@@ -403,13 +394,13 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
403 blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize); 394 blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize);
404 tr->blkshift = ffs(tr->blksize) - 1; 395 tr->blkshift = ffs(tr->blksize) - 1;
405 396
406 ret = kernel_thread(mtd_blktrans_thread, tr, CLONE_KERNEL); 397 task = kthread_run(mtd_blktrans_thread, tr, "%sd", tr->name);
407 if (ret < 0) { 398 if (IS_ERR(task)) {
408 blk_cleanup_queue(tr->blkcore_priv->rq); 399 blk_cleanup_queue(tr->blkcore_priv->rq);
409 unregister_blkdev(tr->major, tr->name); 400 unregister_blkdev(tr->major, tr->name);
410 kfree(tr->blkcore_priv); 401 kfree(tr->blkcore_priv);
411 mutex_unlock(&mtd_table_mutex); 402 mutex_unlock(&mtd_table_mutex);
412 return ret; 403 return PTR_ERR(task);
413 } 404 }
414 405
415 INIT_LIST_HEAD(&tr->devs); 406 INIT_LIST_HEAD(&tr->devs);