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,
stat = 0;
if (stat == 0)
- CDROM_STATE_FLAGS(drive)->door_locked = lockflag;
+ cd->state_flags.door_locked = lockflag;
return stat;
}
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);
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. */
}
/* Remember that we've read this stuff. */
- CDROM_STATE_FLAGS(drive)->toc_valid = 1;
+ info->state_flags.toc_valid = 1;
return 0;
}
/*
* 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. */
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;
* 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;
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;
}
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;
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;
}
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;
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;
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 \
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);
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;