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
This commit is contained in:
Priit Trees 2021-03-31 20:15:31 +00:00 committed by Warner Losh
parent 43521b46fc
commit cfae21201a

View file

@ -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