diff mbox series

[v2,3/3] scsi: ufs: Remove redundant checks of !hba in suspend/resume callbacks

Message ID 1614145010-36079-4-git-send-email-cang@codeaurora.org
State New
Headers show
Series Three minor changes related with error handling | expand

Commit Message

Can Guo Feb. 24, 2021, 5:36 a.m. UTC
Runtime and system suspend/resume can only come after hba probe invokes
platform_set_drvdata(pdev, hba), meaning hba cannot be NULL in these PM
callbacks, so remove the checks of !hba.

Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/ufs/ufshcd.c | 21 ---------------------
 1 file changed, 21 deletions(-)

Comments

Avri Altman March 3, 2021, 7:19 a.m. UTC | #1
> 
> Runtime and system suspend/resume can only come after hba probe invokes
> platform_set_drvdata(pdev, hba), meaning hba cannot be NULL in these PM
> callbacks, so remove the checks of !hba.
> 
> Signed-off-by: Can Guo <cang@codeaurora.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>


> ---
>  drivers/scsi/ufs/ufshcd.c | 21 ---------------------
>  1 file changed, 21 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 013eb73..2517ef1 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -95,8 +95,6 @@
>                        16, 4, buf, __len, false);                        \
>  } while (0)
> 
> -static bool early_suspend;
> -
>  int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
>                      const char *prefix)
>  {
> @@ -8978,11 +8976,6 @@ int ufshcd_system_suspend(struct ufs_hba *hba)
>         int ret = 0;
>         ktime_t start = ktime_get();
> 
> -       if (!hba) {
> -               early_suspend = true;
> -               return 0;
> -       }
> -
>         down(&hba->host_sem);
> 
>         if (!hba->is_powered)
> @@ -9034,14 +9027,6 @@ int ufshcd_system_resume(struct ufs_hba *hba)
>         int ret = 0;
>         ktime_t start = ktime_get();
> 
> -       if (!hba)
> -               return -EINVAL;
> -
> -       if (unlikely(early_suspend)) {
> -               early_suspend = false;
> -               down(&hba->host_sem);
> -       }
> -
>         if (!hba->is_powered || pm_runtime_suspended(hba->dev))
>                 /*
>                  * Let the runtime resume take care of resuming
> @@ -9074,9 +9059,6 @@ int ufshcd_runtime_suspend(struct ufs_hba *hba)
>         int ret = 0;
>         ktime_t start = ktime_get();
> 
> -       if (!hba)
> -               return -EINVAL;
> -
>         if (!hba->is_powered)
>                 goto out;
>         else
> @@ -9115,9 +9097,6 @@ int ufshcd_runtime_resume(struct ufs_hba *hba)
>         int ret = 0;
>         ktime_t start = ktime_get();
> 
> -       if (!hba)
> -               return -EINVAL;
> -
>         if (!hba->is_powered)
>                 goto out;
>         else
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project.
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 013eb73..2517ef1 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -95,8 +95,6 @@ 
 		       16, 4, buf, __len, false);                        \
 } while (0)
 
-static bool early_suspend;
-
 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
 		     const char *prefix)
 {
@@ -8978,11 +8976,6 @@  int ufshcd_system_suspend(struct ufs_hba *hba)
 	int ret = 0;
 	ktime_t start = ktime_get();
 
-	if (!hba) {
-		early_suspend = true;
-		return 0;
-	}
-
 	down(&hba->host_sem);
 
 	if (!hba->is_powered)
@@ -9034,14 +9027,6 @@  int ufshcd_system_resume(struct ufs_hba *hba)
 	int ret = 0;
 	ktime_t start = ktime_get();
 
-	if (!hba)
-		return -EINVAL;
-
-	if (unlikely(early_suspend)) {
-		early_suspend = false;
-		down(&hba->host_sem);
-	}
-
 	if (!hba->is_powered || pm_runtime_suspended(hba->dev))
 		/*
 		 * Let the runtime resume take care of resuming
@@ -9074,9 +9059,6 @@  int ufshcd_runtime_suspend(struct ufs_hba *hba)
 	int ret = 0;
 	ktime_t start = ktime_get();
 
-	if (!hba)
-		return -EINVAL;
-
 	if (!hba->is_powered)
 		goto out;
 	else
@@ -9115,9 +9097,6 @@  int ufshcd_runtime_resume(struct ufs_hba *hba)
 	int ret = 0;
 	ktime_t start = ktime_get();
 
-	if (!hba)
-		return -EINVAL;
-
 	if (!hba->is_powered)
 		goto out;
 	else