aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xsysace.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/xsysace.c')
-rw-r--r--drivers/block/xsysace.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 4aecf5dc6a93..f08491a3a813 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -463,10 +463,11 @@ struct request *ace_get_next_request(struct request_queue * q)
463{ 463{
464 struct request *req; 464 struct request *req;
465 465
466 while ((req = elv_next_request(q)) != NULL) { 466 while ((req = blk_peek_request(q)) != NULL) {
467 if (blk_fs_request(req)) 467 if (blk_fs_request(req))
468 break; 468 break;
469 end_request(req, 0); 469 blk_start_request(req);
470 __blk_end_request_all(req, -EIO);
470 } 471 }
471 return req; 472 return req;
472} 473}
@@ -492,9 +493,13 @@ static void ace_fsm_dostate(struct ace_device *ace)
492 set_capacity(ace->gd, 0); 493 set_capacity(ace->gd, 0);
493 dev_info(ace->dev, "No CF in slot\n"); 494 dev_info(ace->dev, "No CF in slot\n");
494 495
495 /* Drop all pending requests */ 496 /* Drop all in-flight and pending requests */
496 while ((req = elv_next_request(ace->queue)) != NULL) 497 if (ace->req) {
497 end_request(req, 0); 498 __blk_end_request_all(ace->req, -EIO);
499 ace->req = NULL;
500 }
501 while ((req = blk_fetch_request(ace->queue)) != NULL)
502 __blk_end_request_all(req, -EIO);
498 503
499 /* Drop back to IDLE state and notify waiters */ 504 /* Drop back to IDLE state and notify waiters */
500 ace->fsm_state = ACE_FSM_STATE_IDLE; 505 ace->fsm_state = ACE_FSM_STATE_IDLE;
@@ -642,19 +647,21 @@ static void ace_fsm_dostate(struct ace_device *ace)
642 ace->fsm_state = ACE_FSM_STATE_IDLE; 647 ace->fsm_state = ACE_FSM_STATE_IDLE;
643 break; 648 break;
644 } 649 }
650 blk_start_request(req);
645 651
646 /* Okay, it's a data request, set it up for transfer */ 652 /* Okay, it's a data request, set it up for transfer */
647 dev_dbg(ace->dev, 653 dev_dbg(ace->dev,
648 "request: sec=%llx hcnt=%lx, ccnt=%x, dir=%i\n", 654 "request: sec=%llx hcnt=%x, ccnt=%x, dir=%i\n",
649 (unsigned long long) req->sector, req->hard_nr_sectors, 655 (unsigned long long)blk_rq_pos(req),
650 req->current_nr_sectors, rq_data_dir(req)); 656 blk_rq_sectors(req), blk_rq_cur_sectors(req),
657 rq_data_dir(req));
651 658
652 ace->req = req; 659 ace->req = req;
653 ace->data_ptr = req->buffer; 660 ace->data_ptr = req->buffer;
654 ace->data_count = req->current_nr_sectors * ACE_BUF_PER_SECTOR; 661 ace->data_count = blk_rq_cur_sectors(req) * ACE_BUF_PER_SECTOR;
655 ace_out32(ace, ACE_MPULBA, req->sector & 0x0FFFFFFF); 662 ace_out32(ace, ACE_MPULBA, blk_rq_pos(req) & 0x0FFFFFFF);
656 663
657 count = req->hard_nr_sectors; 664 count = blk_rq_sectors(req);
658 if (rq_data_dir(req)) { 665 if (rq_data_dir(req)) {
659 /* Kick off write request */ 666 /* Kick off write request */
660 dev_dbg(ace->dev, "write data\n"); 667 dev_dbg(ace->dev, "write data\n");
@@ -688,7 +695,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
688 dev_dbg(ace->dev, 695 dev_dbg(ace->dev,
689 "CFBSY set; t=%i iter=%i c=%i dc=%i irq=%i\n", 696 "CFBSY set; t=%i iter=%i c=%i dc=%i irq=%i\n",
690 ace->fsm_task, ace->fsm_iter_num, 697 ace->fsm_task, ace->fsm_iter_num,
691 ace->req->current_nr_sectors * 16, 698 blk_rq_cur_sectors(ace->req) * 16,
692 ace->data_count, ace->in_irq); 699 ace->data_count, ace->in_irq);
693 ace_fsm_yield(ace); /* need to poll CFBSY bit */ 700 ace_fsm_yield(ace); /* need to poll CFBSY bit */
694 break; 701 break;
@@ -697,7 +704,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
697 dev_dbg(ace->dev, 704 dev_dbg(ace->dev,
698 "DATABUF not set; t=%i iter=%i c=%i dc=%i irq=%i\n", 705 "DATABUF not set; t=%i iter=%i c=%i dc=%i irq=%i\n",
699 ace->fsm_task, ace->fsm_iter_num, 706 ace->fsm_task, ace->fsm_iter_num,
700 ace->req->current_nr_sectors * 16, 707 blk_rq_cur_sectors(ace->req) * 16,
701 ace->data_count, ace->in_irq); 708 ace->data_count, ace->in_irq);
702 ace_fsm_yieldirq(ace); 709 ace_fsm_yieldirq(ace);
703 break; 710 break;
@@ -717,14 +724,13 @@ static void ace_fsm_dostate(struct ace_device *ace)
717 } 724 }
718 725
719 /* bio finished; is there another one? */ 726 /* bio finished; is there another one? */
720 if (__blk_end_request(ace->req, 0, 727 if (__blk_end_request_cur(ace->req, 0)) {
721 blk_rq_cur_bytes(ace->req))) { 728 /* dev_dbg(ace->dev, "next block; h=%u c=%u\n",
722 /* dev_dbg(ace->dev, "next block; h=%li c=%i\n", 729 * blk_rq_sectors(ace->req),
723 * ace->req->hard_nr_sectors, 730 * blk_rq_cur_sectors(ace->req));
724 * ace->req->current_nr_sectors);
725 */ 731 */
726 ace->data_ptr = ace->req->buffer; 732 ace->data_ptr = ace->req->buffer;
727 ace->data_count = ace->req->current_nr_sectors * 16; 733 ace->data_count = blk_rq_cur_sectors(ace->req) * 16;
728 ace_fsm_yieldirq(ace); 734 ace_fsm_yieldirq(ace);
729 break; 735 break;
730 } 736 }
@@ -978,7 +984,7 @@ static int __devinit ace_setup(struct ace_device *ace)
978 ace->queue = blk_init_queue(ace_request, &ace->lock); 984 ace->queue = blk_init_queue(ace_request, &ace->lock);
979 if (ace->queue == NULL) 985 if (ace->queue == NULL)
980 goto err_blk_initq; 986 goto err_blk_initq;
981 blk_queue_hardsect_size(ace->queue, 512); 987 blk_queue_logical_block_size(ace->queue, 512);
982 988
983 /* 989 /*
984 * Allocate and initialize GD structure 990 * Allocate and initialize GD structure