diff mbox series

[2/2] scsi: pm80xx: Remove busy wait from mpi_uninit_check()

Message ID 20210329183639.1674307-3-ipylypiv@google.com
State Superseded
Headers show
Series pm80xx mpi_uninit_check() fixes | expand

Commit Message

Igor Pylypiv March 29, 2021, 6:36 p.m. UTC
mpi_uninit_check() is not being called in an ATOMIC context.
The only caller of mpi_uninit_check() is pm80xx_chip_soft_rst().

Callers of pm80xx_chip_soft_rst():
 - pm8001_ioctl_soft_reset()
 - pm8001_pci_probe()
 - pm8001_pci_remove()
 - pm8001_pci_suspend()
 - pm8001_pci_resume()

There was a similar fix for mpi_init_check() in commit d71023af4bec0
("scsi: pm80xx: Do not busy wait in MPI init check").

Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Jinpu Wang April 6, 2021, 8:17 a.m. UTC | #1
On Mon, Mar 29, 2021 at 8:37 PM Igor Pylypiv <ipylypiv@google.com> wrote:
>

> mpi_uninit_check() is not being called in an ATOMIC context.

> The only caller of mpi_uninit_check() is pm80xx_chip_soft_rst().

>

> Callers of pm80xx_chip_soft_rst():

>  - pm8001_ioctl_soft_reset()

>  - pm8001_pci_probe()

>  - pm8001_pci_remove()

>  - pm8001_pci_suspend()

>  - pm8001_pci_resume()

>

> There was a similar fix for mpi_init_check() in commit d71023af4bec0

> ("scsi: pm80xx: Do not busy wait in MPI init check").

>

> Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>

> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>

Acked-by: Jack Wang <jinpu.wang@ionos.com>

> ---

>  drivers/scsi/pm8001/pm80xx_hwi.c | 10 +++++-----

>  1 file changed, 5 insertions(+), 5 deletions(-)

>

> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c

> index a6f65666c98e..9fade2ed9396 100644

> --- a/drivers/scsi/pm8001/pm80xx_hwi.c

> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c

> @@ -1502,12 +1502,12 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha)

>

>         /* wait until Inbound DoorBell Clear Register toggled */

>         if (IS_SPCV_12G(pm8001_ha->pdev)) {

> -               max_wait_count = (30 * 1000 * 1000) /* 30 sec */

> +               max_wait_count = SPCV_DOORBELL_CLEAR_TIMEOUT;

>         } else {

> -               max_wait_count = (15 * 1000 * 1000) /* 15 sec */

> +               max_wait_count = SPC_DOORBELL_CLEAR_TIMEOUT;

>         }

>         do {

> -               udelay(1);

> +               msleep(FW_READY_INTERVAL);

>                 value = pm8001_cr32(pm8001_ha, 0, MSGU_IBDB_SET);

>                 value &= SPCv_MSGU_CFG_TABLE_RESET;

>         } while ((value != 0) && (--max_wait_count));

> @@ -1519,9 +1519,9 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha)

>

>         /* check the MPI-State for termination in progress */

>         /* wait until Inbound DoorBell Clear Register toggled */

> -       max_wait_count = 2 * 1000 * 1000;       /* 2 sec for spcv/ve */

> +       max_wait_count = 100; /* 2 sec for spcv/ve */

>         do {

> -               udelay(1);

> +               msleep(FW_READY_INTERVAL);

>                 gst_len_mpistate =

>                         pm8001_mr32(pm8001_ha->general_stat_tbl_addr,

>                         GST_GSTLEN_MPIS_OFFSET);

> --

> 2.31.0.291.g576ba9dcdaf-goog

>
diff mbox series

Patch

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index a6f65666c98e..9fade2ed9396 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -1502,12 +1502,12 @@  static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha)
 
 	/* wait until Inbound DoorBell Clear Register toggled */
 	if (IS_SPCV_12G(pm8001_ha->pdev)) {
-		max_wait_count = (30 * 1000 * 1000) /* 30 sec */
+		max_wait_count = SPCV_DOORBELL_CLEAR_TIMEOUT;
 	} else {
-		max_wait_count = (15 * 1000 * 1000) /* 15 sec */
+		max_wait_count = SPC_DOORBELL_CLEAR_TIMEOUT;
 	}
 	do {
-		udelay(1);
+		msleep(FW_READY_INTERVAL);
 		value = pm8001_cr32(pm8001_ha, 0, MSGU_IBDB_SET);
 		value &= SPCv_MSGU_CFG_TABLE_RESET;
 	} while ((value != 0) && (--max_wait_count));
@@ -1519,9 +1519,9 @@  static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha)
 
 	/* check the MPI-State for termination in progress */
 	/* wait until Inbound DoorBell Clear Register toggled */
-	max_wait_count = 2 * 1000 * 1000;	/* 2 sec for spcv/ve */
+	max_wait_count = 100; /* 2 sec for spcv/ve */
 	do {
-		udelay(1);
+		msleep(FW_READY_INTERVAL);
 		gst_len_mpistate =
 			pm8001_mr32(pm8001_ha->general_stat_tbl_addr,
 			GST_GSTLEN_MPIS_OFFSET);