aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtd_blkdevs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r--drivers/mtd/mtd_blkdevs.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 8ca17a3e96ea..c82e09bbc5fd 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -59,12 +59,14 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
59 for (; nsect > 0; nsect--, block++, buf += tr->blksize) 59 for (; nsect > 0; nsect--, block++, buf += tr->blksize)
60 if (tr->readsect(dev, block, buf)) 60 if (tr->readsect(dev, block, buf))
61 return -EIO; 61 return -EIO;
62 rq_flush_dcache_pages(req);
62 return 0; 63 return 0;
63 64
64 case WRITE: 65 case WRITE:
65 if (!tr->writesect) 66 if (!tr->writesect)
66 return -EIO; 67 return -EIO;
67 68
69 rq_flush_dcache_pages(req);
68 for (; nsect > 0; nsect--, block++, buf += tr->blksize) 70 for (; nsect > 0; nsect--, block++, buf += tr->blksize)
69 if (tr->writesect(dev, block, buf)) 71 if (tr->writesect(dev, block, buf))
70 return -EIO; 72 return -EIO;
@@ -82,9 +84,6 @@ static int mtd_blktrans_thread(void *arg)
82 struct request_queue *rq = tr->blkcore_priv->rq; 84 struct request_queue *rq = tr->blkcore_priv->rq;
83 struct request *req = NULL; 85 struct request *req = NULL;
84 86
85 /* we might get involved when memory gets low, so use PF_MEMALLOC */
86 current->flags |= PF_MEMALLOC;
87
88 spin_lock_irq(rq->queue_lock); 87 spin_lock_irq(rq->queue_lock);
89 88
90 while (!kthread_should_stop()) { 89 while (!kthread_should_stop()) {
@@ -379,7 +378,7 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
379 tr->blkcore_priv->thread = kthread_run(mtd_blktrans_thread, tr, 378 tr->blkcore_priv->thread = kthread_run(mtd_blktrans_thread, tr,
380 "%sd", tr->name); 379 "%sd", tr->name);
381 if (IS_ERR(tr->blkcore_priv->thread)) { 380 if (IS_ERR(tr->blkcore_priv->thread)) {
382 int ret = PTR_ERR(tr->blkcore_priv->thread); 381 ret = PTR_ERR(tr->blkcore_priv->thread);
383 blk_cleanup_queue(tr->blkcore_priv->rq); 382 blk_cleanup_queue(tr->blkcore_priv->rq);
384 unregister_blkdev(tr->major, tr->name); 383 unregister_blkdev(tr->major, tr->name);
385 kfree(tr->blkcore_priv); 384 kfree(tr->blkcore_priv);