[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aK8Bi0yIMW8-yb_n@stanley.mountain>
Date: Wed, 27 Aug 2025 16:00:59 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Liao Yuanhong <liaoyuanhong@...o.com>
Cc: Ulf Hansson <ulf.hansson@...aro.org>, Ricky Wu <ricky_wu@...ltek.com>,
Avri Altman <avri.altman@...disk.com>,
Binbin Zhou <zhoubinbin@...ngson.cn>,
Al Viro <viro@...iv.linux.org.uk>,
Uwe Kleine-König <u.kleine-koenig@...libre.com>,
Jisheng Zhang <jszhang@...nel.org>,
"open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND..." <linux-mmc@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] mmc: rtsx_usb_sdmmc: Remove redundant ternary
operators
On Wed, Aug 27, 2025 at 05:35:26PM +0800, Liao Yuanhong wrote:
> Remove redundant ternary operators to clean up the code.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
> ---
> drivers/mmc/host/rtsx_usb_sdmmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
> index 84674659a84d..97bc3a2e3cca 100644
> --- a/drivers/mmc/host/rtsx_usb_sdmmc.c
> +++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
> @@ -1169,7 +1169,7 @@ static void sdmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> break;
> }
>
> - host->initial_mode = (ios->clock <= 1000000) ? true : false;
> + host->initial_mode = ios->clock <= 1000000;
This is more minimalist, but is it really more readable? All the
"redundant" bits are deliberate visual clues that this is a condition.
Probably the most readable thing is to just make it an if statement:
if (ios->clock <= 1000000)
host->initial_mode = true;
else
host->initial_mode = false;
I don't really have strong feelings either way...
regards,
dan carpenter
Powered by blists - more mailing lists