Replace kernel_thread() with kthread_run()/kthread_stop().
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
*/
#include <linux/module.h>
#include <linux/blkdev.h>
*/
#include <linux/module.h>
#include <linux/blkdev.h>
+#include <linux/kthread.h>
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
#include "mmc_queue.h"
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
#include "mmc_queue.h"
-#define MMC_QUEUE_EXIT (1 << 0)
-#define MMC_QUEUE_SUSPENDED (1 << 1)
+#define MMC_QUEUE_SUSPENDED (1 << 0)
/*
* Prepare a MMC request. Essentially, this means passing the
/*
* Prepare a MMC request. Essentially, this means passing the
{
struct mmc_queue *mq = d;
struct request_queue *q = mq->queue;
{
struct mmc_queue *mq = d;
struct request_queue *q = mq->queue;
- DECLARE_WAITQUEUE(wait, current);
/*
* Set iothread to ensure that we aren't put to sleep by
/*
* Set iothread to ensure that we aren't put to sleep by
*/
current->flags |= PF_MEMALLOC|PF_NOFREEZE;
*/
current->flags |= PF_MEMALLOC|PF_NOFREEZE;
- daemonize("mmcqd");
-
- complete(&mq->thread_complete);
-
- add_wait_queue(&mq->thread_wq, &wait);
do {
struct request *req = NULL;
do {
struct request *req = NULL;
spin_unlock_irq(q->queue_lock);
if (!req) {
spin_unlock_irq(q->queue_lock);
if (!req) {
- if (mq->flags & MMC_QUEUE_EXIT)
+ if (kthread_should_stop())
break;
up(&mq->thread_sem);
schedule();
break;
up(&mq->thread_sem);
schedule();
mq->issue_fn(mq, req);
} while (1);
mq->issue_fn(mq, req);
} while (1);
- remove_wait_queue(&mq->thread_wq, &wait);
- complete_and_exit(&mq->thread_complete, 0);
struct mmc_queue *mq = q->queuedata;
if (!mq->req)
struct mmc_queue *mq = q->queuedata;
if (!mq->req)
- wake_up(&mq->thread_wq);
+ wake_up_process(mq->thread);
GFP_KERNEL);
if (!mq->sg) {
ret = -ENOMEM;
GFP_KERNEL);
if (!mq->sg) {
ret = -ENOMEM;
- init_completion(&mq->thread_complete);
- init_waitqueue_head(&mq->thread_wq);
init_MUTEX(&mq->thread_sem);
init_MUTEX(&mq->thread_sem);
- ret = kernel_thread(mmc_queue_thread, mq, CLONE_KERNEL);
- if (ret >= 0) {
- wait_for_completion(&mq->thread_complete);
- init_completion(&mq->thread_complete);
- ret = 0;
- goto out;
+ mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd");
+ if (IS_ERR(mq->thread)) {
+ ret = PTR_ERR(mq->thread);
+ goto free_sg;
kfree(mq->sg);
mq->sg = NULL;
kfree(mq->sg);
mq->sg = NULL;
blk_cleanup_queue(mq->queue);
blk_cleanup_queue(mq->queue);
return ret;
}
EXPORT_SYMBOL(mmc_init_queue);
void mmc_cleanup_queue(struct mmc_queue *mq)
{
return ret;
}
EXPORT_SYMBOL(mmc_init_queue);
void mmc_cleanup_queue(struct mmc_queue *mq)
{
- mq->flags |= MMC_QUEUE_EXIT;
- wake_up(&mq->thread_wq);
- wait_for_completion(&mq->thread_complete);
+ kthread_stop(mq->thread);
kfree(mq->sg);
mq->sg = NULL;
kfree(mq->sg);
mq->sg = NULL;
struct mmc_queue {
struct mmc_card *card;
struct mmc_queue {
struct mmc_card *card;
- struct completion thread_complete;
- wait_queue_head_t thread_wq;
+ struct task_struct *thread;
struct semaphore thread_sem;
unsigned int flags;
struct request *req;
struct semaphore thread_sem;
unsigned int flags;
struct request *req;