Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82114
b: refs/heads/master
c: b4ab726
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Feb 1, 2008
1 parent e94c9b6 commit 34cb33b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c9f56a801a3a9d76119868a687bc220d29055625
refs/heads/master: b4ab726c92f8a2c1635958212e8933309de0a37a
28 changes: 15 additions & 13 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,16 @@ static void ide_cd_pad_transfer(ide_drive_t *drive, xfer_func_t *xf, int len)
}
}

static void ide_cd_drain_data(ide_drive_t *drive, int nsects)
{
while (nsects > 0) {
static char dum[SECTOR_SIZE];

drive->hwif->atapi_input_bytes(drive, dum, sizeof(dum));
nsects--;
}
}

/*
* Buffer up to SECTORS_TO_TRANSFER sectors from the drive in our sector
* buffer. Once the first sector is added, any subsequent sectors are
Expand Down Expand Up @@ -664,11 +674,7 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector,
}

/* Throw away any remaining data. */
while (sectors_to_transfer > 0) {
static char dum[SECTOR_SIZE];
HWIF(drive)->atapi_input_bytes(drive, dum, sizeof (dum));
--sectors_to_transfer;
}
ide_cd_drain_data(drive, sectors_to_transfer);
}

/*
Expand Down Expand Up @@ -791,14 +797,10 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
any of the leading sectors. */
nskip = min_t(int, rq->current_nr_sectors - bio_cur_sectors(rq->bio), sectors_to_transfer);

while (nskip > 0) {
/* We need to throw away a sector. */
static char dum[SECTOR_SIZE];
HWIF(drive)->atapi_input_bytes(drive, dum, sizeof (dum));

--rq->current_nr_sectors;
--nskip;
--sectors_to_transfer;
if (nskip > 0) {
ide_cd_drain_data(drive, nskip);
rq->current_nr_sectors -= nskip;
sectors_to_transfer -= nskip;
}

/* Now loop while we still have data to read from the drive. */
Expand Down

0 comments on commit 34cb33b

Please sign in to comment.