aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xd.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/block/xd.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/block/xd.c')
-rw-r--r--drivers/block/xd.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index 64b496fce98b..6f6ad82ec0c0 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -314,21 +314,22 @@ static void do_xd_request (struct request_queue * q)
314 int retry; 314 int retry;
315 315
316 if (!blk_fs_request(req)) { 316 if (!blk_fs_request(req)) {
317 end_request(req, 0); 317 __blk_end_request_cur(req, -EIO);
318 continue; 318 continue;
319 } 319 }
320 if (block + count > get_capacity(req->rq_disk)) { 320 if (block + count > get_capacity(req->rq_disk)) {
321 end_request(req, 0); 321 __blk_end_request_cur(req, -EIO);
322 continue; 322 continue;
323 } 323 }
324 if (rw != READ && rw != WRITE) { 324 if (rw != READ && rw != WRITE) {
325 printk("do_xd_request: unknown request\n"); 325 printk("do_xd_request: unknown request\n");
326 end_request(req, 0); 326 __blk_end_request_cur(req, -EIO);
327 continue; 327 continue;
328 } 328 }
329 for (retry = 0; (retry < XD_RETRIES) && !res; retry++) 329 for (retry = 0; (retry < XD_RETRIES) && !res; retry++)
330 res = xd_readwrite(rw, disk, req->buffer, block, count); 330 res = xd_readwrite(rw, disk, req->buffer, block, count);
331 end_request(req, res); /* wrap up, 0 = fail, 1 = success */ 331 /* wrap up, 0 = success, -errno = fail */
332 __blk_end_request_cur(req, res);
332 } 333 }
333} 334}
334 335
@@ -418,7 +419,7 @@ static int xd_readwrite (u_char operation,XD_INFO *p,char *buffer,u_int block,u_
418 printk("xd%c: %s timeout, recalibrating drive\n",'a'+drive,(operation == READ ? "read" : "write")); 419 printk("xd%c: %s timeout, recalibrating drive\n",'a'+drive,(operation == READ ? "read" : "write"));
419 xd_recalibrate(drive); 420 xd_recalibrate(drive);
420 spin_lock_irq(&xd_lock); 421 spin_lock_irq(&xd_lock);
421 return (0); 422 return -EIO;
422 case 2: 423 case 2:
423 if (sense[0] & 0x30) { 424 if (sense[0] & 0x30) {
424 printk("xd%c: %s - ",'a'+drive,(operation == READ ? "reading" : "writing")); 425 printk("xd%c: %s - ",'a'+drive,(operation == READ ? "reading" : "writing"));
@@ -439,7 +440,7 @@ static int xd_readwrite (u_char operation,XD_INFO *p,char *buffer,u_int block,u_
439 else 440 else
440 printk(" - no valid disk address\n"); 441 printk(" - no valid disk address\n");
441 spin_lock_irq(&xd_lock); 442 spin_lock_irq(&xd_lock);
442 return (0); 443 return -EIO;
443 } 444 }
444 if (xd_dma_buffer) 445 if (xd_dma_buffer)
445 for (i=0; i < (temp * 0x200); i++) 446 for (i=0; i < (temp * 0x200); i++)
@@ -448,7 +449,7 @@ static int xd_readwrite (u_char operation,XD_INFO *p,char *buffer,u_int block,u_
448 count -= temp, buffer += temp * 0x200, block += temp; 449 count -= temp, buffer += temp * 0x200, block += temp;
449 } 450 }
450 spin_lock_irq(&xd_lock); 451 spin_lock_irq(&xd_lock);
451 return (1); 452 return 0;
452} 453}
453 454
454/* xd_recalibrate: recalibrate a given drive and reset controller if necessary */ 455/* xd_recalibrate: recalibrate a given drive and reset controller if necessary */