ide-cd: fix missing residual count setting in DMA mode
authorKiyoshi Ueda <k-ueda@ct.jp.nec.com>
Tue, 19 Feb 2008 00:41:26 +0000 (01:41 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 19 Feb 2008 00:41:26 +0000 (01:41 +0100)
This patch fixes the missing residual count setting in DMA mode,
which was introduced during the conversion to blk-end-request.
The residual count could be used by the request submitter.
So if it isn't set correctly, some upper layers does not work.
(e.g. wodim for CD burning.)

The bug is in only DMA mode.
In PIO mode, we are setting the residual count correctly,
so no need to fix.

Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Reported-by: Andreas Schwab <schwab@suse.de>
Tested-by: Andreas Schwab <schwab@suse.de>
Tested-by: Laura Garcia <nevola@gmail.com>
Tested-by: Borislav Petkov <petkovbb@googlemail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-cd.c

index 354c91d06a6d26d6af5f5c0fd5bb38d178d82a2f..310e497b58380d5d348c29d9d890204e1cf47edf 100644 (file)
@@ -1207,9 +1207,13 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
 end_request:
        if (blk_pc_request(rq)) {
                unsigned long flags;
+               unsigned int dlen = rq->data_len;
+
+               if (dma)
+                       rq->data_len = 0;
 
                spin_lock_irqsave(&ide_lock, flags);
-               if (__blk_end_request(rq, 0, rq->data_len))
+               if (__blk_end_request(rq, 0, dlen))
                        BUG();
                HWGROUP(drive)->rq = NULL;
                spin_unlock_irqrestore(&ide_lock, flags);