aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 91a6b462d373..3a08a2ba6b17 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -562,22 +562,21 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
562 int xferlen, 562 int xferlen,
563 ide_handler_t *handler) 563 ide_handler_t *handler)
564{ 564{
565 struct cdrom_info *info = drive->driver_data;
566 ide_hwif_t *hwif = drive->hwif; 565 ide_hwif_t *hwif = drive->hwif;
567 566
568 ide_debug_log(IDE_DBG_PC, "Call %s, xferlen: %d\n", __func__, xferlen); 567 ide_debug_log(IDE_DBG_PC, "Call %s, xferlen: %d\n", __func__, xferlen);
569 568
570 /* FIXME: for Virtual DMA we must check harder */ 569 /* FIXME: for Virtual DMA we must check harder */
571 if (info->dma) 570 if (drive->dma)
572 info->dma = !hwif->dma_ops->dma_setup(drive); 571 drive->dma = !hwif->dma_ops->dma_setup(drive);
573 572
574 /* set up the controller registers */ 573 /* set up the controller registers */
575 ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL, 574 ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL,
576 xferlen, info->dma); 575 xferlen, drive->dma);
577 576
578 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { 577 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {
579 /* waiting for CDB interrupt, not DMA yet. */ 578 /* waiting for CDB interrupt, not DMA yet. */
580 if (info->dma) 579 if (drive->dma)
581 drive->waiting_for_dma = 0; 580 drive->waiting_for_dma = 0;
582 581
583 /* packet command */ 582 /* packet command */
@@ -604,7 +603,6 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
604{ 603{
605 ide_hwif_t *hwif = drive->hwif; 604 ide_hwif_t *hwif = drive->hwif;
606 int cmd_len; 605 int cmd_len;
607 struct cdrom_info *info = drive->driver_data;
608 ide_startstop_t startstop; 606 ide_startstop_t startstop;
609 607
610 ide_debug_log(IDE_DBG_PC, "Call %s\n", __func__); 608 ide_debug_log(IDE_DBG_PC, "Call %s\n", __func__);
@@ -620,7 +618,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
620 return ide_stopped; 618 return ide_stopped;
621 619
622 /* ok, next interrupt will be DMA interrupt */ 620 /* ok, next interrupt will be DMA interrupt */
623 if (info->dma) 621 if (drive->dma)
624 drive->waiting_for_dma = 1; 622 drive->waiting_for_dma = 1;
625 } else { 623 } else {
626 /* otherwise, we must wait for DRQ to get set */ 624 /* otherwise, we must wait for DRQ to get set */
@@ -641,7 +639,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
641 hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len); 639 hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len);
642 640
643 /* start the DMA if need be */ 641 /* start the DMA if need be */
644 if (info->dma) 642 if (drive->dma)
645 hwif->dma_ops->dma_start(drive); 643 hwif->dma_ops->dma_start(drive);
646 644
647 return ide_started; 645 return ide_started;
@@ -955,7 +953,6 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq)
955static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) 953static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
956{ 954{
957 ide_hwif_t *hwif = drive->hwif; 955 ide_hwif_t *hwif = drive->hwif;
958 struct cdrom_info *info = drive->driver_data;
959 struct request *rq = HWGROUP(drive)->rq; 956 struct request *rq = HWGROUP(drive)->rq;
960 xfer_func_t *xferfunc; 957 xfer_func_t *xferfunc;
961 ide_expiry_t *expiry = NULL; 958 ide_expiry_t *expiry = NULL;
@@ -969,9 +966,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
969 __func__, rq->cmd[0], write); 966 __func__, rq->cmd[0], write);
970 967
971 /* check for errors */ 968 /* check for errors */
972 dma = info->dma; 969 dma = drive->dma;
973 if (dma) { 970 if (dma) {
974 info->dma = 0; 971 drive->dma = 0;
975 dma_error = hwif->dma_ops->dma_end(drive); 972 dma_error = hwif->dma_ops->dma_end(drive);
976 if (dma_error) { 973 if (dma_error) {
977 printk(KERN_ERR PFX "%s: DMA %s error\n", drive->name, 974 printk(KERN_ERR PFX "%s: DMA %s error\n", drive->name,
@@ -1204,9 +1201,9 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
1204 cdrom_end_request(drive, 0); 1201 cdrom_end_request(drive, 0);
1205 return ide_stopped; 1202 return ide_stopped;
1206 } 1203 }
1207 cd->dma = 0; 1204 drive->dma = 0;
1208 } else 1205 } else
1209 cd->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); 1206 drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
1210 1207
1211 if (write) 1208 if (write)
1212 cd->devinfo.media_written = 1; 1209 cd->devinfo.media_written = 1;
@@ -1223,7 +1220,6 @@ static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)
1223 1220
1224static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) 1221static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1225{ 1222{
1226 struct cdrom_info *info = drive->driver_data;
1227 1223
1228 ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd_type: 0x%x\n", __func__, 1224 ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd_type: 0x%x\n", __func__,
1229 rq->cmd_type); 1225 rq->cmd_type);
@@ -1233,7 +1229,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1233 else 1229 else
1234 rq->cmd_flags &= ~REQ_FAILED; 1230 rq->cmd_flags &= ~REQ_FAILED;
1235 1231
1236 info->dma = 0; 1232 drive->dma = 0;
1237 1233
1238 /* sg request */ 1234 /* sg request */
1239 if (rq->bio || ((rq->cmd_type == REQ_TYPE_ATA_PC) && rq->data_len)) { 1235 if (rq->bio || ((rq->cmd_type == REQ_TYPE_ATA_PC) && rq->data_len)) {
@@ -1246,7 +1242,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1246 else 1242 else
1247 buf = rq->data; 1243 buf = rq->data;
1248 1244
1249 info->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); 1245 drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
1250 1246
1251 /* 1247 /*
1252 * check if dma is safe 1248 * check if dma is safe
@@ -1257,7 +1253,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1257 alignment = queue_dma_alignment(q) | q->dma_pad_mask; 1253 alignment = queue_dma_alignment(q) | q->dma_pad_mask;
1258 if ((unsigned long)buf & alignment || rq->data_len & alignment 1254 if ((unsigned long)buf & alignment || rq->data_len & alignment
1259 || object_is_on_stack(buf)) 1255 || object_is_on_stack(buf))
1260 info->dma = 0; 1256 drive->dma = 0;
1261 } 1257 }
1262} 1258}
1263 1259
@@ -1298,7 +1294,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1298 xferlen = 0; 1294 xferlen = 0;
1299 fn = cdrom_start_seek_continuation; 1295 fn = cdrom_start_seek_continuation;
1300 1296
1301 info->dma = 0; 1297 drive->dma = 0;
1302 info->start_seek = jiffies; 1298 info->start_seek = jiffies;
1303 1299
1304 ide_cd_prepare_seek_request(drive, rq); 1300 ide_cd_prepare_seek_request(drive, rq);