From: Yue Hu <zbestahu@gmail.com>
To: ulf.hansson@linaro.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
huyue2@yulong.com, zbestahu@163.com
Subject: [PATCH] mmc: core: Use ternery for return value in mmc_vdd_to_ocrbitnum()
Date: Thu, 20 May 2021 16:28:37 +0800 [thread overview]
Message-ID: <20210520082837.2129-1-zbestahu@gmail.com> (raw)
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
next reply other threads:[~2021-05-20 8:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-20 8:28 Yue Hu [this message]
2021-05-24 11:42 ` [PATCH] mmc: core: Use ternery for return value in mmc_vdd_to_ocrbitnum() Christoph Hellwig
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=20210520082837.2129-1-zbestahu@gmail.com \
--to=zbestahu@gmail.com \
--cc=huyue2@yulong.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=zbestahu@163.com \
/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