diff mbox series

[V2,1/3] megaraid_sas: Rework code to get PD and LD list

Message ID 1548325170-1171-2-git-send-email-shivasharan.srikanteshwara@broadcom.com (mailing list archive)
State Superseded
Headers show
Series megaraid_sas: Add support for FW device list DCMD | expand

Commit Message

Shivasharan S Jan. 24, 2019, 10:19 a.m. UTC
During FW init, combine the code to get the PD and LD list
from FW into a single function.
This patch is in preparation for adding support for
HOST_DEVICE_LIST DCMD.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 47 ++++++++++++++++++++++---------
 1 file changed, 34 insertions(+), 13 deletions(-)

Comments

Johannes Thumshirn Jan. 24, 2019, 10:30 a.m. UTC | #1
On 24/01/2019 11:19, Shivasharan S wrote:
[...]
> +/*
> + * megasas_get_device_list -	Get the PD and LD device list from FW.
> + * @instance:			Adapter soft state
> + *
> + * @return:			Success or failure
> + *
> + * Issue DCMDs to Firmware to update the internal device list in driver.
> + * Based on the FW support, driver sends the HOST_DEVICE_LIST or combination
> + * of PD_LIST/LD_LIST_QUERY DCMDs to get the device list.
> + */
> +static
> +int megasas_get_device_list(struct megasas_instance *instance)

You have to start your kerneldoc comments with '/**' (i.e. one asterisk
is missing on your side).
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index f7bdd783360a..cf065f0b84fa 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5319,6 +5319,36 @@  static void megasas_setup_reply_map(struct megasas_instance *instance)
 		instance->reply_map[cpu] = cpu % instance->msix_vectors;
 }
 
+/*
+ * megasas_get_device_list -	Get the PD and LD device list from FW.
+ * @instance:			Adapter soft state
+ *
+ * @return:			Success or failure
+ *
+ * Issue DCMDs to Firmware to update the internal device list in driver.
+ * Based on the FW support, driver sends the HOST_DEVICE_LIST or combination
+ * of PD_LIST/LD_LIST_QUERY DCMDs to get the device list.
+ */
+static
+int megasas_get_device_list(struct megasas_instance *instance)
+{
+	memset(instance->pd_list, 0,
+	       (MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)));
+	memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
+
+	if (megasas_get_pd_list(instance) < 0) {
+		dev_err(&instance->pdev->dev, "failed to get PD list\n");
+		return FAILED;
+	}
+
+	if (megasas_ld_list_query(instance,
+				  MR_LD_QUERY_TYPE_EXPOSED_TO_HOST)) {
+		dev_err(&instance->pdev->dev, "failed to get LD list\n");
+		return FAILED;
+	}
+
+	return SUCCESS;
+}
 /**
  * megasas_init_fw -	Initializes the FW
  * @instance:		Adapter soft state
@@ -5571,18 +5601,13 @@  static int megasas_init_fw(struct megasas_instance *instance)
 
 	megasas_setup_jbod_map(instance);
 
-	/** for passthrough
-	 * the following function will get the PD LIST.
-	 */
-	memset(instance->pd_list, 0,
-		(MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)));
-	if (megasas_get_pd_list(instance) < 0) {
-		dev_err(&instance->pdev->dev, "failed to get PD list\n");
+	if (megasas_get_device_list(instance) != SUCCESS) {
+		dev_err(&instance->pdev->dev,
+			"%s: megasas_get_device_list failed\n",
+			__func__);
 		goto fail_get_ld_pd_list;
 	}
 
-	memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
-
 	/* stream detection initialization */
 	if (instance->adapter_type >= VENTURA_SERIES) {
 		fusion->stream_detect_by_ld =
@@ -5612,10 +5637,6 @@  static int megasas_init_fw(struct megasas_instance *instance)
 		}
 	}
 
-	if (megasas_ld_list_query(instance,
-				  MR_LD_QUERY_TYPE_EXPOSED_TO_HOST))
-		goto fail_get_ld_pd_list;
-
 	/*
 	 * Compute the max allowed sectors per IO: The controller info has two
 	 * limits on max sectors. Driver should use the minimum of these two.