aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-06-10 05:28:05 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-14 15:59:33 -0400
commit3eabddb8ed4f488664ff5d67968392bb424836a3 (patch)
tree54f86b3900246f91c0ff87943ef12e19c3fc7c15 /drivers/ata/libata-eh.c
parentec6add99307d5149e17f6e358f19f0205b622407 (diff)
libata-eh: update atapi_eh_request_sense() to take @dev instead of @qc
Update atapi_eh_request_sense() to take @dev, @sense_buf and @dfl_sense_key instead of taking @qc and extracting information from it. This change is to make the function more generic and allow it to be called from other places. While at it, make cdb initialization use initializer. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index d5f03a6e3334..58bdc538d229 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1360,6 +1360,7 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
1360 * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE 1360 * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE
1361 * @dev: device to perform REQUEST_SENSE to 1361 * @dev: device to perform REQUEST_SENSE to
1362 * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long) 1362 * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long)
1363 * @dfl_sense_key: default sense key to use
1363 * 1364 *
1364 * Perform ATAPI REQUEST_SENSE after the device reported CHECK 1365 * Perform ATAPI REQUEST_SENSE after the device reported CHECK
1365 * SENSE. This function is EH helper. 1366 * SENSE. This function is EH helper.
@@ -1370,13 +1371,13 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
1370 * RETURNS: 1371 * RETURNS:
1371 * 0 on success, AC_ERR_* mask on failure 1372 * 0 on success, AC_ERR_* mask on failure
1372 */ 1373 */
1373static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) 1374static unsigned int atapi_eh_request_sense(struct ata_device *dev,
1375 u8 *sense_buf, u8 dfl_sense_key)
1374{ 1376{
1375 struct ata_device *dev = qc->dev; 1377 u8 cdb[ATAPI_CDB_LEN] =
1376 unsigned char *sense_buf = qc->scsicmd->sense_buffer; 1378 { REQUEST_SENSE, 0, 0, 0, SCSI_SENSE_BUFFERSIZE, 0 };
1377 struct ata_port *ap = dev->link->ap; 1379 struct ata_port *ap = dev->link->ap;
1378 struct ata_taskfile tf; 1380 struct ata_taskfile tf;
1379 u8 cdb[ATAPI_CDB_LEN];
1380 1381
1381 DPRINTK("ATAPI request sense\n"); 1382 DPRINTK("ATAPI request sense\n");
1382 1383
@@ -1387,15 +1388,11 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc)
1387 * for the case where they are -not- overwritten 1388 * for the case where they are -not- overwritten
1388 */ 1389 */
1389 sense_buf[0] = 0x70; 1390 sense_buf[0] = 0x70;
1390 sense_buf[2] = qc->result_tf.feature >> 4; 1391 sense_buf[2] = dfl_sense_key;
1391 1392
1392 /* some devices time out if garbage left in tf */ 1393 /* some devices time out if garbage left in tf */
1393 ata_tf_init(dev, &tf); 1394 ata_tf_init(dev, &tf);
1394 1395
1395 memset(cdb, 0, ATAPI_CDB_LEN);
1396 cdb[0] = REQUEST_SENSE;
1397 cdb[4] = SCSI_SENSE_BUFFERSIZE;
1398
1399 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 1396 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1400 tf.command = ATA_CMD_PACKET; 1397 tf.command = ATA_CMD_PACKET;
1401 1398
@@ -1567,7 +1564,9 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
1567 1564
1568 case ATA_DEV_ATAPI: 1565 case ATA_DEV_ATAPI:
1569 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { 1566 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) {
1570 tmp = atapi_eh_request_sense(qc); 1567 tmp = atapi_eh_request_sense(qc->dev,
1568 qc->scsicmd->sense_buffer,
1569 qc->result_tf.feature >> 4);
1571 if (!tmp) { 1570 if (!tmp) {
1572 /* ATA_QCFLAG_SENSE_VALID is used to 1571 /* ATA_QCFLAG_SENSE_VALID is used to
1573 * tell atapi_qc_complete() that sense 1572 * tell atapi_qc_complete() that sense