Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jun 2021 04:02:28 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: cfae21201a2b - main - mmc-fdt: fix mmc_fdt_gpio_get_{present, readonly}
Message-ID:  <202106030402.15342ShS072845@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=cfae21201a2b28b4146a09923ed142af7b86cdec

commit cfae21201a2b28b4146a09923ed142af7b86cdec
Author:     Priit Trees <trees@neti.ee>
AuthorDate: 2021-03-31 20:15:31 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-06-03 03:58:30 +0000

    mmc-fdt: fix mmc_fdt_gpio_get_{present,readonly}
    
    Currently, mmc_fdt_gpio_get_{present,readonly} return all time true.
            true   ^ 100b = true
            false  ^ 100b = true
    since that's done after promotion to integers. Use !! to convert
    the bit to a bool before xor.
    
    Reviewed by:    imp@ (converted to (bool) to !! for portability)
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/461
---
 sys/dev/mmc/mmc_fdt_helpers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c
index 4e8a1730d240..9d120fa01a26 100644
--- a/sys/dev/mmc/mmc_fdt_helpers.c
+++ b/sys/dev/mmc/mmc_fdt_helpers.c
@@ -407,7 +407,7 @@ mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper)
 
 	gpio_pin_is_active(helper->cd_pin, &pinstate);
 
-	return (pinstate ^ (helper->props & MMC_PROP_CD_INVERTED));
+	return (pinstate ^ !!(helper->props & MMC_PROP_CD_INVERTED));
 }
 
 bool
@@ -423,7 +423,7 @@ mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper)
 
 	gpio_pin_is_active(helper->wp_pin, &pinstate);
 
-	return (pinstate ^ (helper->props & MMC_PROP_WP_INVERTED));
+	return (pinstate ^ !!(helper->props & MMC_PROP_WP_INVERTED));
 }
 
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106030402.15342ShS072845>