Commit 570f89ea authored by Borislav Petkov's avatar Borislav Petkov Committed by Bartlomiej Zolnierkiewicz

ide-cd: convert to using the new atapi_flags

There should be no functionality change resulting from this patch.

[bart: IDE_FLAG_* -> IDE_AFLAG_*, dev_flags -> atapi_flags]
Signed-off-by: default avatarBorislav Petkov <petkovbb@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent ac77ef8b
This diff is collapsed.
......@@ -27,42 +27,6 @@
#define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20)
#define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4
enum {
/* Device sends an interrupt when ready for a packet command. */
IDE_CD_FLAG_DRQ_INTERRUPT = (1 << 0),
/* Drive cannot lock the door. */
IDE_CD_FLAG_NO_DOORLOCK = (1 << 1),
/* Drive cannot eject the disc. */
IDE_CD_FLAG_NO_EJECT = (1 << 2),
/* Drive is a pre ATAPI 1.2 drive. */
IDE_CD_FLAG_PRE_ATAPI12 = (1 << 3),
/* TOC addresses are in BCD. */
IDE_CD_FLAG_TOCADDR_AS_BCD = (1 << 4),
/* TOC track numbers are in BCD. */
IDE_CD_FLAG_TOCTRACKS_AS_BCD = (1 << 5),
/*
* Drive does not provide data in multiples of SECTOR_SIZE
* when more than one interrupt is needed.
*/
IDE_CD_FLAG_LIMIT_NFRAMES = (1 << 6),
/* Seeking in progress. */
IDE_CD_FLAG_SEEKING = (1 << 7),
/* Driver has noticed a media change. */
IDE_CD_FLAG_MEDIA_CHANGED = (1 << 8),
/* Saved TOC information is current. */
IDE_CD_FLAG_TOC_VALID = (1 << 9),
/* We think that the drive door is locked. */
IDE_CD_FLAG_DOOR_LOCKED = (1 << 10),
/* SET_CD_SPEED command is unsupported. */
IDE_CD_FLAG_NO_SPEED_SELECT = (1 << 11),
IDE_CD_FLAG_VERTOS_300_SSD = (1 << 12),
IDE_CD_FLAG_VERTOS_600_ESD = (1 << 13),
IDE_CD_FLAG_SANYO_3CD = (1 << 14),
IDE_CD_FLAG_FULL_CAPS_PAGE = (1 << 15),
IDE_CD_FLAG_PLAY_AUDIO_OK = (1 << 16),
IDE_CD_FLAG_LE_SPEED_FIELDS = (1 << 17),
};
/* Structure of a MSF cdrom address. */
struct atapi_msf {
byte reserved;
......@@ -128,8 +92,6 @@ struct cdrom_info {
unsigned long last_block;
unsigned long start_seek;
unsigned int cd_flags;
u8 max_speed; /* Max speed of the drive. */
u8 current_speed; /* Current speed of the drive. */
......
......@@ -27,10 +27,9 @@ int ide_cdrom_open_real(struct cdrom_device_info *cdi, int purpose)
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)
cd->cd_flags &= ~IDE_CD_FLAG_TOC_VALID;
drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID;
}
/*
......@@ -83,13 +82,12 @@ 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 = (cd->cd_flags & IDE_CD_FLAG_MEDIA_CHANGED) ? 1 : 0;
cd->cd_flags &= ~IDE_CD_FLAG_MEDIA_CHANGED;
retval = (drive->atapi_flags & IDE_AFLAG_MEDIA_CHANGED) ? 1 : 0;
drive->atapi_flags &= ~IDE_AFLAG_MEDIA_CHANGED;
return retval;
} else {
return -EINVAL;
......@@ -107,11 +105,11 @@ int cdrom_eject(ide_drive_t *drive, int ejectflag,
char loej = 0x02;
unsigned char cmd[BLK_MAX_CDB];
if ((cd->cd_flags & IDE_CD_FLAG_NO_EJECT) && !ejectflag)
if ((drive->atapi_flags & IDE_AFLAG_NO_EJECT) && !ejectflag)
return -EDRIVE_CANT_DO_THIS;
/* reload fails on some drives, if the tray is locked */
if ((cd->cd_flags & IDE_CD_FLAG_DOOR_LOCKED) && ejectflag)
if ((drive->atapi_flags & IDE_AFLAG_DOOR_LOCKED) && ejectflag)
return 0;
/* only tell drive to close tray if open, if it can do that */
......@@ -131,7 +129,6 @@ static
int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
struct request_sense *sense)
{
struct cdrom_info *cd = drive->driver_data;
struct request_sense my_sense;
int stat;
......@@ -139,7 +136,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
sense = &my_sense;
/* If the drive cannot lock the door, just pretend. */
if (cd->cd_flags & IDE_CD_FLAG_NO_DOORLOCK) {
if (drive->atapi_flags & IDE_AFLAG_NO_DOORLOCK) {
stat = 0;
} else {
unsigned char cmd[BLK_MAX_CDB];
......@@ -160,7 +157,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
(sense->asc == 0x24 || sense->asc == 0x20)) {
printk(KERN_ERR "%s: door locking not supported\n",
drive->name);
cd->cd_flags |= IDE_CD_FLAG_NO_DOORLOCK;
drive->atapi_flags |= IDE_AFLAG_NO_DOORLOCK;
stat = 0;
}
......@@ -170,9 +167,9 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
if (stat == 0) {
if (lockflag)
cd->cd_flags |= IDE_CD_FLAG_DOOR_LOCKED;
drive->atapi_flags |= IDE_AFLAG_DOOR_LOCKED;
else
cd->cd_flags &= ~IDE_CD_FLAG_DOOR_LOCKED;
drive->atapi_flags &= ~IDE_AFLAG_DOOR_LOCKED;
}
return stat;
......@@ -250,7 +247,7 @@ int ide_cdrom_get_last_session(struct cdrom_device_info *cdi,
struct request_sense sense;
int ret;
if ((info->cd_flags & IDE_CD_FLAG_TOC_VALID) == 0 || !info->toc) {
if ((drive->atapi_flags & IDE_AFLAG_TOC_VALID) == 0 || !info->toc) {
ret = ide_cd_read_toc(drive, &sense);
if (ret)
return ret;
......@@ -308,7 +305,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 (cd->cd_flags & IDE_CD_FLAG_DOOR_LOCKED)
if (drive->atapi_flags & IDE_AFLAG_DOOR_LOCKED)
(void)ide_cd_lockdoor(drive, 1, &sense);
return ret;
......@@ -324,7 +321,7 @@ static int ide_cd_get_toc_entry(ide_drive_t *drive, int track,
/*
* don't serve cached data, if the toc isn't valid
*/
if ((info->cd_flags & IDE_CD_FLAG_TOC_VALID) == 0)
if ((drive->atapi_flags & IDE_AFLAG_TOC_VALID) == 0)
return -EINVAL;
/* Check validity of requested track number. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment