diff options
Diffstat (limited to 'drivers/cdrom/gdrom.c')
-rw-r--r-- | drivers/cdrom/gdrom.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 2eecb779437..1e366ad8f68 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c | |||
@@ -584,8 +584,8 @@ static void gdrom_readdisk_dma(struct work_struct *work) | |||
584 | list_for_each_safe(elem, next, &gdrom_deferred) { | 584 | list_for_each_safe(elem, next, &gdrom_deferred) { |
585 | req = list_entry(elem, struct request, queuelist); | 585 | req = list_entry(elem, struct request, queuelist); |
586 | spin_unlock(&gdrom_lock); | 586 | spin_unlock(&gdrom_lock); |
587 | block = req->sector/GD_TO_BLK + GD_SESSION_OFFSET; | 587 | block = blk_rq_pos(req)/GD_TO_BLK + GD_SESSION_OFFSET; |
588 | block_cnt = req->nr_sectors/GD_TO_BLK; | 588 | block_cnt = blk_rq_sectors(req)/GD_TO_BLK; |
589 | ctrl_outl(PHYSADDR(req->buffer), GDROM_DMA_STARTADDR_REG); | 589 | ctrl_outl(PHYSADDR(req->buffer), GDROM_DMA_STARTADDR_REG); |
590 | ctrl_outl(block_cnt * GDROM_HARD_SECTOR, GDROM_DMA_LENGTH_REG); | 590 | ctrl_outl(block_cnt * GDROM_HARD_SECTOR, GDROM_DMA_LENGTH_REG); |
591 | ctrl_outl(1, GDROM_DMA_DIRECTION_REG); | 591 | ctrl_outl(1, GDROM_DMA_DIRECTION_REG); |
@@ -632,39 +632,35 @@ static void gdrom_readdisk_dma(struct work_struct *work) | |||
632 | * before handling ending the request */ | 632 | * before handling ending the request */ |
633 | spin_lock(&gdrom_lock); | 633 | spin_lock(&gdrom_lock); |
634 | list_del_init(&req->queuelist); | 634 | list_del_init(&req->queuelist); |
635 | __blk_end_request(req, err, blk_rq_bytes(req)); | 635 | __blk_end_request_all(req, err); |
636 | } | 636 | } |
637 | spin_unlock(&gdrom_lock); | 637 | spin_unlock(&gdrom_lock); |
638 | kfree(read_command); | 638 | kfree(read_command); |
639 | } | 639 | } |
640 | 640 | ||
641 | static void gdrom_request_handler_dma(struct request *req) | ||
642 | { | ||
643 | /* dequeue, add to list of deferred work | ||
644 | * and then schedule workqueue */ | ||
645 | blkdev_dequeue_request(req); | ||
646 | list_add_tail(&req->queuelist, &gdrom_deferred); | ||
647 | schedule_work(&work); | ||
648 | } | ||
649 | |||
650 | static void gdrom_request(struct request_queue *rq) | 641 | static void gdrom_request(struct request_queue *rq) |
651 | { | 642 | { |
652 | struct request *req; | 643 | struct request *req; |
653 | 644 | ||
654 | while ((req = elv_next_request(rq)) != NULL) { | 645 | while ((req = blk_fetch_request(rq)) != NULL) { |
655 | if (!blk_fs_request(req)) { | 646 | if (!blk_fs_request(req)) { |
656 | printk(KERN_DEBUG "GDROM: Non-fs request ignored\n"); | 647 | printk(KERN_DEBUG "GDROM: Non-fs request ignored\n"); |
657 | end_request(req, 0); | 648 | __blk_end_request_all(req, -EIO); |
649 | continue; | ||
658 | } | 650 | } |
659 | if (rq_data_dir(req) != READ) { | 651 | if (rq_data_dir(req) != READ) { |
660 | printk(KERN_NOTICE "GDROM: Read only device -"); | 652 | printk(KERN_NOTICE "GDROM: Read only device -"); |
661 | printk(" write request ignored\n"); | 653 | printk(" write request ignored\n"); |
662 | end_request(req, 0); | 654 | __blk_end_request_all(req, -EIO); |
655 | continue; | ||
663 | } | 656 | } |
664 | if (req->nr_sectors) | 657 | |
665 | gdrom_request_handler_dma(req); | 658 | /* |
666 | else | 659 | * Add to list of deferred work and then schedule |
667 | end_request(req, 0); | 660 | * workqueue. |
661 | */ | ||
662 | list_add_tail(&req->queuelist, &gdrom_deferred); | ||
663 | schedule_work(&work); | ||
668 | } | 664 | } |
669 | } | 665 | } |
670 | 666 | ||