git: cfae21201a2b - main - mmc-fdt: fix mmc_fdt_gpio_get_{present, readonly}

Warner Losh imp at FreeBSD.org
Thu Jun 3 04:02:29 UTC 2021


The branch main has been updated by imp:

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

commit cfae21201a2b28b4146a09923ed142af7b86cdec
Author:     Priit Trees <trees at neti.ee>
AuthorDate: 2021-03-31 20:15:31 +0000
Commit:     Warner Losh <imp at 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


More information about the dev-commits-src-all mailing list