diff options
author | Tejun Heo <htejun@gmail.com> | 2006-12-16 20:45:57 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-20 14:26:26 -0500 |
commit | ad706991f4f0d1476aecbdae2df5e36552b340b2 (patch) | |
tree | 3abc5ec16c191d168fd3a34dd1f6ea46491cb7b2 /drivers/ata/libata-scsi.c | |
parent | 542b1444c5639e5964f9aa99e1cb231381d8a7a4 (diff) |
[PATCH] libata: kill @cdb argument from xlat methods
xlat function will be updated to consider qc->scsicmd->cmd_len and
many xlat functions deference qc->scsicmd already. It doesn't make
sense to pass qc->scsicmd->cmnd as @cdb separately. Kill the
argument.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r-- | drivers/ata/libata-scsi.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 1e42cde05f43..307910bd62c3 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -51,7 +51,7 @@ | |||
51 | 51 | ||
52 | #define SECTOR_SIZE 512 | 52 | #define SECTOR_SIZE 512 |
53 | 53 | ||
54 | typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *cdb); | 54 | typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc); |
55 | 55 | ||
56 | static struct ata_device * __ata_scsi_find_dev(struct ata_port *ap, | 56 | static struct ata_device * __ata_scsi_find_dev(struct ata_port *ap, |
57 | const struct scsi_device *scsidev); | 57 | const struct scsi_device *scsidev); |
@@ -935,7 +935,6 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth) | |||
935 | /** | 935 | /** |
936 | * ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command | 936 | * ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command |
937 | * @qc: Storage for translated ATA taskfile | 937 | * @qc: Storage for translated ATA taskfile |
938 | * @cdb: SCSI command to translate | ||
939 | * | 938 | * |
940 | * Sets up an ATA taskfile to issue STANDBY (to stop) or READ VERIFY | 939 | * Sets up an ATA taskfile to issue STANDBY (to stop) or READ VERIFY |
941 | * (to start). Perhaps these commands should be preceded by | 940 | * (to start). Perhaps these commands should be preceded by |
@@ -948,11 +947,11 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth) | |||
948 | * RETURNS: | 947 | * RETURNS: |
949 | * Zero on success, non-zero on error. | 948 | * Zero on success, non-zero on error. |
950 | */ | 949 | */ |
951 | static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, | 950 | static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) |
952 | const u8 *cdb) | ||
953 | { | 951 | { |
954 | struct scsi_cmnd *scmd = qc->scsicmd; | 952 | struct scsi_cmnd *scmd = qc->scsicmd; |
955 | struct ata_taskfile *tf = &qc->tf; | 953 | struct ata_taskfile *tf = &qc->tf; |
954 | const u8 *cdb = scmd->cmnd; | ||
956 | 955 | ||
957 | tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR; | 956 | tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR; |
958 | tf->protocol = ATA_PROT_NODATA; | 957 | tf->protocol = ATA_PROT_NODATA; |
@@ -1005,7 +1004,6 @@ invalid_fld: | |||
1005 | /** | 1004 | /** |
1006 | * ata_scsi_flush_xlat - Translate SCSI SYNCHRONIZE CACHE command | 1005 | * ata_scsi_flush_xlat - Translate SCSI SYNCHRONIZE CACHE command |
1007 | * @qc: Storage for translated ATA taskfile | 1006 | * @qc: Storage for translated ATA taskfile |
1008 | * @cdb: SCSI command to translate (ignored) | ||
1009 | * | 1007 | * |
1010 | * Sets up an ATA taskfile to issue FLUSH CACHE or | 1008 | * Sets up an ATA taskfile to issue FLUSH CACHE or |
1011 | * FLUSH CACHE EXT. | 1009 | * FLUSH CACHE EXT. |
@@ -1016,7 +1014,7 @@ invalid_fld: | |||
1016 | * RETURNS: | 1014 | * RETURNS: |
1017 | * Zero on success, non-zero on error. | 1015 | * Zero on success, non-zero on error. |
1018 | */ | 1016 | */ |
1019 | static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, const u8 *cdb) | 1017 | static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc) |
1020 | { | 1018 | { |
1021 | struct ata_taskfile *tf = &qc->tf; | 1019 | struct ata_taskfile *tf = &qc->tf; |
1022 | 1020 | ||
@@ -1124,7 +1122,6 @@ static void scsi_16_lba_len(const u8 *cdb, u64 *plba, u32 *plen) | |||
1124 | /** | 1122 | /** |
1125 | * ata_scsi_verify_xlat - Translate SCSI VERIFY command into an ATA one | 1123 | * ata_scsi_verify_xlat - Translate SCSI VERIFY command into an ATA one |
1126 | * @qc: Storage for translated ATA taskfile | 1124 | * @qc: Storage for translated ATA taskfile |
1127 | * @cdb: SCSI command to translate | ||
1128 | * | 1125 | * |
1129 | * Converts SCSI VERIFY command to an ATA READ VERIFY command. | 1126 | * Converts SCSI VERIFY command to an ATA READ VERIFY command. |
1130 | * | 1127 | * |
@@ -1134,12 +1131,13 @@ static void scsi_16_lba_len(const u8 *cdb, u64 *plba, u32 *plen) | |||
1134 | * RETURNS: | 1131 | * RETURNS: |
1135 | * Zero on success, non-zero on error. | 1132 | * Zero on success, non-zero on error. |
1136 | */ | 1133 | */ |
1137 | static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *cdb) | 1134 | static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc) |
1138 | { | 1135 | { |
1139 | struct scsi_cmnd *scmd = qc->scsicmd; | 1136 | struct scsi_cmnd *scmd = qc->scsicmd; |
1140 | struct ata_taskfile *tf = &qc->tf; | 1137 | struct ata_taskfile *tf = &qc->tf; |
1141 | struct ata_device *dev = qc->dev; | 1138 | struct ata_device *dev = qc->dev; |
1142 | u64 dev_sectors = qc->dev->n_sectors; | 1139 | u64 dev_sectors = qc->dev->n_sectors; |
1140 | const u8 *cdb = scmd->cmnd; | ||
1143 | u64 block; | 1141 | u64 block; |
1144 | u32 n_block; | 1142 | u32 n_block; |
1145 | 1143 | ||
@@ -1242,7 +1240,6 @@ nothing_to_do: | |||
1242 | /** | 1240 | /** |
1243 | * ata_scsi_rw_xlat - Translate SCSI r/w command into an ATA one | 1241 | * ata_scsi_rw_xlat - Translate SCSI r/w command into an ATA one |
1244 | * @qc: Storage for translated ATA taskfile | 1242 | * @qc: Storage for translated ATA taskfile |
1245 | * @cdb: SCSI command to translate | ||
1246 | * | 1243 | * |
1247 | * Converts any of six SCSI read/write commands into the | 1244 | * Converts any of six SCSI read/write commands into the |
1248 | * ATA counterpart, including starting sector (LBA), | 1245 | * ATA counterpart, including starting sector (LBA), |
@@ -1258,9 +1255,10 @@ nothing_to_do: | |||
1258 | * RETURNS: | 1255 | * RETURNS: |
1259 | * Zero on success, non-zero on error. | 1256 | * Zero on success, non-zero on error. |
1260 | */ | 1257 | */ |
1261 | static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *cdb) | 1258 | static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) |
1262 | { | 1259 | { |
1263 | struct scsi_cmnd *scmd = qc->scsicmd; | 1260 | struct scsi_cmnd *scmd = qc->scsicmd; |
1261 | const u8 *cdb = scmd->cmnd; | ||
1264 | unsigned int tf_flags = 0; | 1262 | unsigned int tf_flags = 0; |
1265 | u64 block; | 1263 | u64 block; |
1266 | u32 n_block; | 1264 | u32 n_block; |
@@ -1451,7 +1449,6 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd, | |||
1451 | ata_xlat_func_t xlat_func) | 1449 | ata_xlat_func_t xlat_func) |
1452 | { | 1450 | { |
1453 | struct ata_queued_cmd *qc; | 1451 | struct ata_queued_cmd *qc; |
1454 | u8 *cdb = cmd->cmnd; | ||
1455 | int is_io = xlat_func == ata_scsi_rw_xlat; | 1452 | int is_io = xlat_func == ata_scsi_rw_xlat; |
1456 | 1453 | ||
1457 | VPRINTK("ENTER\n"); | 1454 | VPRINTK("ENTER\n"); |
@@ -1483,7 +1480,7 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd, | |||
1483 | 1480 | ||
1484 | qc->complete_fn = ata_scsi_qc_complete; | 1481 | qc->complete_fn = ata_scsi_qc_complete; |
1485 | 1482 | ||
1486 | if (xlat_func(qc, cdb)) | 1483 | if (xlat_func(qc)) |
1487 | goto early_finish; | 1484 | goto early_finish; |
1488 | 1485 | ||
1489 | /* select device, send command to hardware */ | 1486 | /* select device, send command to hardware */ |
@@ -2339,7 +2336,6 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2339 | /** | 2336 | /** |
2340 | * atapi_xlat - Initialize PACKET taskfile | 2337 | * atapi_xlat - Initialize PACKET taskfile |
2341 | * @qc: command structure to be initialized | 2338 | * @qc: command structure to be initialized |
2342 | * @cdb: SCSI CDB associated with this PACKET command | ||
2343 | * | 2339 | * |
2344 | * LOCKING: | 2340 | * LOCKING: |
2345 | * spin_lock_irqsave(host lock) | 2341 | * spin_lock_irqsave(host lock) |
@@ -2347,7 +2343,7 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2347 | * RETURNS: | 2343 | * RETURNS: |
2348 | * Zero on success, non-zero on failure. | 2344 | * Zero on success, non-zero on failure. |
2349 | */ | 2345 | */ |
2350 | static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *cdb) | 2346 | static unsigned int atapi_xlat(struct ata_queued_cmd *qc) |
2351 | { | 2347 | { |
2352 | struct scsi_cmnd *scmd = qc->scsicmd; | 2348 | struct scsi_cmnd *scmd = qc->scsicmd; |
2353 | struct ata_device *dev = qc->dev; | 2349 | struct ata_device *dev = qc->dev; |
@@ -2359,7 +2355,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *cdb) | |||
2359 | if (ata_check_atapi_dma(qc)) | 2355 | if (ata_check_atapi_dma(qc)) |
2360 | using_pio = 1; | 2356 | using_pio = 1; |
2361 | 2357 | ||
2362 | memcpy(&qc->cdb, cdb, dev->cdb_len); | 2358 | memcpy(&qc->cdb, scmd->cmnd, dev->cdb_len); |
2363 | 2359 | ||
2364 | qc->complete_fn = atapi_qc_complete; | 2360 | qc->complete_fn = atapi_qc_complete; |
2365 | 2361 | ||
@@ -2511,18 +2507,18 @@ ata_scsi_map_proto(u8 byte1) | |||
2511 | /** | 2507 | /** |
2512 | * ata_scsi_pass_thru - convert ATA pass-thru CDB to taskfile | 2508 | * ata_scsi_pass_thru - convert ATA pass-thru CDB to taskfile |
2513 | * @qc: command structure to be initialized | 2509 | * @qc: command structure to be initialized |
2514 | * @cdb: SCSI command to convert | ||
2515 | * | 2510 | * |
2516 | * Handles either 12 or 16-byte versions of the CDB. | 2511 | * Handles either 12 or 16-byte versions of the CDB. |
2517 | * | 2512 | * |
2518 | * RETURNS: | 2513 | * RETURNS: |
2519 | * Zero on success, non-zero on failure. | 2514 | * Zero on success, non-zero on failure. |
2520 | */ | 2515 | */ |
2521 | static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *cdb) | 2516 | static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) |
2522 | { | 2517 | { |
2523 | struct ata_taskfile *tf = &(qc->tf); | 2518 | struct ata_taskfile *tf = &(qc->tf); |
2524 | struct scsi_cmnd *scmd = qc->scsicmd; | 2519 | struct scsi_cmnd *scmd = qc->scsicmd; |
2525 | struct ata_device *dev = qc->dev; | 2520 | struct ata_device *dev = qc->dev; |
2521 | const u8 *cdb = scmd->cmnd; | ||
2526 | 2522 | ||
2527 | if ((tf->protocol = ata_scsi_map_proto(cdb[1])) == ATA_PROT_UNKNOWN) | 2523 | if ((tf->protocol = ata_scsi_map_proto(cdb[1])) == ATA_PROT_UNKNOWN) |
2528 | goto invalid_fld; | 2524 | goto invalid_fld; |