aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-28 16:51:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-28 16:51:32 -0500
commitf0f0052069989b80d2a3e50c9cd2f2a650bc1aea (patch)
tree40ff39bc341aed8318a54d1bd61a381f41844f71 /drivers/ide/ide-cd.c
parent68fbda7de07e56eb90dd6e58a162527411b388b1 (diff)
parenta65b58663d983e588aed8d1bfc75edaac2527fa7 (diff)
Merge branch 'blk-end-request' of git://git.kernel.dk/linux-2.6-block
* 'blk-end-request' of git://git.kernel.dk/linux-2.6-block: (30 commits) blk_end_request: changing xsysace (take 4) blk_end_request: changing ub (take 4) blk_end_request: cleanup of request completion (take 4) blk_end_request: cleanup 'uptodate' related code (take 4) blk_end_request: remove/unexport end_that_request_* (take 4) blk_end_request: changing scsi (take 4) blk_end_request: add bidi completion interface (take 4) blk_end_request: changing ide-cd (take 4) blk_end_request: add callback feature (take 4) blk_end_request: changing ide normal caller (take 4) blk_end_request: changing cpqarray (take 4) blk_end_request: changing cciss (take 4) blk_end_request: changing ide-scsi (take 4) blk_end_request: changing s390 (take 4) blk_end_request: changing mmc (take 4) blk_end_request: changing i2o_block (take 4) blk_end_request: changing viocd (take 4) blk_end_request: changing xen-blkfront (take 4) blk_end_request: changing viodasd (take 4) blk_end_request: changing sx8 (take 4) ...
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c55
1 files changed, 38 insertions, 17 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 44b033ec0ab0..74c6087ada38 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -655,9 +655,9 @@ static void cdrom_end_request (ide_drive_t *drive, int uptodate)
655 BUG(); 655 BUG();
656 } else { 656 } else {
657 spin_lock_irqsave(&ide_lock, flags); 657 spin_lock_irqsave(&ide_lock, flags);
658 end_that_request_chunk(failed, 0, 658 if (__blk_end_request(failed, -EIO,
659 failed->data_len); 659 failed->data_len))
660 end_that_request_last(failed, 0); 660 BUG();
661 spin_unlock_irqrestore(&ide_lock, flags); 661 spin_unlock_irqrestore(&ide_lock, flags);
662 } 662 }
663 } else 663 } else
@@ -1647,6 +1647,17 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
1647 return 1; 1647 return 1;
1648} 1648}
1649 1649
1650/*
1651 * Called from blk_end_request_callback() after the data of the request
1652 * is completed and before the request is completed.
1653 * By returning value '1', blk_end_request_callback() returns immediately
1654 * without completing the request.
1655 */
1656static int cdrom_newpc_intr_dummy_cb(struct request *rq)
1657{
1658 return 1;
1659}
1660
1650typedef void (xfer_func_t)(ide_drive_t *, void *, u32); 1661typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
1651 1662
1652/* 1663/*
@@ -1685,9 +1696,13 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1685 return ide_error(drive, "dma error", stat); 1696 return ide_error(drive, "dma error", stat);
1686 } 1697 }
1687 1698
1688 end_that_request_chunk(rq, 1, rq->data_len); 1699 spin_lock_irqsave(&ide_lock, flags);
1689 rq->data_len = 0; 1700 if (__blk_end_request(rq, 0, rq->data_len))
1690 goto end_request; 1701 BUG();
1702 HWGROUP(drive)->rq = NULL;
1703 spin_unlock_irqrestore(&ide_lock, flags);
1704
1705 return ide_stopped;
1691 } 1706 }
1692 1707
1693 /* 1708 /*
@@ -1705,8 +1720,15 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1705 /* 1720 /*
1706 * If DRQ is clear, the command has completed. 1721 * If DRQ is clear, the command has completed.
1707 */ 1722 */
1708 if ((stat & DRQ_STAT) == 0) 1723 if ((stat & DRQ_STAT) == 0) {
1709 goto end_request; 1724 spin_lock_irqsave(&ide_lock, flags);
1725 if (__blk_end_request(rq, 0, 0))
1726 BUG();
1727 HWGROUP(drive)->rq = NULL;
1728 spin_unlock_irqrestore(&ide_lock, flags);
1729
1730 return ide_stopped;
1731 }
1710 1732
1711 /* 1733 /*
1712 * check which way to transfer data 1734 * check which way to transfer data
@@ -1759,7 +1781,14 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1759 rq->data_len -= blen; 1781 rq->data_len -= blen;
1760 1782
1761 if (rq->bio) 1783 if (rq->bio)
1762 end_that_request_chunk(rq, 1, blen); 1784 /*
1785 * The request can't be completed until DRQ is cleared.
1786 * So complete the data, but don't complete the request
1787 * using the dummy function for the callback feature
1788 * of blk_end_request_callback().
1789 */
1790 blk_end_request_callback(rq, 0, blen,
1791 cdrom_newpc_intr_dummy_cb);
1763 else 1792 else
1764 rq->data += blen; 1793 rq->data += blen;
1765 } 1794 }
@@ -1780,14 +1809,6 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1780 1809
1781 ide_set_handler(drive, cdrom_newpc_intr, rq->timeout, NULL); 1810 ide_set_handler(drive, cdrom_newpc_intr, rq->timeout, NULL);
1782 return ide_started; 1811 return ide_started;
1783
1784end_request:
1785 spin_lock_irqsave(&ide_lock, flags);
1786 blkdev_dequeue_request(rq);
1787 end_that_request_last(rq, 1);
1788 HWGROUP(drive)->rq = NULL;
1789 spin_unlock_irqrestore(&ide_lock, flags);
1790 return ide_stopped;
1791} 1812}
1792 1813
1793static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) 1814static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)