ide-cd: move request prep from cdrom_start_seek_continuation to rq issue path
authorBorislav Petkov <petkovbb@googlemail.com>
Wed, 16 Jul 2008 18:33:46 +0000 (20:33 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Wed, 16 Jul 2008 18:33:46 +0000 (20:33 +0200)
... by factoring out the rq preparation code into a separate
function called in the request routine.  As a nice side effect,
this minimizes the IRQ handler execution time.

There should be no functionality change resulting from this patch.

[bart: s/HWGROUP()/drive->hwif->hwgroup/ and remove extra newlines]

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-cd.c

index 66d82c1b16eb7ad6db2cd2f5399b535dbb050808..275d5ba1202718d05539711f887077a48cb9e23b 100644 (file)
@@ -738,9 +738,8 @@ static ide_startstop_t cdrom_seek_intr(ide_drive_t *drive)
        return ide_stopped;
 }
 
-static ide_startstop_t cdrom_start_seek_continuation(ide_drive_t *drive)
+static void ide_cd_prepare_seek_request(ide_drive_t *drive, struct request *rq)
 {
-       struct request *rq = HWGROUP(drive)->rq;
        sector_t frame = rq->sector;
 
        sector_div(frame, queue_hardsect_size(drive->queue) >> SECTOR_BITS);
@@ -750,6 +749,12 @@ static ide_startstop_t cdrom_start_seek_continuation(ide_drive_t *drive)
        put_unaligned(cpu_to_be32(frame), (unsigned int *) &rq->cmd[2]);
 
        rq->timeout = ATAPI_WAIT_PC;
+}
+
+static ide_startstop_t cdrom_start_seek_continuation(ide_drive_t *drive)
+{
+       struct request *rq = drive->hwif->hwgroup->rq;
+
        return cdrom_transfer_packet_command(drive, rq, &cdrom_seek_intr);
 }
 
@@ -1211,8 +1216,11 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
                    drive->dsc_overlap) {
                        xferlen = 0;
                        fn = cdrom_start_seek_continuation;
+
                        info->dma = 0;
                        info->start_seek = jiffies;
+
+                       ide_cd_prepare_seek_request(drive, rq);
                } else {
                        xferlen = 32768;
                        fn = cdrom_start_rw_cont;