LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace
@ 2021-08-02 18:08 Bean Huo
  2021-08-04  6:38 ` Avri Altman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bean Huo @ 2021-08-02 18:08 UTC (permalink / raw)
  To: alim.akhtar, avri.altman, martin.petersen, stanley.chu, beanhuo,
	bvanassche, cang
  Cc: linux-scsi, linux-kernel

From: Bean Huo <beanhuo@micron.com>

ufshcd_add_cmd_upiu_trace() will be called anyway, so move
if-state down, make code simpler.

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/scsi/ufs/ufshcd.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 064a44e628d6..02f54153fd6d 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -380,14 +380,11 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
 	if (!cmd)
 		return;
 
-	if (!trace_ufshcd_command_enabled()) {
-		/* trace UPIU W/O tracing command */
-		ufshcd_add_cmd_upiu_trace(hba, tag, str_t);
-		return;
-	}
-
 	/* trace UPIU also */
 	ufshcd_add_cmd_upiu_trace(hba, tag, str_t);
+	if (!trace_ufshcd_command_enabled())
+		return;
+
 	opcode = cmd->cmnd[0];
 	lba = scsi_get_lba(cmd);
 
-- 
2.25.1


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

* RE: [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace
  2021-08-02 18:08 [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace Bean Huo
@ 2021-08-04  6:38 ` Avri Altman
  2021-08-06  3:11 ` Martin K. Petersen
  2021-08-10  5:20 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Avri Altman @ 2021-08-04  6:38 UTC (permalink / raw)
  To: Bean Huo, alim.akhtar, martin.petersen, stanley.chu, beanhuo,
	bvanassche, cang
  Cc: linux-scsi, linux-kernel

> 
> From: Bean Huo <beanhuo@micron.com>
> 
> ufshcd_add_cmd_upiu_trace() will be called anyway, so move if-state down,
> make code simpler.
> 
> Signed-off-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>


> ---
>  drivers/scsi/ufs/ufshcd.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index
> 064a44e628d6..02f54153fd6d 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -380,14 +380,11 @@ static void ufshcd_add_command_trace(struct
> ufs_hba *hba, unsigned int tag,
>         if (!cmd)
>                 return;
> 
> -       if (!trace_ufshcd_command_enabled()) {
> -               /* trace UPIU W/O tracing command */
> -               ufshcd_add_cmd_upiu_trace(hba, tag, str_t);
> -               return;
> -       }
> -
>         /* trace UPIU also */
>         ufshcd_add_cmd_upiu_trace(hba, tag, str_t);
> +       if (!trace_ufshcd_command_enabled())
> +               return;
> +
>         opcode = cmd->cmnd[0];
>         lba = scsi_get_lba(cmd);
> 
> --
> 2.25.1


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

* Re: [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace
  2021-08-02 18:08 [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace Bean Huo
  2021-08-04  6:38 ` Avri Altman
@ 2021-08-06  3:11 ` Martin K. Petersen
  2021-08-10  5:20 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2021-08-06  3:11 UTC (permalink / raw)
  To: Bean Huo
  Cc: alim.akhtar, avri.altman, martin.petersen, stanley.chu, beanhuo,
	bvanassche, cang, linux-scsi, linux-kernel


Bean,

> ufshcd_add_cmd_upiu_trace() will be called anyway, so move if-state
> down, make code simpler.

Applied to 5.15/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace
  2021-08-02 18:08 [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace Bean Huo
  2021-08-04  6:38 ` Avri Altman
  2021-08-06  3:11 ` Martin K. Petersen
@ 2021-08-10  5:20 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2021-08-10  5:20 UTC (permalink / raw)
  To: alim.akhtar, cang, avri.altman, stanley.chu, beanhuo, Bean Huo,
	bvanassche
  Cc: Martin K . Petersen, linux-kernel, linux-scsi

On Mon, 2 Aug 2021 20:08:03 +0200, Bean Huo wrote:

> From: Bean Huo <beanhuo@micron.com>
> 
> ufshcd_add_cmd_upiu_trace() will be called anyway, so move
> if-state down, make code simpler.
> 
> 
> 
> [...]

Applied to 5.15/scsi-queue, thanks!

[1/1] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace
      https://git.kernel.org/mkp/scsi/c/f0101af435c4

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-08-10  5:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 18:08 [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace Bean Huo
2021-08-04  6:38 ` Avri Altman
2021-08-06  3:11 ` Martin K. Petersen
2021-08-10  5:20 ` 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).