diff options
author | Borislav Petkov <petkovbb@googlemail.com> | 2008-07-16 14:33:46 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-16 14:33:46 -0400 |
commit | 90eb808e0fd3cbda8a8b085238930c533f603642 (patch) | |
tree | 20c7396d6407e60f92f09938783eacccbe526b46 /drivers/ide/ide-cd.c | |
parent | e529c6087a845e64a6a36a2d17b8754b20bc7c0d (diff) |
ide-cd: move request prep from cdrom_start_rw_cont to rq issue path
... 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 newline]
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 275d5ba12027..9e593cebc00c 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -666,16 +666,9 @@ static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) | |||
666 | 666 | ||
667 | static ide_startstop_t cdrom_newpc_intr(ide_drive_t *); | 667 | static ide_startstop_t cdrom_newpc_intr(ide_drive_t *); |
668 | 668 | ||
669 | /* | 669 | static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, |
670 | * Routine to send a read/write packet command to the drive. This is usually | 670 | struct request *rq) |
671 | * called directly from cdrom_start_{read,write}(). However, for drq_interrupt | ||
672 | * devices, it is called from an interrupt when the drive is ready to accept | ||
673 | * the command. | ||
674 | */ | ||
675 | static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive) | ||
676 | { | 671 | { |
677 | struct request *rq = HWGROUP(drive)->rq; | ||
678 | |||
679 | if (rq_data_dir(rq) == READ) { | 672 | if (rq_data_dir(rq) == READ) { |
680 | unsigned short sectors_per_frame = | 673 | unsigned short sectors_per_frame = |
681 | queue_hardsect_size(drive->queue) >> SECTOR_BITS; | 674 | queue_hardsect_size(drive->queue) >> SECTOR_BITS; |
@@ -712,6 +705,19 @@ static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive) | |||
712 | /* set up the command */ | 705 | /* set up the command */ |
713 | rq->timeout = ATAPI_WAIT_PC; | 706 | rq->timeout = ATAPI_WAIT_PC; |
714 | 707 | ||
708 | return ide_started; | ||
709 | } | ||
710 | |||
711 | /* | ||
712 | * Routine to send a read/write packet command to the drive. This is usually | ||
713 | * called directly from cdrom_start_{read,write}(). However, for drq_interrupt | ||
714 | * devices, it is called from an interrupt when the drive is ready to accept | ||
715 | * the command. | ||
716 | */ | ||
717 | static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive) | ||
718 | { | ||
719 | struct request *rq = drive->hwif->hwgroup->rq; | ||
720 | |||
715 | /* send the command to the drive and return */ | 721 | /* send the command to the drive and return */ |
716 | return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); | 722 | return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); |
717 | } | 723 | } |
@@ -1224,8 +1230,12 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
1224 | } else { | 1230 | } else { |
1225 | xferlen = 32768; | 1231 | xferlen = 32768; |
1226 | fn = cdrom_start_rw_cont; | 1232 | fn = cdrom_start_rw_cont; |
1233 | |||
1227 | if (cdrom_start_rw(drive, rq) == ide_stopped) | 1234 | if (cdrom_start_rw(drive, rq) == ide_stopped) |
1228 | return ide_stopped; | 1235 | return ide_stopped; |
1236 | |||
1237 | if (ide_cd_prepare_rw_request(drive, rq) == ide_stopped) | ||
1238 | return ide_stopped; | ||
1229 | } | 1239 | } |
1230 | info->last_block = block; | 1240 | info->last_block = block; |
1231 | } else if (blk_sense_request(rq) || blk_pc_request(rq) || | 1241 | } else if (blk_sense_request(rq) || blk_pc_request(rq) || |