Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[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
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -194,12 +194,14 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
	struct fc_rport		*rport = starget_to_rport(scsi_target(sdev));
	unsigned long		flags;
	int			ready;
	MPT_ADAPTER 		*ioc;

	hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
	ioc = hd->ioc;
	spin_lock_irqsave(shost->host_lock, flags);
	while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
		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 "
			"DID_IMM_RETRY, deferring %s recovery.\n",
			((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
@@ -211,7 +213,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
	spin_unlock_irqrestore(shost->host_lock, flags);

	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, "
			"port state %d, vdevice %p.\n", caller,
			((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
@@ -220,7 +222,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
			SCpnt->device->hostdata));
		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,
		((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
		((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
@@ -605,7 +607,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
	VirtDevice		*vdevice;
	struct scsi_target	*starget;
	struct fc_rport		*rport;

	MPT_ADAPTER 		*ioc;

	starget = scsi_target(sdev);
	rport = starget_to_rport(starget);
@@ -614,11 +616,12 @@ mptfc_slave_alloc(struct scsi_device *sdev)
		return -ENXIO;

	hd = (MPT_SCSI_HOST *)sdev->host->hostdata;
	ioc = hd->ioc;

	vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
	if (!vdevice) {
		printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n",
				hd->ioc->name, sizeof(VirtDevice));
				ioc->name, sizeof(VirtDevice));
		return -ENOMEM;
	}

@@ -627,7 +630,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
	vtarget = starget->hostdata;

	if (vtarget->num_luns == 0) {
		vtarget->ioc_id = hd->ioc->id;
		vtarget->ioc_id = ioc->id;
		vtarget->tflags = MPT_TARGET_FLAGS_Q_YES;
	}

@@ -637,7 +640,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
	vtarget->num_luns++;


	mptfc_dump_lun_info(hd->ioc, rport, sdev, vtarget);
	mptfc_dump_lun_info(ioc, rport, sdev, vtarget);

	return 0;
}
+20 −17
Original line number Diff line number Diff line
@@ -846,13 +846,14 @@ mptsas_target_alloc(struct scsi_target *starget)
	struct sas_rphy		*rphy;
	struct mptsas_portinfo	*p;
	int 			 i;
	MPT_ADAPTER		*ioc = hd->ioc;

	vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL);
	if (!vtarget)
		return -ENOMEM;

	vtarget->starget = starget;
	vtarget->ioc_id = hd->ioc->id;
	vtarget->ioc_id = ioc->id;
	vtarget->tflags = MPT_TARGET_FLAGS_Q_YES;
	id = starget->id;
	channel = 0;
@@ -861,15 +862,15 @@ mptsas_target_alloc(struct scsi_target *starget)
	 * RAID volumes placed beyond the last expected port.
	 */
	if (starget->channel == MPTSAS_RAID_CHANNEL) {
		for (i=0; i < hd->ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
			if (id == hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID)
				channel = hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus;
		for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
			if (id == ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID)
				channel = ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus;
		goto out;
	}

	rphy = dev_to_rphy(starget->dev.parent);
	mutex_lock(&hd->ioc->sas_topology_mutex);
	list_for_each_entry(p, &hd->ioc->sas_topology, list) {
	mutex_lock(&ioc->sas_topology_mutex);
	list_for_each_entry(p, &ioc->sas_topology, list) {
		for (i = 0; i < p->num_phys; i++) {
			if (p->phy_info[i].attached.sas_address !=
					rphy->identify.sas_address)
@@ -881,18 +882,18 @@ mptsas_target_alloc(struct scsi_target *starget)
			/*
			 * Exposing hidden raid components
			 */
			if (mptscsih_is_phys_disk(hd->ioc, channel, id)) {
				id = mptscsih_raid_id_to_num(hd->ioc,
			if (mptscsih_is_phys_disk(ioc, channel, id)) {
				id = mptscsih_raid_id_to_num(ioc,
						channel, id);
				vtarget->tflags |=
				    MPT_TARGET_FLAGS_RAID_COMPONENT;
				p->phy_info[i].attached.phys_disk_num = id;
			}
			mutex_unlock(&hd->ioc->sas_topology_mutex);
			mutex_unlock(&ioc->sas_topology_mutex);
			goto out;
		}
	}
	mutex_unlock(&hd->ioc->sas_topology_mutex);
	mutex_unlock(&ioc->sas_topology_mutex);

	kfree(vtarget);
	return -ENXIO;
@@ -912,6 +913,7 @@ mptsas_target_destroy(struct scsi_target *starget)
	struct sas_rphy		*rphy;
	struct mptsas_portinfo	*p;
	int 			 i;
	MPT_ADAPTER *ioc = hd->ioc;

	if (!starget->hostdata)
		return;
@@ -920,7 +922,7 @@ mptsas_target_destroy(struct scsi_target *starget)
		goto out;

	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++) {
			if (p->phy_info[i].attached.sas_address !=
					rphy->identify.sas_address)
@@ -946,11 +948,12 @@ mptsas_slave_alloc(struct scsi_device *sdev)
	VirtDevice		*vdevice;
	struct scsi_target 	*starget;
	int 			i;
	MPT_ADAPTER *ioc = hd->ioc;

	vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
	if (!vdevice) {
		printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n",
				hd->ioc->name, sizeof(VirtDevice));
				ioc->name, sizeof(VirtDevice));
		return -ENOMEM;
	}
	starget = scsi_target(sdev);
@@ -960,8 +963,8 @@ mptsas_slave_alloc(struct scsi_device *sdev)
		goto out;

	rphy = dev_to_rphy(sdev->sdev_target->dev.parent);
	mutex_lock(&hd->ioc->sas_topology_mutex);
	list_for_each_entry(p, &hd->ioc->sas_topology, list) {
	mutex_lock(&ioc->sas_topology_mutex);
	list_for_each_entry(p, &ioc->sas_topology, list) {
		for (i = 0; i < p->num_phys; i++) {
			if (p->phy_info[i].attached.sas_address !=
					rphy->identify.sas_address)
@@ -970,15 +973,15 @@ mptsas_slave_alloc(struct scsi_device *sdev)
			/*
			 * 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.id))
				sdev->no_uld_attach = 1;
			mutex_unlock(&hd->ioc->sas_topology_mutex);
			mutex_unlock(&ioc->sas_topology_mutex);
			goto out;
		}
	}
	mutex_unlock(&hd->ioc->sas_topology_mutex);
	mutex_unlock(&ioc->sas_topology_mutex);

	kfree(vdevice);
	return -ENXIO;
+104 −95

File changed.

Preview size limit exceeded, changes collapsed.

+54 −43

File changed.

Preview size limit exceeded, changes collapsed.