Commit e5718774 authored by Mark Haverkamp's avatar Mark Haverkamp Committed by James Bottomley

[SCSI] aacraid: Use scmd_ functions

Received from Mark Salyzyn

Clean up the remaining scsi id access methods, drop ID_LUN_TO_CONTAINER
macro.
Signed-off-by: default avatarMark Haverkamp <markh@osdl.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent ef265673
...@@ -909,7 +909,7 @@ static void io_callback(void *context, struct fib * fibptr) ...@@ -909,7 +909,7 @@ static void io_callback(void *context, struct fib * fibptr)
scsicmd = (struct scsi_cmnd *) context; scsicmd = (struct scsi_cmnd *) context;
dev = (struct aac_dev *)scsicmd->device->host->hostdata; dev = (struct aac_dev *)scsicmd->device->host->hostdata;
cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); cid = scmd_id(scsicmd);
if (nblank(dprintk(x))) { if (nblank(dprintk(x))) {
u64 lba; u64 lba;
...@@ -1354,7 +1354,7 @@ static void synchronize_callback(void *context, struct fib *fibptr) ...@@ -1354,7 +1354,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)
else { else {
struct scsi_device *sdev = cmd->device; struct scsi_device *sdev = cmd->device;
struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata;
u32 cid = ID_LUN_TO_CONTAINER(sdev->id, sdev->lun); u32 cid = sdev_id(sdev);
printk(KERN_WARNING printk(KERN_WARNING
"synchronize_callback: synchronize failed, status = %d\n", "synchronize_callback: synchronize failed, status = %d\n",
le32_to_cpu(synchronizereply->status)); le32_to_cpu(synchronizereply->status));
...@@ -1466,13 +1466,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -1466,13 +1466,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
* itself. * itself.
*/ */
if (scmd_id(scsicmd) != host->this_id) { if (scmd_id(scsicmd) != host->this_id) {
if ((scsicmd->device->channel == CONTAINER_CHANNEL)) { if ((scmd_channel(scsicmd) == CONTAINER_CHANNEL)) {
if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ if((scmd_id(scsicmd) >= dev->maximum_num_containers) ||
(scsicmd->device->lun != 0)) {
scsicmd->result = DID_NO_CONNECT << 16; scsicmd->result = DID_NO_CONNECT << 16;
scsicmd->scsi_done(scsicmd); scsicmd->scsi_done(scsicmd);
return 0; return 0;
} }
cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); cid = scmd_id(scsicmd);
/* /*
* If the target container doesn't exist, it may have * If the target container doesn't exist, it may have
...@@ -1548,7 +1549,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -1548,7 +1549,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
{ {
struct inquiry_data inq_data; struct inquiry_data inq_data;
dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->device->id)); dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scmd_id(scsicmd)));
memset(&inq_data, 0, sizeof (struct inquiry_data)); memset(&inq_data, 0, sizeof (struct inquiry_data));
inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */ inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */
...@@ -1778,7 +1779,7 @@ static int query_disk(struct aac_dev *dev, void __user *arg) ...@@ -1778,7 +1779,7 @@ static int query_disk(struct aac_dev *dev, void __user *arg)
if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk))) if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk)))
return -EFAULT; return -EFAULT;
if (qd.cnum == -1) if (qd.cnum == -1)
qd.cnum = ID_LUN_TO_CONTAINER(qd.id, qd.lun); qd.cnum = qd.id;
else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1))
{ {
if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers) if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers)
...@@ -2068,7 +2069,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) ...@@ -2068,7 +2069,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
u32 timeout; u32 timeout;
dev = (struct aac_dev *)scsicmd->device->host->hostdata; dev = (struct aac_dev *)scsicmd->device->host->hostdata;
if (scsicmd->device->id >= dev->maximum_num_physicals || if (scmd_id(scsicmd) >= dev->maximum_num_physicals ||
scsicmd->device->lun > 7) { scsicmd->device->lun > 7) {
scsicmd->result = DID_NO_CONNECT << 16; scsicmd->result = DID_NO_CONNECT << 16;
scsicmd->scsi_done(scsicmd); scsicmd->scsi_done(scsicmd);
...@@ -2103,8 +2104,8 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) ...@@ -2103,8 +2104,8 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext); srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext);
srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi);
srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scsicmd->device->channel)); srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scmd_channel(scsicmd)));
srbcmd->id = cpu_to_le32(scsicmd->device->id); srbcmd->id = cpu_to_le32(scmd_id(scsicmd));
srbcmd->lun = cpu_to_le32(scsicmd->device->lun); srbcmd->lun = cpu_to_le32(scsicmd->device->lun);
srbcmd->flags = cpu_to_le32(flag); srbcmd->flags = cpu_to_le32(flag);
timeout = scsicmd->timeout_per_command/HZ; timeout = scsicmd->timeout_per_command/HZ;
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
* These macros convert from physical channels to virtual channels * These macros convert from physical channels to virtual channels
*/ */
#define CONTAINER_CHANNEL (0) #define CONTAINER_CHANNEL (0)
#define ID_LUN_TO_CONTAINER(id, lun) (id)
#define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL) #define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL)
#define CONTAINER_TO_ID(cont) (cont) #define CONTAINER_TO_ID(cont) (cont)
#define CONTAINER_TO_LUN(cont) (0) #define CONTAINER_TO_LUN(cont) (0)
......
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