* [PATCH] mmc: core: Use ternery for return value in mmc_vdd_to_ocrbitnum()
@ 2021-05-20 8:28 Yue Hu
2021-05-24 11:42 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Yue Hu @ 2021-05-20 8:28 UTC (permalink / raw)
To: ulf.hansson; +Cc: linux-mmc, linux-kernel, huyue2, zbestahu
From: Yue Hu <huyue2@yulong.com>
Just simplify the code.
Signed-off-by: Yue Hu <huyue2@yulong.com>
---
drivers/mmc/core/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f194940..600543c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1028,9 +1028,7 @@ static int mmc_vdd_to_ocrbitnum(int vdd, bool low_bits)
/* Base 2000 mV, step 100 mV, bit's base 8. */
bit = (vdd - 2000) / 100 + 8;
- if (bit > max_bit)
- return max_bit;
- return bit;
+ return (bit > max_bit) ? max_bit : bit;
}
/**
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: core: Use ternery for return value in mmc_vdd_to_ocrbitnum()
2021-05-20 8:28 [PATCH] mmc: core: Use ternery for return value in mmc_vdd_to_ocrbitnum() Yue Hu
@ 2021-05-24 11:42 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2021-05-24 11:42 UTC (permalink / raw)
To: Yue Hu; +Cc: ulf.hansson, linux-mmc, linux-kernel, huyue2, zbestahu
On Thu, May 20, 2021 at 04:28:37PM +0800, Yue Hu wrote:
> From: Yue Hu <huyue2@yulong.com>
>
> Just simplify the code.
The original version is way easier to read.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-24 11:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 8:28 [PATCH] mmc: core: Use ternery for return value in mmc_vdd_to_ocrbitnum() Yue Hu
2021-05-24 11:42 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.