提交 99f9b243 编写于 作者: E Eric W. Biederman 提交者: David Woodhouse

[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: NEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
上级 e6be133b
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/kthread.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
static LIST_HEAD(blktrans_majors); static LIST_HEAD(blktrans_majors);
...@@ -83,17 +84,6 @@ static int mtd_blktrans_thread(void *arg) ...@@ -83,17 +84,6 @@ static int mtd_blktrans_thread(void *arg)
/* we might get involved when memory gets low, so use PF_MEMALLOC */ /* we might get involved when memory gets low, so use PF_MEMALLOC */
current->flags |= PF_MEMALLOC | PF_NOFREEZE; current->flags |= PF_MEMALLOC | PF_NOFREEZE;
daemonize("%sd", tr->name);
/* daemonize() doesn't do this for us since some kernel threads
actually want to deal with signals. We can't just call
exit_sighand() since that'll cause an oops when we finally
do exit. */
spin_lock_irq(&current->sighand->siglock);
sigfillset(&current->blocked);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
spin_lock_irq(rq->queue_lock); spin_lock_irq(rq->queue_lock);
while (!tr->blkcore_priv->exiting) { while (!tr->blkcore_priv->exiting) {
...@@ -365,6 +355,7 @@ static struct mtd_notifier blktrans_notifier = { ...@@ -365,6 +355,7 @@ static struct mtd_notifier blktrans_notifier = {
int register_mtd_blktrans(struct mtd_blktrans_ops *tr) int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
{ {
struct task_struct *task;
int ret, i; int ret, i;
/* Register the notifier if/when the first device type is /* Register the notifier if/when the first device type is
...@@ -403,13 +394,13 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) ...@@ -403,13 +394,13 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize); blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize);
tr->blkshift = ffs(tr->blksize) - 1; tr->blkshift = ffs(tr->blksize) - 1;
ret = kernel_thread(mtd_blktrans_thread, tr, CLONE_KERNEL); task = kthread_run(mtd_blktrans_thread, tr, "%sd", tr->name);
if (ret < 0) { if (IS_ERR(task)) {
blk_cleanup_queue(tr->blkcore_priv->rq); blk_cleanup_queue(tr->blkcore_priv->rq);
unregister_blkdev(tr->major, tr->name); unregister_blkdev(tr->major, tr->name);
kfree(tr->blkcore_priv); kfree(tr->blkcore_priv);
mutex_unlock(&mtd_table_mutex); mutex_unlock(&mtd_table_mutex);
return ret; return PTR_ERR(task);
} }
INIT_LIST_HEAD(&tr->devs); INIT_LIST_HEAD(&tr->devs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册