scsi: mpt3sas: Added new #define variable IOC_OPERATIONAL_WAIT_COUNT
authorSuganath Prabu <suganath-prabu.subramani@broadcom.com>
Wed, 31 Oct 2018 13:23:32 +0000 (18:53 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 7 Nov 2018 01:16:01 +0000 (20:16 -0500)
Added new #define variable IOC_OPERATIONAL_WAIT_COUNT and it replaces hard
coded value '10' in all the places where driver is waiting for the IOC to
become operational.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/mpt3sas/mpt3sas_base.h
drivers/scsi/mpt3sas/mpt3sas_ctl.c
drivers/scsi/mpt3sas/mpt3sas_transport.c

index 2500377d07231fb05297a1d2b04d47b919809ebd..f6c7afa24ea161834c8b7c9e2d4fd3f8a960c448 100644 (file)
@@ -5230,7 +5230,7 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc,
        wait_state_count = 0;
        ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
        while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
-               if (wait_state_count++ == 10) {
+               if (wait_state_count++ == IOC_OPERATIONAL_WAIT_COUNT) {
                        ioc_err(ioc, "%s: failed due to ioc not operational\n",
                                __func__);
                        rc = -EFAULT;
@@ -5325,7 +5325,7 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc,
        wait_state_count = 0;
        ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
        while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
-               if (wait_state_count++ == 10) {
+               if (wait_state_count++ == IOC_OPERATIONAL_WAIT_COUNT) {
                        ioc_err(ioc, "%s: failed due to ioc not operational\n",
                                __func__);
                        rc = -EFAULT;
index 3698776c3322f58b7546db4a5e40a8a71acdd4aa..e0bee665a7ad7c95cd25a28dcc7f91f58dc2bf74 100644 (file)
 #define DEFAULT_NUM_FWCHAIN_ELEMTS     8
 
 #define FW_IMG_HDR_READ_TIMEOUT        15
+
+#define IOC_OPERATIONAL_WAIT_COUNT     10
+
 /*
  * NVMe defines
  */
index 4afa597cbfbab5f26e0573ee75040235bf2a3855..a285e95c9ae4224d73f4f093c264f7936924879a 100644 (file)
@@ -669,7 +669,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
        wait_state_count = 0;
        ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
        while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
-               if (wait_state_count++ == 10) {
+               if (wait_state_count++ == IOC_OPERATIONAL_WAIT_COUNT) {
                        ioc_err(ioc, "%s: failed due to ioc not operational\n",
                                __func__);
                        ret = -EFAULT;
index 6a8a3c09b4b11fe8ff81e544af78a2ff46fc0477..f446c05e99f4a4e9e6b9bd3fc9e4f2be358467fc 100644 (file)
@@ -323,7 +323,7 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc,
        wait_state_count = 0;
        ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
        while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
-               if (wait_state_count++ == 10) {
+               if (wait_state_count++ == IOC_OPERATIONAL_WAIT_COUNT) {
                        ioc_err(ioc, "%s: failed due to ioc not operational\n",
                                __func__);
                        rc = -EFAULT;
@@ -1101,7 +1101,7 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc,
        wait_state_count = 0;
        ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
        while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
-               if (wait_state_count++ == 10) {
+               if (wait_state_count++ == IOC_OPERATIONAL_WAIT_COUNT) {
                        ioc_err(ioc, "%s: failed due to ioc not operational\n",
                                __func__);
                        rc = -EFAULT;
@@ -1406,7 +1406,7 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc,
        wait_state_count = 0;
        ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
        while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
-               if (wait_state_count++ == 10) {
+               if (wait_state_count++ == IOC_OPERATIONAL_WAIT_COUNT) {
                        ioc_err(ioc, "%s: failed due to ioc not operational\n",
                                __func__);
                        rc = -EFAULT;
@@ -1927,7 +1927,7 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
        wait_state_count = 0;
        ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
        while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
-               if (wait_state_count++ == 10) {
+               if (wait_state_count++ == IOC_OPERATIONAL_WAIT_COUNT) {
                        ioc_err(ioc, "%s: failed due to ioc not operational\n",
                                __func__);
                        rc = -EFAULT;