diff mbox series

[v3,6/6] scsi: ufshpb: Cleanup ufshpb_suspend/resume

Message ID 20220424220713.1253049-7-huobean@gmail.com
State New
Headers show
Series Several changes for UFSHPB | expand

Commit Message

Bean Huo April 24, 2022, 10:07 p.m. UTC
From: Bean Huo <beanhuo@micron.com>

ufshpb_resume() is only called when the HPB state is HPB_SUSPEND, so
the check statement for "ufshpb_get_state(hpb) != HPB_PRESENT" is useless.

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/scsi/ufs/ufshpb.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Comments

Keoseong Park April 25, 2022, 2:25 a.m. UTC | #1
>From: Bean Huo <beanhuo@micron.com>
> 
>ufshpb_resume() is only called when the HPB state is HPB_SUSPEND, so
>the check statement for "ufshpb_get_state(hpb) != HPB_PRESENT" is useless.
> 
>Signed-off-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Keoseong Park <keosung.park@samsung.com>

Best Regards,
Keoseong Park

>---
> drivers/scsi/ufs/ufshpb.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
> 
>diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
>index 7868412054bf..10f40e390dc5 100644
>--- a/drivers/scsi/ufs/ufshpb.c
>+++ b/drivers/scsi/ufs/ufshpb.c
>@@ -2349,11 +2349,9 @@ void ufshpb_suspend(struct ufs_hba *hba)
> 
>         shost_for_each_device(sdev, hba->host) {
>                 hpb = ufshpb_get_hpb_data(sdev);
>-                if (!hpb)
>+                if (!hpb || ufshpb_get_state(hpb) != HPB_PRESENT)
>                         continue;
> 
>-                if (ufshpb_get_state(hpb) != HPB_PRESENT)
>-                        continue;
>                 ufshpb_set_state(hpb, HPB_SUSPEND);
>                 ufshpb_cancel_jobs(hpb);
>         }
>@@ -2366,20 +2364,15 @@ void ufshpb_resume(struct ufs_hba *hba)
> 
>         shost_for_each_device(sdev, hba->host) {
>                 hpb = ufshpb_get_hpb_data(sdev);
>-                if (!hpb)
>+                if (!hpb || ufshpb_get_state(hpb) != HPB_SUSPEND)
>                         continue;
> 
>-                if ((ufshpb_get_state(hpb) != HPB_PRESENT) &&
>-                    (ufshpb_get_state(hpb) != HPB_SUSPEND))
>-                        continue;
>                 ufshpb_set_state(hpb, HPB_PRESENT);
>                 ufshpb_kick_map_work(hpb);
>                 if (hpb->is_hcm) {
>-                        unsigned int poll =
>-                                hpb->params.timeout_polling_interval_ms;
>+                        unsigned int poll = hpb->params.timeout_polling_interval_ms;
> 
>-                        schedule_delayed_work(&hpb->ufshpb_read_to_work,
>-                                msecs_to_jiffies(poll));
>+                        schedule_delayed_work(&hpb->ufshpb_read_to_work, msecs_to_jiffies(poll));
>                 }
>         }
> }
>-- 
>2.34.1
> 
>
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
index 7868412054bf..10f40e390dc5 100644
--- a/drivers/scsi/ufs/ufshpb.c
+++ b/drivers/scsi/ufs/ufshpb.c
@@ -2349,11 +2349,9 @@  void ufshpb_suspend(struct ufs_hba *hba)
 
 	shost_for_each_device(sdev, hba->host) {
 		hpb = ufshpb_get_hpb_data(sdev);
-		if (!hpb)
+		if (!hpb || ufshpb_get_state(hpb) != HPB_PRESENT)
 			continue;
 
-		if (ufshpb_get_state(hpb) != HPB_PRESENT)
-			continue;
 		ufshpb_set_state(hpb, HPB_SUSPEND);
 		ufshpb_cancel_jobs(hpb);
 	}
@@ -2366,20 +2364,15 @@  void ufshpb_resume(struct ufs_hba *hba)
 
 	shost_for_each_device(sdev, hba->host) {
 		hpb = ufshpb_get_hpb_data(sdev);
-		if (!hpb)
+		if (!hpb || ufshpb_get_state(hpb) != HPB_SUSPEND)
 			continue;
 
-		if ((ufshpb_get_state(hpb) != HPB_PRESENT) &&
-		    (ufshpb_get_state(hpb) != HPB_SUSPEND))
-			continue;
 		ufshpb_set_state(hpb, HPB_PRESENT);
 		ufshpb_kick_map_work(hpb);
 		if (hpb->is_hcm) {
-			unsigned int poll =
-				hpb->params.timeout_polling_interval_ms;
+			unsigned int poll = hpb->params.timeout_polling_interval_ms;
 
-			schedule_delayed_work(&hpb->ufshpb_read_to_work,
-				msecs_to_jiffies(poll));
+			schedule_delayed_work(&hpb->ufshpb_read_to_work, msecs_to_jiffies(poll));
 		}
 	}
 }