Commit ad706991 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

[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: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 542b1444
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#define SECTOR_SIZE 512 #define SECTOR_SIZE 512
typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *cdb); typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc);
static struct ata_device * __ata_scsi_find_dev(struct ata_port *ap, static struct ata_device * __ata_scsi_find_dev(struct ata_port *ap,
const struct scsi_device *scsidev); const struct scsi_device *scsidev);
...@@ -935,7 +935,6 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth) ...@@ -935,7 +935,6 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
/** /**
* ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command * ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command
* @qc: Storage for translated ATA taskfile * @qc: Storage for translated ATA taskfile
* @cdb: SCSI command to translate
* *
* Sets up an ATA taskfile to issue STANDBY (to stop) or READ VERIFY * Sets up an ATA taskfile to issue STANDBY (to stop) or READ VERIFY
* (to start). Perhaps these commands should be preceded by * (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,11 +947,11 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
* RETURNS: * RETURNS:
* Zero on success, non-zero on error. * Zero on success, non-zero on error.
*/ */
static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc)
const u8 *cdb)
{ {
struct scsi_cmnd *scmd = qc->scsicmd; struct scsi_cmnd *scmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->tf; struct ata_taskfile *tf = &qc->tf;
const u8 *cdb = scmd->cmnd;
tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR; tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
tf->protocol = ATA_PROT_NODATA; tf->protocol = ATA_PROT_NODATA;
...@@ -1005,7 +1004,6 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, ...@@ -1005,7 +1004,6 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc,
/** /**
* ata_scsi_flush_xlat - Translate SCSI SYNCHRONIZE CACHE command * ata_scsi_flush_xlat - Translate SCSI SYNCHRONIZE CACHE command
* @qc: Storage for translated ATA taskfile * @qc: Storage for translated ATA taskfile
* @cdb: SCSI command to translate (ignored)
* *
* Sets up an ATA taskfile to issue FLUSH CACHE or * Sets up an ATA taskfile to issue FLUSH CACHE or
* FLUSH CACHE EXT. * FLUSH CACHE EXT.
...@@ -1016,7 +1014,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, ...@@ -1016,7 +1014,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc,
* RETURNS: * RETURNS:
* Zero on success, non-zero on error. * Zero on success, non-zero on error.
*/ */
static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, const u8 *cdb) static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
{ {
struct ata_taskfile *tf = &qc->tf; struct ata_taskfile *tf = &qc->tf;
...@@ -1124,7 +1122,6 @@ static void scsi_16_lba_len(const u8 *cdb, u64 *plba, u32 *plen) ...@@ -1124,7 +1122,6 @@ static void scsi_16_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
/** /**
* ata_scsi_verify_xlat - Translate SCSI VERIFY command into an ATA one * ata_scsi_verify_xlat - Translate SCSI VERIFY command into an ATA one
* @qc: Storage for translated ATA taskfile * @qc: Storage for translated ATA taskfile
* @cdb: SCSI command to translate
* *
* Converts SCSI VERIFY command to an ATA READ VERIFY command. * Converts SCSI VERIFY command to an ATA READ VERIFY command.
* *
...@@ -1134,12 +1131,13 @@ static void scsi_16_lba_len(const u8 *cdb, u64 *plba, u32 *plen) ...@@ -1134,12 +1131,13 @@ static void scsi_16_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
* RETURNS: * RETURNS:
* Zero on success, non-zero on error. * Zero on success, non-zero on error.
*/ */
static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *cdb) static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc)
{ {
struct scsi_cmnd *scmd = qc->scsicmd; struct scsi_cmnd *scmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->tf; struct ata_taskfile *tf = &qc->tf;
struct ata_device *dev = qc->dev; struct ata_device *dev = qc->dev;
u64 dev_sectors = qc->dev->n_sectors; u64 dev_sectors = qc->dev->n_sectors;
const u8 *cdb = scmd->cmnd;
u64 block; u64 block;
u32 n_block; u32 n_block;
...@@ -1242,7 +1240,6 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *cd ...@@ -1242,7 +1240,6 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *cd
/** /**
* ata_scsi_rw_xlat - Translate SCSI r/w command into an ATA one * ata_scsi_rw_xlat - Translate SCSI r/w command into an ATA one
* @qc: Storage for translated ATA taskfile * @qc: Storage for translated ATA taskfile
* @cdb: SCSI command to translate
* *
* Converts any of six SCSI read/write commands into the * Converts any of six SCSI read/write commands into the
* ATA counterpart, including starting sector (LBA), * ATA counterpart, including starting sector (LBA),
...@@ -1258,9 +1255,10 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *cd ...@@ -1258,9 +1255,10 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *cd
* RETURNS: * RETURNS:
* Zero on success, non-zero on error. * Zero on success, non-zero on error.
*/ */
static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *cdb) static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
{ {
struct scsi_cmnd *scmd = qc->scsicmd; struct scsi_cmnd *scmd = qc->scsicmd;
const u8 *cdb = scmd->cmnd;
unsigned int tf_flags = 0; unsigned int tf_flags = 0;
u64 block; u64 block;
u32 n_block; u32 n_block;
...@@ -1451,7 +1449,6 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd, ...@@ -1451,7 +1449,6 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
ata_xlat_func_t xlat_func) ata_xlat_func_t xlat_func)
{ {
struct ata_queued_cmd *qc; struct ata_queued_cmd *qc;
u8 *cdb = cmd->cmnd;
int is_io = xlat_func == ata_scsi_rw_xlat; int is_io = xlat_func == ata_scsi_rw_xlat;
VPRINTK("ENTER\n"); VPRINTK("ENTER\n");
...@@ -1483,7 +1480,7 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd, ...@@ -1483,7 +1480,7 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
qc->complete_fn = ata_scsi_qc_complete; qc->complete_fn = ata_scsi_qc_complete;
if (xlat_func(qc, cdb)) if (xlat_func(qc))
goto early_finish; goto early_finish;
/* select device, send command to hardware */ /* select device, send command to hardware */
...@@ -2339,7 +2336,6 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) ...@@ -2339,7 +2336,6 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
/** /**
* atapi_xlat - Initialize PACKET taskfile * atapi_xlat - Initialize PACKET taskfile
* @qc: command structure to be initialized * @qc: command structure to be initialized
* @cdb: SCSI CDB associated with this PACKET command
* *
* LOCKING: * LOCKING:
* spin_lock_irqsave(host lock) * spin_lock_irqsave(host lock)
...@@ -2347,7 +2343,7 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) ...@@ -2347,7 +2343,7 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
* RETURNS: * RETURNS:
* Zero on success, non-zero on failure. * Zero on success, non-zero on failure.
*/ */
static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *cdb) static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
{ {
struct scsi_cmnd *scmd = qc->scsicmd; struct scsi_cmnd *scmd = qc->scsicmd;
struct ata_device *dev = qc->dev; struct ata_device *dev = qc->dev;
...@@ -2359,7 +2355,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *cdb) ...@@ -2359,7 +2355,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *cdb)
if (ata_check_atapi_dma(qc)) if (ata_check_atapi_dma(qc))
using_pio = 1; using_pio = 1;
memcpy(&qc->cdb, cdb, dev->cdb_len); memcpy(&qc->cdb, scmd->cmnd, dev->cdb_len);
qc->complete_fn = atapi_qc_complete; qc->complete_fn = atapi_qc_complete;
...@@ -2511,18 +2507,18 @@ ata_scsi_map_proto(u8 byte1) ...@@ -2511,18 +2507,18 @@ ata_scsi_map_proto(u8 byte1)
/** /**
* ata_scsi_pass_thru - convert ATA pass-thru CDB to taskfile * ata_scsi_pass_thru - convert ATA pass-thru CDB to taskfile
* @qc: command structure to be initialized * @qc: command structure to be initialized
* @cdb: SCSI command to convert
* *
* Handles either 12 or 16-byte versions of the CDB. * Handles either 12 or 16-byte versions of the CDB.
* *
* RETURNS: * RETURNS:
* Zero on success, non-zero on failure. * Zero on success, non-zero on failure.
*/ */
static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *cdb) static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
{ {
struct ata_taskfile *tf = &(qc->tf); struct ata_taskfile *tf = &(qc->tf);
struct scsi_cmnd *scmd = qc->scsicmd; struct scsi_cmnd *scmd = qc->scsicmd;
struct ata_device *dev = qc->dev; struct ata_device *dev = qc->dev;
const u8 *cdb = scmd->cmnd;
if ((tf->protocol = ata_scsi_map_proto(cdb[1])) == ATA_PROT_UNKNOWN) if ((tf->protocol = ata_scsi_map_proto(cdb[1])) == ATA_PROT_UNKNOWN)
goto invalid_fld; goto invalid_fld;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment