linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: rtsx: Remove redundant ternary operators
@ 2025-08-27  9:35 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
  0 siblings, 2 replies; 4+ messages in thread
From: Liao Yuanhong @ 2025-08-27  9:35 UTC (permalink / raw)
  To: Ulf Hansson, Avri Altman, Wolfram Sang, Uwe Kleine-König,
	Binbin Zhou, Al Viro, Ricky Wu, Huacai Chen, Jisheng Zhang,
	Nathan Chancellor, Dan Carpenter,
	open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...,
	open list
  Cc: Liao Yuanhong

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Liao Yuanhong (2):
  mmc: rtsx_pci: Remove redundant ternary operators
  mmc: rtsx_usb_sdmmc: Remove redundant ternary operators

 drivers/mmc/host/rtsx_pci_sdmmc.c | 2 +-
 drivers/mmc/host/rtsx_usb_sdmmc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] mmc: rtsx_pci: Remove redundant ternary operators
  2025-08-27  9:35 [PATCH 0/2] mmc: rtsx: Remove redundant ternary operators Liao Yuanhong
@ 2025-08-27  9:35 ` Liao Yuanhong
  2025-08-27  9:35 ` [PATCH 2/2] mmc: rtsx_usb_sdmmc: " Liao Yuanhong
  1 sibling, 0 replies; 4+ messages in thread
From: Liao Yuanhong @ 2025-08-27  9:35 UTC (permalink / raw)
  To: Ulf Hansson, Binbin Zhou, Wolfram Sang, Avri Altman, Huacai Chen,
	Al Viro, Uwe Kleine-König,
	open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...,
	open list
  Cc: Liao Yuanhong

Remove redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
index dc2587ff8519..65d40ea9ce93 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -1122,7 +1122,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;
 
 	host->clock = ios->clock;
 	rtsx_pci_switch_clock(pcr, ios->clock, host->ssc_depth,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] mmc: rtsx_usb_sdmmc: Remove redundant ternary operators
  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 ` Liao Yuanhong
  2025-08-27 13:00   ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Liao Yuanhong @ 2025-08-27  9:35 UTC (permalink / raw)
  To: Ulf Hansson, Ricky Wu, Avri Altman, Binbin Zhou, Dan Carpenter,
	Al Viro, Uwe Kleine-König, Jisheng Zhang,
	open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...,
	open list
  Cc: Liao Yuanhong

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;
 	host->clock = ios->clock;
 
 	rtsx_usb_switch_clock(host->ucr, host->clock, host->ssc_depth,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] mmc: rtsx_usb_sdmmc: Remove redundant ternary operators
  2025-08-27  9:35 ` [PATCH 2/2] mmc: rtsx_usb_sdmmc: " Liao Yuanhong
@ 2025-08-27 13:00   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-08-27 13:00 UTC (permalink / raw)
  To: Liao Yuanhong
  Cc: Ulf Hansson, Ricky Wu, Avri Altman, Binbin Zhou, Al Viro,
	Uwe Kleine-König, Jisheng Zhang,
	open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...,
	open list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-27 13:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).