linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: core: Fix unnecessary operation for early return
       [not found] <CGME20221111062328epcas1p2c2d1f52fed1068579a1dad7fb4e60f52@epcas1p2.samsung.com>
@ 2022-11-11  6:23 ` Chanwoo Lee
  2022-11-26  0:19   ` Martin K. Petersen
  2022-12-01  3:45   ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Chanwoo Lee @ 2022-11-11  6:23 UTC (permalink / raw)
  To: alim.akhtar, avri.altman, bvanassche, jejb, martin.petersen,
	beanhuo, linux-scsi, linux-kernel
  Cc: ChanWoo Lee

From: ChanWoo Lee <cw9316.lee@samsung.com>

For early return, bitmap_len operation is not required.
Modified to reduce unnecessary operations.

Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
---
 drivers/ufs/core/ufshpb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/ufs/core/ufshpb.c b/drivers/ufs/core/ufshpb.c
index 148017b2dfeb..994f4ac9df5a 100644
--- a/drivers/ufs/core/ufshpb.c
+++ b/drivers/ufs/core/ufshpb.c
@@ -233,11 +233,6 @@ static bool ufshpb_test_ppn_dirty(struct ufshpb_lu *hpb, int rgn_idx,
 	rgn = hpb->rgn_tbl + rgn_idx;
 	srgn = rgn->srgn_tbl + srgn_idx;
 
-	if (likely(!srgn->is_last))
-		bitmap_len = hpb->entries_per_srgn;
-	else
-		bitmap_len = hpb->last_srgn_entries;
-
 	if (!ufshpb_is_valid_srgn(rgn, srgn))
 		return true;
 
@@ -253,6 +248,11 @@ static bool ufshpb_test_ppn_dirty(struct ufshpb_lu *hpb, int rgn_idx,
 		return true;
 	}
 
+	if (likely(!srgn->is_last))
+		bitmap_len = hpb->entries_per_srgn;
+	else
+		bitmap_len = hpb->last_srgn_entries;
+
 	if ((srgn_offset + cnt) > bitmap_len)
 		bit_len = bitmap_len - srgn_offset;
 	else
-- 
2.29.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: ufs: core: Fix unnecessary operation for early return
  2022-11-11  6:23 ` [PATCH] scsi: ufs: core: Fix unnecessary operation for early return Chanwoo Lee
@ 2022-11-26  0:19   ` Martin K. Petersen
  2022-12-01  3:45   ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-11-26  0:19 UTC (permalink / raw)
  To: Chanwoo Lee
  Cc: alim.akhtar, avri.altman, bvanassche, jejb, martin.petersen,
	beanhuo, linux-scsi, linux-kernel


Chanwoo,

> For early return, bitmap_len operation is not required.  Modified to
> reduce unnecessary operations.

Applied to 6.2/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: ufs: core: Fix unnecessary operation for early return
  2022-11-11  6:23 ` [PATCH] scsi: ufs: core: Fix unnecessary operation for early return Chanwoo Lee
  2022-11-26  0:19   ` Martin K. Petersen
@ 2022-12-01  3:45   ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-12-01  3:45 UTC (permalink / raw)
  To: alim.akhtar, linux-kernel, jejb, bvanassche, avri.altman,
	Chanwoo Lee, linux-scsi, beanhuo
  Cc: Martin K . Petersen

On Fri, 11 Nov 2022 15:23:01 +0900, Chanwoo Lee wrote:

> From: ChanWoo Lee <cw9316.lee@samsung.com>
> 
> For early return, bitmap_len operation is not required.
> Modified to reduce unnecessary operations.
> 
> 

Applied to 6.2/scsi-queue, thanks!

[1/1] scsi: ufs: core: Fix unnecessary operation for early return
      https://git.kernel.org/mkp/scsi/c/222d227f375b

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-01  3:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20221111062328epcas1p2c2d1f52fed1068579a1dad7fb4e60f52@epcas1p2.samsung.com>
2022-11-11  6:23 ` [PATCH] scsi: ufs: core: Fix unnecessary operation for early return Chanwoo Lee
2022-11-26  0:19   ` Martin K. Petersen
2022-12-01  3:45   ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).