Commit e80b002b authored by Eric Moore's avatar Eric Moore Committed by James Bottomley

[SCSI] mpt fusion: removing references to hd->ioc

Cleaning up code by accesing the ioc pointer directly instead of via hd->ioc.  In the future, most data members of struct MPT_SCSI_HOST will be either deleted or moved to struct MPT_ADAPTER.
Signed-off-by: default avatarEric Moore <Eric.Moore@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent a69de507
...@@ -194,12 +194,14 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, ...@@ -194,12 +194,14 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
unsigned long flags; unsigned long flags;
int ready; int ready;
MPT_ADAPTER *ioc;
hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
ioc = hd->ioc;
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) { while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
"mptfc_block_error_handler.%d: %d:%d, port status is " "mptfc_block_error_handler.%d: %d:%d, port status is "
"DID_IMM_RETRY, deferring %s recovery.\n", "DID_IMM_RETRY, deferring %s recovery.\n",
((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
...@@ -211,7 +213,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, ...@@ -211,7 +213,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) { if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) {
dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
"%s.%d: %d:%d, failing recovery, " "%s.%d: %d:%d, failing recovery, "
"port state %d, vdevice %p.\n", caller, "port state %d, vdevice %p.\n", caller,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
...@@ -220,7 +222,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, ...@@ -220,7 +222,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
SCpnt->device->hostdata)); SCpnt->device->hostdata));
return FAILED; return FAILED;
} }
dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
"%s.%d: %d:%d, executing recovery.\n", caller, "%s.%d: %d:%d, executing recovery.\n", caller,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no, ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
...@@ -605,7 +607,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) ...@@ -605,7 +607,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
VirtDevice *vdevice; VirtDevice *vdevice;
struct scsi_target *starget; struct scsi_target *starget;
struct fc_rport *rport; struct fc_rport *rport;
MPT_ADAPTER *ioc;
starget = scsi_target(sdev); starget = scsi_target(sdev);
rport = starget_to_rport(starget); rport = starget_to_rport(starget);
...@@ -614,11 +616,12 @@ mptfc_slave_alloc(struct scsi_device *sdev) ...@@ -614,11 +616,12 @@ mptfc_slave_alloc(struct scsi_device *sdev)
return -ENXIO; return -ENXIO;
hd = (MPT_SCSI_HOST *)sdev->host->hostdata; hd = (MPT_SCSI_HOST *)sdev->host->hostdata;
ioc = hd->ioc;
vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
if (!vdevice) { if (!vdevice) {
printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n",
hd->ioc->name, sizeof(VirtDevice)); ioc->name, sizeof(VirtDevice));
return -ENOMEM; return -ENOMEM;
} }
...@@ -627,7 +630,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) ...@@ -627,7 +630,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
vtarget = starget->hostdata; vtarget = starget->hostdata;
if (vtarget->num_luns == 0) { if (vtarget->num_luns == 0) {
vtarget->ioc_id = hd->ioc->id; vtarget->ioc_id = ioc->id;
vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; vtarget->tflags = MPT_TARGET_FLAGS_Q_YES;
} }
...@@ -637,7 +640,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) ...@@ -637,7 +640,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
vtarget->num_luns++; vtarget->num_luns++;
mptfc_dump_lun_info(hd->ioc, rport, sdev, vtarget); mptfc_dump_lun_info(ioc, rport, sdev, vtarget);
return 0; return 0;
} }
......
...@@ -846,13 +846,14 @@ mptsas_target_alloc(struct scsi_target *starget) ...@@ -846,13 +846,14 @@ mptsas_target_alloc(struct scsi_target *starget)
struct sas_rphy *rphy; struct sas_rphy *rphy;
struct mptsas_portinfo *p; struct mptsas_portinfo *p;
int i; int i;
MPT_ADAPTER *ioc = hd->ioc;
vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL);
if (!vtarget) if (!vtarget)
return -ENOMEM; return -ENOMEM;
vtarget->starget = starget; vtarget->starget = starget;
vtarget->ioc_id = hd->ioc->id; vtarget->ioc_id = ioc->id;
vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; vtarget->tflags = MPT_TARGET_FLAGS_Q_YES;
id = starget->id; id = starget->id;
channel = 0; channel = 0;
...@@ -861,15 +862,15 @@ mptsas_target_alloc(struct scsi_target *starget) ...@@ -861,15 +862,15 @@ mptsas_target_alloc(struct scsi_target *starget)
* RAID volumes placed beyond the last expected port. * RAID volumes placed beyond the last expected port.
*/ */
if (starget->channel == MPTSAS_RAID_CHANNEL) { if (starget->channel == MPTSAS_RAID_CHANNEL) {
for (i=0; i < hd->ioc->raid_data.pIocPg2->NumActiveVolumes; i++) for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
if (id == hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID) if (id == ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID)
channel = hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus; channel = ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus;
goto out; goto out;
} }
rphy = dev_to_rphy(starget->dev.parent); rphy = dev_to_rphy(starget->dev.parent);
mutex_lock(&hd->ioc->sas_topology_mutex); mutex_lock(&ioc->sas_topology_mutex);
list_for_each_entry(p, &hd->ioc->sas_topology, list) { list_for_each_entry(p, &ioc->sas_topology, list) {
for (i = 0; i < p->num_phys; i++) { for (i = 0; i < p->num_phys; i++) {
if (p->phy_info[i].attached.sas_address != if (p->phy_info[i].attached.sas_address !=
rphy->identify.sas_address) rphy->identify.sas_address)
...@@ -881,18 +882,18 @@ mptsas_target_alloc(struct scsi_target *starget) ...@@ -881,18 +882,18 @@ mptsas_target_alloc(struct scsi_target *starget)
/* /*
* Exposing hidden raid components * Exposing hidden raid components
*/ */
if (mptscsih_is_phys_disk(hd->ioc, channel, id)) { if (mptscsih_is_phys_disk(ioc, channel, id)) {
id = mptscsih_raid_id_to_num(hd->ioc, id = mptscsih_raid_id_to_num(ioc,
channel, id); channel, id);
vtarget->tflags |= vtarget->tflags |=
MPT_TARGET_FLAGS_RAID_COMPONENT; MPT_TARGET_FLAGS_RAID_COMPONENT;
p->phy_info[i].attached.phys_disk_num = id; p->phy_info[i].attached.phys_disk_num = id;
} }
mutex_unlock(&hd->ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
goto out; goto out;
} }
} }
mutex_unlock(&hd->ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
kfree(vtarget); kfree(vtarget);
return -ENXIO; return -ENXIO;
...@@ -912,6 +913,7 @@ mptsas_target_destroy(struct scsi_target *starget) ...@@ -912,6 +913,7 @@ mptsas_target_destroy(struct scsi_target *starget)
struct sas_rphy *rphy; struct sas_rphy *rphy;
struct mptsas_portinfo *p; struct mptsas_portinfo *p;
int i; int i;
MPT_ADAPTER *ioc = hd->ioc;
if (!starget->hostdata) if (!starget->hostdata)
return; return;
...@@ -920,7 +922,7 @@ mptsas_target_destroy(struct scsi_target *starget) ...@@ -920,7 +922,7 @@ mptsas_target_destroy(struct scsi_target *starget)
goto out; goto out;
rphy = dev_to_rphy(starget->dev.parent); rphy = dev_to_rphy(starget->dev.parent);
list_for_each_entry(p, &hd->ioc->sas_topology, list) { list_for_each_entry(p, &ioc->sas_topology, list) {
for (i = 0; i < p->num_phys; i++) { for (i = 0; i < p->num_phys; i++) {
if (p->phy_info[i].attached.sas_address != if (p->phy_info[i].attached.sas_address !=
rphy->identify.sas_address) rphy->identify.sas_address)
...@@ -946,11 +948,12 @@ mptsas_slave_alloc(struct scsi_device *sdev) ...@@ -946,11 +948,12 @@ mptsas_slave_alloc(struct scsi_device *sdev)
VirtDevice *vdevice; VirtDevice *vdevice;
struct scsi_target *starget; struct scsi_target *starget;
int i; int i;
MPT_ADAPTER *ioc = hd->ioc;
vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
if (!vdevice) { if (!vdevice) {
printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n", printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n",
hd->ioc->name, sizeof(VirtDevice)); ioc->name, sizeof(VirtDevice));
return -ENOMEM; return -ENOMEM;
} }
starget = scsi_target(sdev); starget = scsi_target(sdev);
...@@ -960,8 +963,8 @@ mptsas_slave_alloc(struct scsi_device *sdev) ...@@ -960,8 +963,8 @@ mptsas_slave_alloc(struct scsi_device *sdev)
goto out; goto out;
rphy = dev_to_rphy(sdev->sdev_target->dev.parent); rphy = dev_to_rphy(sdev->sdev_target->dev.parent);
mutex_lock(&hd->ioc->sas_topology_mutex); mutex_lock(&ioc->sas_topology_mutex);
list_for_each_entry(p, &hd->ioc->sas_topology, list) { list_for_each_entry(p, &ioc->sas_topology, list) {
for (i = 0; i < p->num_phys; i++) { for (i = 0; i < p->num_phys; i++) {
if (p->phy_info[i].attached.sas_address != if (p->phy_info[i].attached.sas_address !=
rphy->identify.sas_address) rphy->identify.sas_address)
...@@ -970,15 +973,15 @@ mptsas_slave_alloc(struct scsi_device *sdev) ...@@ -970,15 +973,15 @@ mptsas_slave_alloc(struct scsi_device *sdev)
/* /*
* Exposing hidden raid components * Exposing hidden raid components
*/ */
if (mptscsih_is_phys_disk(hd->ioc, if (mptscsih_is_phys_disk(ioc,
p->phy_info[i].attached.channel, p->phy_info[i].attached.channel,
p->phy_info[i].attached.id)) p->phy_info[i].attached.id))
sdev->no_uld_attach = 1; sdev->no_uld_attach = 1;
mutex_unlock(&hd->ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
goto out; goto out;
} }
} }
mutex_unlock(&hd->ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
kfree(vdevice); kfree(vdevice);
return -ENXIO; return -ENXIO;
......
This diff is collapsed.
This diff is collapsed.
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