Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82089
b: refs/heads/master
c: 0ba1121
h: refs/heads/master
i:
  82087: 342e7d9
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Feb 1, 2008
1 parent fb14827 commit d511f53
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 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: 4fe6717862d4977b8e61307a2623ed7739068bdc
refs/heads/master: 0ba11211f9ac583333aac44daec5af4f7eeba217
44 changes: 24 additions & 20 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ static void ide_cd_put(struct cdrom_info *cd)
buffers. */
static void cdrom_saw_media_change (ide_drive_t *drive)
{
struct cdrom_info *info = drive->driver_data;
CDROM_STATE_FLAGS (drive)->media_changed = 1;
CDROM_STATE_FLAGS (drive)->toc_valid = 0;
info->nsectors_buffered = 0;
struct cdrom_info *cd = drive->driver_data;

cd->state_flags.media_changed = 1;
cd->state_flags.toc_valid = 0;
cd->nsectors_buffered = 0;
}

static int cdrom_log_sense(ide_drive_t *drive, struct request *rq,
Expand Down Expand Up @@ -1880,7 +1880,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense)
stat = 0;

if (stat == 0)
CDROM_STATE_FLAGS(drive)->door_locked = lockflag;
cd->state_flags.door_locked = lockflag;

return stat;
}
Expand All @@ -1900,7 +1900,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
return -EDRIVE_CANT_DO_THIS;

/* reload fails on some drives, if the tray is locked */
if (CDROM_STATE_FLAGS(drive)->door_locked && ejectflag)
if (cd->state_flags.door_locked && ejectflag)
return 0;

cdrom_prepare_request(drive, &req);
Expand Down Expand Up @@ -1998,7 +1998,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
If it is, just return. */
(void) cdrom_check_status(drive, sense);

if (CDROM_STATE_FLAGS(drive)->toc_valid)
if (info->state_flags.toc_valid)
return 0;

/* Try to get the total cdrom capacity and sector size. */
Expand Down Expand Up @@ -2137,7 +2137,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
}

/* Remember that we've read this stuff. */
CDROM_STATE_FLAGS(drive)->toc_valid = 1;
info->state_flags.toc_valid = 1;

return 0;
}
Expand Down Expand Up @@ -2219,7 +2219,7 @@ static int cdrom_get_toc_entry(ide_drive_t *drive, int track,
/*
* don't serve cached data, if the toc isn't valid
*/
if (!CDROM_STATE_FLAGS(drive)->toc_valid)
if (!info->state_flags.toc_valid)
return -EINVAL;

/* Check validity of requested track number. */
Expand Down Expand Up @@ -2351,6 +2351,7 @@ static
int ide_cdrom_reset (struct cdrom_device_info *cdi)
{
ide_drive_t *drive = cdi->handle;
struct cdrom_info *cd = drive->driver_data;
struct request_sense sense;
struct request req;
int ret;
Expand All @@ -2364,7 +2365,7 @@ int ide_cdrom_reset (struct cdrom_device_info *cdi)
* A reset will unlock the door. If it was previously locked,
* lock it again.
*/
if (CDROM_STATE_FLAGS(drive)->door_locked)
if (cd->state_flags.door_locked)
(void) cdrom_lockdoor(drive, 1, &sense);

return ret;
Expand Down Expand Up @@ -2434,14 +2435,15 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page
maxspeed = be16_to_cpu(cap->maxspeed);
}

CDROM_STATE_FLAGS(drive)->current_speed = (curspeed + (176/2)) / 176;
cd->state_flags.current_speed = (curspeed + (176/2)) / 176;
cd->config_flags.max_speed = (maxspeed + (176/2)) / 176;
}

static
int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
{
ide_drive_t *drive = cdi->handle;
struct cdrom_info *cd = drive->driver_data;
struct request_sense sense;
struct atapi_capabilities_page cap;
int stat;
Expand All @@ -2451,7 +2453,7 @@ int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)

if (!ide_cdrom_get_capabilities(drive, &cap)) {
ide_cdrom_update_speed(drive, &cap);
cdi->speed = CDROM_STATE_FLAGS(drive)->current_speed;
cdi->speed = cd->state_flags.current_speed;
}
return 0;
}
Expand Down Expand Up @@ -2512,7 +2514,7 @@ int ide_cdrom_get_last_session (struct cdrom_device_info *cdi,
struct request_sense sense;
int ret;

if (!CDROM_STATE_FLAGS(drive)->toc_valid || info->toc == NULL)
if (!info->state_flags.toc_valid || info->toc == NULL)
if ((ret = cdrom_read_toc(drive, &sense)))
return ret;

Expand Down Expand Up @@ -2554,12 +2556,13 @@ int ide_cdrom_check_media_change_real (struct cdrom_device_info *cdi,
int slot_nr)
{
ide_drive_t *drive = cdi->handle;
struct cdrom_info *cd = drive->driver_data;
int retval;

if (slot_nr == CDSL_CURRENT) {
(void) cdrom_check_status(drive, NULL);
retval = CDROM_STATE_FLAGS(drive)->media_changed;
CDROM_STATE_FLAGS(drive)->media_changed = 0;
retval = cd->state_flags.media_changed;
cd->state_flags.media_changed = 0;
return retval;
} else {
return -EINVAL;
Expand All @@ -2581,9 +2584,10 @@ static
void ide_cdrom_release_real (struct cdrom_device_info *cdi)
{
ide_drive_t *drive = cdi->handle;
struct cdrom_info *cd = drive->driver_data;

if (!cdi->use_count)
CDROM_STATE_FLAGS(drive)->toc_valid = 0;
cd->state_flags.toc_valid = 0;
}

#define IDE_CD_CAPABILITIES \
Expand Down Expand Up @@ -2615,7 +2619,7 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
struct cdrom_device_info *devinfo = &info->devinfo;

devinfo->ops = &ide_cdrom_dops;
devinfo->speed = CDROM_STATE_FLAGS(drive)->current_speed;
devinfo->speed = info->state_flags.current_speed;
devinfo->capacity = nslots;
devinfo->handle = drive;
strcpy(devinfo->name, drive->name);
Expand Down Expand Up @@ -2841,7 +2845,7 @@ int ide_cdrom_setup (ide_drive_t *drive)

drive->special.all = 0;

CDROM_STATE_FLAGS(drive)->media_changed = 1;
cd->state_flags.media_changed = 1;

#if NO_DOOR_LOCKING
cd->config_flags.no_doorlock = 1;
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/ide/ide-cd.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ struct ide_cd_state_flags {
byte current_speed; /* Current speed of the drive */
};

#define CDROM_STATE_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->state_flags))

/* Structure of a MSF cdrom address. */
struct atapi_msf {
byte reserved;
Expand Down

0 comments on commit d511f53

Please sign in to comment.