diff mbox series

Replace with already defined values for readability

Message ID 20220706004840.24812-1-cw9316.lee@samsung.com (mailing list archive)
State New, archived
Headers show
Series Replace with already defined values for readability | expand

Commit Message

Chanwoo Lee July 6, 2022, 12:48 a.m. UTC
From: ChanWoo Lee <cw9316.lee@samsung.com>

SD_ROCR_S18A is already defined
and is used to check the rocr value as shown below.

So, replace with already defined values for readability.

--------------------------------------------------
/sd.h
.#define SD_OCR_S18R    (1 << 24)    /* 1.8V switching request */
.#define SD_ROCR_S18A   SD_OCR_S18R  /* 1.8V switching accepted by card */

/sd.c
static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
	struct mmc_card *oldcard)
{
...
        if (rocr & SD_ROCR_S18A && mmc_host_uhs(host)) {
                err = mmc_sd_init_uhs_card(card);
}
-------------------------------------------------

Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
---
 drivers/mmc/core/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij July 7, 2022, 8:48 a.m. UTC | #1
On Wed, Jul 6, 2022 at 2:52 AM Chanwoo Lee <cw9316.lee@samsung.com> wrote:

> From: ChanWoo Lee <cw9316.lee@samsung.com>
>
> SD_ROCR_S18A is already defined
> and is used to check the rocr value as shown below.
>
> So, replace with already defined values for readability.
>
> --------------------------------------------------
> /sd.h
> .#define SD_OCR_S18R    (1 << 24)    /* 1.8V switching request */
> .#define SD_ROCR_S18A   SD_OCR_S18R  /* 1.8V switching accepted by card */
>
> /sd.c
> static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
>         struct mmc_card *oldcard)
> {
> ...
>         if (rocr & SD_ROCR_S18A && mmc_host_uhs(host)) {
>                 err = mmc_sd_init_uhs_card(card);
> }
> -------------------------------------------------
>
> Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>

Excellent patch.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Ulf Hansson July 12, 2022, 11:09 a.m. UTC | #2
On Wed, 6 Jul 2022 at 02:52, Chanwoo Lee <cw9316.lee@samsung.com> wrote:
>
> From: ChanWoo Lee <cw9316.lee@samsung.com>
>
> SD_ROCR_S18A is already defined
> and is used to check the rocr value as shown below.
>
> So, replace with already defined values for readability.
>
> --------------------------------------------------
> /sd.h
> .#define SD_OCR_S18R    (1 << 24)    /* 1.8V switching request */
> .#define SD_ROCR_S18A   SD_OCR_S18R  /* 1.8V switching accepted by card */
>
> /sd.c
> static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
>         struct mmc_card *oldcard)
> {
> ...
>         if (rocr & SD_ROCR_S18A && mmc_host_uhs(host)) {
>                 err = mmc_sd_init_uhs_card(card);
> }
> -------------------------------------------------
>
> Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>

Applied for next, thanks!

Next time, please use a proper patch prefix ("mmc: core:" in this case).

Kind regards
Uffe


> ---
>  drivers/mmc/core/sd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index c5f1df6ce4c0..d2023837dd72 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -870,7 +870,7 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr)
>          * the CCS bit is set as well. We deliberately deviate from the spec in
>          * regards to this, which allows UHS-I to be supported for SDSC cards.
>          */
> -       if (!mmc_host_is_spi(host) && rocr && (*rocr & 0x01000000)) {
> +       if (!mmc_host_is_spi(host) && rocr && (*rocr & SD_ROCR_S18A)) {
>                 err = mmc_set_uhs_voltage(host, pocr);
>                 if (err == -EAGAIN) {
>                         retries--;
> --
> 2.29.0
>
diff mbox series

Patch

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index c5f1df6ce4c0..d2023837dd72 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -870,7 +870,7 @@  int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr)
 	 * the CCS bit is set as well. We deliberately deviate from the spec in
 	 * regards to this, which allows UHS-I to be supported for SDSC cards.
 	 */
-	if (!mmc_host_is_spi(host) && rocr && (*rocr & 0x01000000)) {
+	if (!mmc_host_is_spi(host) && rocr && (*rocr & SD_ROCR_S18A)) {
 		err = mmc_set_uhs_voltage(host, pocr);
 		if (err == -EAGAIN) {
 			retries--;