aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-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