Skip to content

Commit

Permalink
ide-cd: move cdrom_info.dma to ide_drive_t.dma
Browse files Browse the repository at this point in the history
There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
  • Loading branch information
Borislav Petkov authored and bzolnier committed Oct 13, 2008
1 parent 0a9b6f8 commit 12469ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
32 changes: 14 additions & 18 deletions drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,22 +562,21 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
int xferlen,
ide_handler_t *handler)
{
struct cdrom_info *info = drive->driver_data;
ide_hwif_t *hwif = drive->hwif;

ide_debug_log(IDE_DBG_PC, "Call %s, xferlen: %d\n", __func__, xferlen);

/* FIXME: for Virtual DMA we must check harder */
if (info->dma)
info->dma = !hwif->dma_ops->dma_setup(drive);
if (drive->dma)
drive->dma = !hwif->dma_ops->dma_setup(drive);

/* set up the controller registers */
ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL,
xferlen, info->dma);
xferlen, drive->dma);

if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {
/* waiting for CDB interrupt, not DMA yet. */
if (info->dma)
if (drive->dma)
drive->waiting_for_dma = 0;

/* packet command */
Expand All @@ -604,7 +603,6 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
{
ide_hwif_t *hwif = drive->hwif;
int cmd_len;
struct cdrom_info *info = drive->driver_data;
ide_startstop_t startstop;

ide_debug_log(IDE_DBG_PC, "Call %s\n", __func__);
Expand All @@ -620,7 +618,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
return ide_stopped;

/* ok, next interrupt will be DMA interrupt */
if (info->dma)
if (drive->dma)
drive->waiting_for_dma = 1;
} else {
/* otherwise, we must wait for DRQ to get set */
Expand All @@ -641,7 +639,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len);

/* start the DMA if need be */
if (info->dma)
if (drive->dma)
hwif->dma_ops->dma_start(drive);

return ide_started;
Expand Down Expand Up @@ -955,7 +953,6 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq)
static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
struct cdrom_info *info = drive->driver_data;
struct request *rq = HWGROUP(drive)->rq;
xfer_func_t *xferfunc;
ide_expiry_t *expiry = NULL;
Expand All @@ -969,9 +966,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
__func__, rq->cmd[0], write);

/* check for errors */
dma = info->dma;
dma = drive->dma;
if (dma) {
info->dma = 0;
drive->dma = 0;
dma_error = hwif->dma_ops->dma_end(drive);
if (dma_error) {
printk(KERN_ERR PFX "%s: DMA %s error\n", drive->name,
Expand Down Expand Up @@ -1204,9 +1201,9 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
cdrom_end_request(drive, 0);
return ide_stopped;
}
cd->dma = 0;
drive->dma = 0;
} else
cd->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);

if (write)
cd->devinfo.media_written = 1;
Expand All @@ -1223,7 +1220,6 @@ static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)

static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
{
struct cdrom_info *info = drive->driver_data;

ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd_type: 0x%x\n", __func__,
rq->cmd_type);
Expand All @@ -1233,7 +1229,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
else
rq->cmd_flags &= ~REQ_FAILED;

info->dma = 0;
drive->dma = 0;

/* sg request */
if (rq->bio || ((rq->cmd_type == REQ_TYPE_ATA_PC) && rq->data_len)) {
Expand All @@ -1246,7 +1242,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
else
buf = rq->data;

info->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);

/*
* check if dma is safe
Expand All @@ -1257,7 +1253,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
alignment = queue_dma_alignment(q) | q->dma_pad_mask;
if ((unsigned long)buf & alignment || rq->data_len & alignment
|| object_is_on_stack(buf))
info->dma = 0;
drive->dma = 0;
}
}

Expand Down Expand Up @@ -1298,7 +1294,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
xferlen = 0;
fn = cdrom_start_seek_continuation;

info->dma = 0;
drive->dma = 0;
info->start_seek = jiffies;

ide_cd_prepare_seek_request(drive, rq);
Expand Down
1 change: 0 additions & 1 deletion drivers/ide/ide-cd.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ struct cdrom_info {
struct request_sense sense_data;

struct request request_sense_request;
int dma;
unsigned long last_block;
unsigned long start_seek;

Expand Down

0 comments on commit 12469ac

Please sign in to comment.