@@ -605,7 +605,7 @@ static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr)
struct pcd_unit *cd = cdi->handle;
if (pcd_ready_wait(cd, PCD_READY_TMO))
- return CDS_DRIVE_NOT_READY;
+ return CDS_DRIVE_ERROR;
if (pcd_atapi(cd, rc_cmd, 8, pcd_scratch, DBMSG("check media")))
return CDS_NO_DISC;
return CDS_DISC_OK;
@@ -390,7 +390,7 @@ static int gdrom_drivestatus(struct cdrom_device_info *cd_info, int ignore)
if (sense == 0)
return CDS_DISC_OK;
if (sense == 0x20)
- return CDS_DRIVE_NOT_READY;
+ return CDS_DRIVE_ERROR;
/* default */
return CDS_NO_INFO;
}
@@ -62,9 +62,13 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr)
return CDS_NO_DISC;
}
- if (sense.sense_key == NOT_READY && sense.asc == 0x04
- && sense.ascq == 0x04)
- return CDS_DISC_OK;
+ if (sense.sense_key == NOT_READY && sense.asc == 0x04)
+ switch (sense.ascq) {
+ case 0x01:
+ return CDS_DRIVE_NOT_READY;
+ case 0x04:
+ return CDS_DISC_OK;
+ }
/*
* If not using Mt Fuji extended media tray reports,
@@ -77,7 +81,7 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr)
else
return CDS_TRAY_OPEN;
}
- return CDS_DRIVE_NOT_READY;
+ return CDS_DRIVE_ERROR;
}
/*
@@ -333,7 +333,7 @@ int sr_drive_status(struct cdrom_device_info *cdi, int slot)
else
return CDS_TRAY_OPEN;
- return CDS_DRIVE_NOT_READY;
+ return CDS_DRIVE_ERROR;
}
int sr_disk_status(struct cdrom_device_info *cdi)
@@ -398,6 +398,7 @@ struct cdrom_generic_command
#define CDS_TRAY_OPEN 2
#define CDS_DRIVE_NOT_READY 3
#define CDS_DISC_OK 4
+#define CDS_DRIVE_ERROR 5
/* return values for the CDROM_DISC_STATUS ioctl */
/* can also return CDS_NO_[INFO|DISC], from above */
CDS_DRIVE_NOT_READY is used for the state in which CDROM is 'becoming ready' (typically analyzing the disc) but also as the fallback when nothing else applies. Introduce CDS_DRIVE_ERROR for the fallback case. Signed-off-by: Michal Suchanek <msuchanek@suse.de> --- drivers/block/paride/pcd.c | 2 +- drivers/cdrom/gdrom.c | 2 +- drivers/ide/ide-cd_ioctl.c | 12 ++++++++---- drivers/scsi/sr_ioctl.c | 2 +- include/uapi/linux/cdrom.h | 1 + 5 files changed, 12 insertions(+), 7 deletions(-)