2021-08-02 18:09:50

by Bean Huo

[permalink] [raw]
Subject: [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace

From: Bean Huo <[email protected]>

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

Signed-off-by: Bean Huo <[email protected]>
---
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



2021-08-04 07:09:30

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace

>
> From: Bean Huo <[email protected]>
>
> ufshcd_add_cmd_upiu_trace() will be called anyway, so move if-state down,
> make code simpler.
>
> Signed-off-by: Bean Huo <[email protected]>
Reviewed-by: Avri Altman <[email protected]>


> ---
> 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


2021-08-06 07:35:02

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace


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

2021-08-10 07:03:13

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: ufs: Remove useless if-state in ufshcd_add_command_trace

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

> From: Bean Huo <[email protected]>
>
> 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