From: Dan Carpenter <dan.carpenter@linaro.org>
To: Liao Yuanhong <liaoyuanhong@vivo.com>
Cc: "Ulf Hansson" <ulf.hansson@linaro.org>,
"Ricky Wu" <ricky_wu@realtek.com>,
"Avri Altman" <avri.altman@sandisk.com>,
"Binbin Zhou" <zhoubinbin@loongson.cn>,
"Al Viro" <viro@zeniv.linux.org.uk>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Jisheng Zhang" <jszhang@kernel.org>,
"open list:MULTIMEDIA CARD (MMC),
SECURE DIGITAL (SD) AND..." <linux-mmc@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] mmc: rtsx_usb_sdmmc: Remove redundant ternary operators
Date: Wed, 27 Aug 2025 16:00:59 +0300 [thread overview]
Message-ID: <aK8Bi0yIMW8-yb_n@stanley.mountain> (raw)
In-Reply-To: <20250827093530.416071-3-liaoyuanhong@vivo.com>
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@vivo.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
prev parent reply other threads:[~2025-08-27 13:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 9:35 [PATCH 0/2] mmc: rtsx: Remove redundant ternary operators Liao Yuanhong
2025-08-27 9:35 ` [PATCH 1/2] mmc: rtsx_pci: " Liao Yuanhong
2025-08-27 9:35 ` [PATCH 2/2] mmc: rtsx_usb_sdmmc: " Liao Yuanhong
2025-08-27 13:00 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aK8Bi0yIMW8-yb_n@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=avri.altman@sandisk.com \
--cc=jszhang@kernel.org \
--cc=liaoyuanhong@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ricky_wu@realtek.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=ulf.hansson@linaro.org \
--cc=viro@zeniv.linux.org.uk \
--cc=zhoubinbin@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).