RE: [PATCH] ufs: Use str_enable_disable-like helpers
From: Alim Akhtar
Date: Tue Jan 14 2025 - 23:38:15 EST
Hello Krzysztof,
> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> Sent: Wednesday, January 15, 2025 1:37 AM
> To: Alim Akhtar <alim.akhtar@xxxxxxxxxxx>; Avri Altman
> <avri.altman@xxxxxxx>; Bart Van Assche <bvanassche@xxxxxxx>; James
> E.J. Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>; Martin K.
> Petersen <martin.petersen@xxxxxxxxxx>; Peter Wang
> <peter.wang@xxxxxxxxxxxx>; Stanley Jhu <chu.stanley@xxxxxxxxx>;
> Matthias Brugger <matthias.bgg@xxxxxxxxx>; AngeloGioacchino Del Regno
> <angelogioacchino.delregno@xxxxxxxxxxxxx>; linux-scsi@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; linux-mediatek@xxxxxxxxxxxxxxxxxxx; linux-
> arm-kernel@xxxxxxxxxxxxxxxxxxx
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> Subject: [PATCH] ufs: Use str_enable_disable-like helpers
>
> Replace ternary (condition ? "enable" : "disable") syntax with helpers
from
> string_choices.h because:
> 1. Simple function call with one argument is easier to read. Ternary
> operator has three arguments and with wrapping might lead to quite
> long code.
> 2. Is slightly shorter thus also easier to read.
> 3. It brings uniformity in the text - same string.
> 4. Allows deduping by the linker, which results in a smaller binary
> file.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> ---
> drivers/ufs/core/ufshcd.c | 11 ++++++-----
> drivers/ufs/host/ufs-mediatek.c | 7 +++----
> 2 files changed, 9 insertions(+), 9 deletions(-)
>
Reviewed-by: Alim Akhtar <alim.akhtar@xxxxxxxxxxx>
On a side note, there are other host controller driver (e.g. exynos and
Qcomm) which also uses few conditional operators, But I didn't find a
matching helper in string_choices.h, so may be that can be taken separately
in future.
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index
> 27154a5dcb7b..5225d48a47f8 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
[Snip]
> --
> 2.43.0