PATCH: change START_STOP to TEST_UNIT_READY
This patch changes a use of START_STOP to TEST_UNIT_READY in the function to check for a media change.
This is required for emulated SCSI busses (IEEE1394 sbp2 and usb-storage), as none of the 'popular' OSes will send a START_STOP unless the target requests it (via sense data that indicates a startup command is needed). Thus, lots of device firmware out there will crash or do something equally bad when a START_STOP is sent.
Yeah, busted devices, I know. But, in the end, people just want it to work, and there is no reason why we can't use TEST_UNIT_READY here instead. As the comments indicate, devices that need a spinup will get one anyway.
Will one of the SCSI gurus please send this to Linus?
Matt
# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.561.1.395 -> 1.636
# drivers/usb/storage/initializers.c 1.2.1.2 -> 1.5
# drivers/usb/storage/transport.h 1.7.1.5 -> 1.13
# drivers/usb/core/message.c 1.20.1.3 -> 1.22
# kernel/signal.c 1.23.1.6 -> 1.29
# drivers/usb/storage/datafab.c 1.8.1.5 -> 1.14
# drivers/usb/storage/protocol.c 1.7.1.3 -> 1.9
# drivers/usb/storage/usb.h 1.5.1.19 -> 1.26
# drivers/usb/storage/isd200.c 1.8.1.10 -> 1.19
# drivers/usb/storage/raw_bulk.h 1.1.1.3 -> 1.5
# drivers/usb/storage/jumpshot.c 1.10.1.6 -> 1.17
# drivers/usb/storage/debug.h 1.1.1.4 -> 1.6
# drivers/usb/storage/sddr55.c 1.3.1.6 -> 1.9
# drivers/usb/storage/shuttle_usbat.c 1.9.1.8 -> 1.18
# drivers/usb/storage/raw_bulk.c 1.1.1.10 -> 1.13
# drivers/usb/storage/sddr09.c 1.12.1.8 -> 1.21
# drivers/usb/storage/scsiglue.h 1.1.1.2 -> 1.4
# drivers/usb/storage/debug.c 1.8.1.2 -> 1.10
# drivers/scsi/sd.c 1.22.1.13 -> 1.36
# drivers/usb/storage/scsiglue.c 1.11.1.19 -> 1.30
# drivers/usb/storage/transport.c 1.17.1.37 -> 1.57
# drivers/scsi/scsi_scan.c 1.9.1.11 -> 1.16
# drivers/usb/storage/freecom.c 1.6.1.10 -> 1.17
# drivers/usb/storage/usb.c 1.16.1.33 -> 1.53
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/26 [email protected] 1.631.1.1
# Merge bk://linuxusb.bkbits.net/usb-2.5
# into zen.san.one-eyed-alien.net:/home/mdharm/linux-usb/greg-tree # -------------------------------------------- # 02/10/26 [email protected] 1.635 # Merge # -------------------------------------------- # 02/10/26 [email protected] 1.636 # Changed comments to match code. # -------------------------------------------- # diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c --- a/drivers/scsi/sd.c Sat Oct 26 18:29:11 2002 +++ b/drivers/scsi/sd.c Sat Oct 26 18:29:11 2002 @@ -733,15 +733,17 @@ * check_disk_change */ }
- /* Using Start/Stop enables differentiation between drive with
+ /* Using TEST_UNIT_READY enables differentiation between drive with
* no cartridge loaded - NOT READY, drive with changed cartridge -
* UNIT ATTENTION, or with same cartridge - GOOD STATUS.
- * This also handles drives that auto spin down. eg iomega jaz 1GB
- * as this will spin up the drive.
+ *
+ * Drives that auto spin down. eg iomega jaz 1G, will be started
+ * by sd_spinup_disk() from sd_init_onedisk(), which happens whenever
+ * sd_revalidate() is called.
*/
retval = -ENODEV;
if (scsi_block_when_processing_errors(sdp))
- retval = scsi_ioctl(sdp, SCSI_IOCTL_START_UNIT, NULL);
+ retval = scsi_ioctl(sdp, SCSI_IOCTL_TEST_UNIT_READY, NULL);
if (retval) { /* Unable to test, unit probably not ready.
* This usually means there is no disc in the
Signature · 6 lines
Matthew Dharm Home: [email protected] Maintainer, Linux USB Mass Storage Driver Dudes! May the Open Source be with you. -- Eric S. Raymond User Friendly, 12/3/1998