aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtd_blkdevs.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-04-22 22:05:19 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-04-28 01:37:36 -0400
commitf06d9a2b52e246a66b606130cea3f0d7b7be17a7 (patch)
tree020df1f9d54b00c72d8af02ac0827d496597e75a /drivers/mtd/mtd_blkdevs.c
parent40cbbb781d3eba5d6ac0860db078af490e5c7c6b (diff)
block: replace end_request() with [__]blk_end_request_cur()
end_request() has been kept around for backward compatibility; however, it's about time for it to go away. * There aren't too many users left. * Its use of @updtodate is pretty confusing. * In some cases, newer code ends up using mixture of end_request() and [__]blk_end_request[_all](), which is way too confusing. So, add [__]blk_end_request_cur() and replace end_request() with it. Most conversions are straightforward. Noteworthy ones are... * paride/pcd: next_request() updated to take 0/-errno instead of 1/0. * paride/pf: pf_end_request() and next_request() updated to take 0/-errno instead of 1/0. * xd: xd_readwrite() updated to return 0/-errno instead of 1/0. * mtd/mtd_blkdevs: blktrans_discard_request() updated to return 0/-errno instead of 1/0. Unnecessary local variable res initialization removed from mtd_blktrans_thread(). [ Impact: cleanup ] Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Joerg Dorchain <joerg@dorchain.net> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Laurent Vivier <Laurent@lvivier.info> Cc: Tim Waugh <tim@cyberelk.net> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Paul Mackerras <paulus@samba.org> Cc: Jeremy Fitzhardinge <jeremy@xensource.com> Cc: Markus Lidel <Markus.Lidel@shadowconnect.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Pete Zaitcev <zaitcev@redhat.com> Cc: unsik Kim <donari75@gmail.com>
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r--drivers/mtd/mtd_blkdevs.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index a49a9c8f2cb1..76c4c8d13073 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -54,33 +54,33 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
54 54
55 if (req->cmd_type == REQ_TYPE_LINUX_BLOCK && 55 if (req->cmd_type == REQ_TYPE_LINUX_BLOCK &&
56 req->cmd[0] == REQ_LB_OP_DISCARD) 56 req->cmd[0] == REQ_LB_OP_DISCARD)
57 return !tr->discard(dev, block, nsect); 57 return tr->discard(dev, block, nsect);
58 58
59 if (!blk_fs_request(req)) 59 if (!blk_fs_request(req))
60 return 0; 60 return -EIO;
61 61
62 if (req->sector + req->current_nr_sectors > get_capacity(req->rq_disk)) 62 if (req->sector + req->current_nr_sectors > get_capacity(req->rq_disk))
63 return 0; 63 return -EIO;
64 64
65 switch(rq_data_dir(req)) { 65 switch(rq_data_dir(req)) {
66 case READ: 66 case READ:
67 for (; nsect > 0; nsect--, block++, buf += tr->blksize) 67 for (; nsect > 0; nsect--, block++, buf += tr->blksize)
68 if (tr->readsect(dev, block, buf)) 68 if (tr->readsect(dev, block, buf))
69 return 0; 69 return -EIO;
70 return 1; 70 return 0;
71 71
72 case WRITE: 72 case WRITE:
73 if (!tr->writesect) 73 if (!tr->writesect)
74 return 0; 74 return -EIO;
75 75
76 for (; nsect > 0; nsect--, block++, buf += tr->blksize) 76 for (; nsect > 0; nsect--, block++, buf += tr->blksize)
77 if (tr->writesect(dev, block, buf)) 77 if (tr->writesect(dev, block, buf))
78 return 0; 78 return -EIO;
79 return 1; 79 return 0;
80 80
81 default: 81 default:
82 printk(KERN_NOTICE "Unknown request %u\n", rq_data_dir(req)); 82 printk(KERN_NOTICE "Unknown request %u\n", rq_data_dir(req));
83 return 0; 83 return -EIO;
84 } 84 }
85} 85}
86 86
@@ -96,7 +96,7 @@ static int mtd_blktrans_thread(void *arg)
96 while (!kthread_should_stop()) { 96 while (!kthread_should_stop()) {
97 struct request *req; 97 struct request *req;
98 struct mtd_blktrans_dev *dev; 98 struct mtd_blktrans_dev *dev;
99 int res = 0; 99 int res;
100 100
101 req = elv_next_request(rq); 101 req = elv_next_request(rq);
102 102
@@ -119,7 +119,7 @@ static int mtd_blktrans_thread(void *arg)
119 119
120 spin_lock_irq(rq->queue_lock); 120 spin_lock_irq(rq->queue_lock);
121 121
122 end_request(req, res); 122 __blk_end_request_cur(req, res);
123 } 123 }
124 spin_unlock_irq(rq->queue_lock); 124 spin_unlock_irq(rq->queue_lock);
125 125