mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
Revert "scsi: sd: usb_storage: uas: Access media prior to querying device properties"
This reverts commit b73dd5f999 which is
commit 321da3dc1f3c92a12e3c5da934090d2992a8814c upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: I54aee6b89e0350b57183b081535ccc4f6d0a8638
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -3226,24 +3226,6 @@ static bool sd_validate_opt_xfer_size(struct scsi_disk *sdkp,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sd_read_block_zero(struct scsi_disk *sdkp)
|
|
||||||
{
|
|
||||||
unsigned int buf_len = sdkp->device->sector_size;
|
|
||||||
char *buffer, cmd[10] = { };
|
|
||||||
|
|
||||||
buffer = kmalloc(buf_len, GFP_KERNEL);
|
|
||||||
if (!buffer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
cmd[0] = READ_10;
|
|
||||||
put_unaligned_be32(0, &cmd[2]); /* Logical block address 0 */
|
|
||||||
put_unaligned_be16(1, &cmd[7]); /* Transfer 1 logical block */
|
|
||||||
|
|
||||||
scsi_execute_cmd(sdkp->device, cmd, REQ_OP_DRV_IN, buffer, buf_len,
|
|
||||||
SD_TIMEOUT, sdkp->max_retries, NULL);
|
|
||||||
kfree(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sd_revalidate_disk - called the first time a new disk is seen,
|
* sd_revalidate_disk - called the first time a new disk is seen,
|
||||||
* performs disk spin up, read_capacity, etc.
|
* performs disk spin up, read_capacity, etc.
|
||||||
@@ -3283,13 +3265,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
|
|||||||
*/
|
*/
|
||||||
if (sdkp->media_present) {
|
if (sdkp->media_present) {
|
||||||
sd_read_capacity(sdkp, buffer);
|
sd_read_capacity(sdkp, buffer);
|
||||||
/*
|
|
||||||
* Some USB/UAS devices return generic values for mode pages
|
|
||||||
* until the media has been accessed. Trigger a READ operation
|
|
||||||
* to force the device to populate mode pages.
|
|
||||||
*/
|
|
||||||
if (sdp->read_before_ms)
|
|
||||||
sd_read_block_zero(sdkp);
|
|
||||||
/*
|
/*
|
||||||
* set the default to rotational. All non-rotational devices
|
* set the default to rotational. All non-rotational devices
|
||||||
* support the block characteristics VPD page, which will
|
* support the block characteristics VPD page, which will
|
||||||
|
|||||||
@@ -179,13 +179,6 @@ static int slave_configure(struct scsi_device *sdev)
|
|||||||
*/
|
*/
|
||||||
sdev->use_192_bytes_for_3f = 1;
|
sdev->use_192_bytes_for_3f = 1;
|
||||||
|
|
||||||
/*
|
|
||||||
* Some devices report generic values until the media has been
|
|
||||||
* accessed. Force a READ(10) prior to querying device
|
|
||||||
* characteristics.
|
|
||||||
*/
|
|
||||||
sdev->read_before_ms = 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some devices don't like MODE SENSE with page=0x3f,
|
* Some devices don't like MODE SENSE with page=0x3f,
|
||||||
* which is the command used for checking if a device
|
* which is the command used for checking if a device
|
||||||
|
|||||||
@@ -878,13 +878,6 @@ static int uas_slave_configure(struct scsi_device *sdev)
|
|||||||
if (devinfo->flags & US_FL_CAPACITY_HEURISTICS)
|
if (devinfo->flags & US_FL_CAPACITY_HEURISTICS)
|
||||||
sdev->guess_capacity = 1;
|
sdev->guess_capacity = 1;
|
||||||
|
|
||||||
/*
|
|
||||||
* Some devices report generic values until the media has been
|
|
||||||
* accessed. Force a READ(10) prior to querying device
|
|
||||||
* characteristics.
|
|
||||||
*/
|
|
||||||
sdev->read_before_ms = 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some devices don't like MODE SENSE with page=0x3f,
|
* Some devices don't like MODE SENSE with page=0x3f,
|
||||||
* which is the command used for checking if a device
|
* which is the command used for checking if a device
|
||||||
|
|||||||
@@ -179,7 +179,6 @@ struct scsi_device {
|
|||||||
unsigned use_10_for_rw:1; /* first try 10-byte read / write */
|
unsigned use_10_for_rw:1; /* first try 10-byte read / write */
|
||||||
unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
|
unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
|
||||||
unsigned set_dbd_for_ms:1; /* Set "DBD" field in mode sense */
|
unsigned set_dbd_for_ms:1; /* Set "DBD" field in mode sense */
|
||||||
unsigned read_before_ms:1; /* perform a READ before MODE SENSE */
|
|
||||||
unsigned no_report_opcodes:1; /* no REPORT SUPPORTED OPERATION CODES */
|
unsigned no_report_opcodes:1; /* no REPORT SUPPORTED OPERATION CODES */
|
||||||
unsigned no_write_same:1; /* no WRITE SAME command */
|
unsigned no_write_same:1; /* no WRITE SAME command */
|
||||||
unsigned use_16_for_rw:1; /* Use read/write(16) over read/write(10) */
|
unsigned use_16_for_rw:1; /* Use read/write(16) over read/write(10) */
|
||||||
|
|||||||
Reference in New Issue
Block a user