[PATCH] ufs: Use str_enable_disable-like helpers
Alim Akhtar
alim.akhtar at samsung.com
Tue Jan 14 20:02:46 PST 2025
Hello Krzysztof,
> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> Sent: Wednesday, January 15, 2025 1:37 AM
> To: Alim Akhtar <alim.akhtar at samsung.com>; Avri Altman
> <avri.altman at wdc.com>; Bart Van Assche <bvanassche at acm.org>; James
> E.J. Bottomley <James.Bottomley at HansenPartnership.com>; Martin K.
> Petersen <martin.petersen at oracle.com>; Peter Wang
> <peter.wang at mediatek.com>; Stanley Jhu <chu.stanley at gmail.com>;
> Matthias Brugger <matthias.bgg at gmail.com>; AngeloGioacchino Del Regno
> <angelogioacchino.delregno at collabora.com>; linux-scsi at vger.kernel.org;
> linux-kernel at vger.kernel.org; linux-mediatek at lists.infradead.org; linux-
> arm-kernel at lists.infradead.org
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> 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 at linaro.org>
> ---
> 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 at samsung.com>
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
More information about the Linux-mediatek
mailing list