summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid
diff options
context:
space:
mode:
authorRaghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>2017-12-26 20:34:34 -0800
committerMartin K. Petersen <martin.petersen@oracle.com>2018-01-03 23:26:42 -0500
commit3edfb8b2e20b30456359718805bea052bf1b0895 (patch)
tree32600243ccbc1048a60c7d0b0eeaafa4311c082f /drivers/scsi/aacraid
parentfc0fdd9abcc60bd207151b2c8a82dc5ee4b45226 (diff)
downloadlinux-3edfb8b2e20b30456359718805bea052bf1b0895.tar.bz2
scsi: aacraid: Untangle targets setup from report phy luns
Remove function call to process targets from the report phy luns function and make it a function in its own right. This will help understand the flow of the code. Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r--drivers/scsi/aacraid/aachba.c44
-rw-r--r--drivers/scsi/aacraid/aacraid.h1
2 files changed, 34 insertions, 11 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 5a95883794c1..629a04d90e5c 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1799,14 +1799,16 @@ out:
*
* Update our hba map with the information gathered from the FW
*/
-static void aac_set_safw_attr_all_targets(struct aac_dev *dev,
- struct aac_ciss_phys_luns_resp *phys_luns, int rescan)
+static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan)
{
/* ok and extended reporting */
u32 lun_count, nexus;
u32 i, bus, target;
u8 expose_flag, attribs;
u8 devtype;
+ struct aac_ciss_phys_luns_resp *phys_luns;
+
+ phys_luns = dev->safw_phys_luns;
lun_count = ((phys_luns->list_length[0] << 24)
+ (phys_luns->list_length[1] << 16)
@@ -1852,6 +1854,12 @@ update_devtype:
}
}
+static inline void aac_free_safw_ciss_luns(struct aac_dev *dev)
+{
+ kfree(dev->safw_phys_luns);
+ dev->safw_phys_luns = NULL;
+}
+
/**
* aac_get_safw_ciss_luns() Process topology change
* @dev: aac_dev structure
@@ -1872,7 +1880,7 @@ static int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan)
(AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun);
phys_luns = kmalloc(datasize, GFP_KERNEL);
if (phys_luns == NULL)
- goto err_out;
+ goto out;
memset(&srbu, 0, sizeof(struct aac_srb_unit));
@@ -1885,22 +1893,36 @@ static int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan)
rcode = aac_send_safw_bmic_cmd(dev, &srbu, phys_luns, datasize);
if (unlikely(rcode < 0))
- goto err_out;
+ goto mem_free_all;
- /* analyse data */
- if (rcode >= 0 && phys_luns->resp_flag == 2) {
- /* ok and extended reporting */
- aac_set_safw_attr_all_targets(dev, phys_luns, rescan);
+ if (phys_luns->resp_flag != 2) {
+ rcode = -ENOMSG;
+ goto mem_free_all;
}
- kfree(phys_luns);
-err_out:
+ dev->safw_phys_luns = phys_luns;
+
+out:
return rcode;
+mem_free_all:
+ kfree(phys_luns);
+ goto out;
+
}
static int aac_setup_safw_targets(struct aac_dev *dev, int rescan)
{
- return aac_get_safw_ciss_luns(dev, rescan);
+ int rcode = 0;
+
+ rcode = aac_get_safw_ciss_luns(dev, rescan);
+ if (unlikely(rcode < 0))
+ goto out;
+
+ aac_set_safw_attr_all_targets(dev, rescan);
+
+ aac_free_safw_ciss_luns(dev);
+out:
+ return rcode;
}
int aac_setup_safw_adapter(struct aac_dev *dev, int rescan)
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 569076715070..19af4d971be1 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1671,6 +1671,7 @@ struct aac_dev
struct msix_entry msixentry[AAC_MAX_MSIX];
struct aac_msix_ctx aac_msix[AAC_MAX_MSIX]; /* context */
struct aac_hba_map_info hba_map[AAC_MAX_BUSES][AAC_MAX_TARGETS];
+ struct aac_ciss_phys_luns_resp *safw_phys_luns;
u8 adapter_shutdown;
u32 handle_pci_error;
};