From owner-dev-commits-src-main@freebsd.org Thu Jun 3 04:02:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 383AE651B10; Thu, 3 Jun 2021 04:02:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FwXKd19Kpz3lfN; Thu, 3 Jun 2021 04:02:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1066F22D62; Thu, 3 Jun 2021 04:02:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15342SbQ072846; Thu, 3 Jun 2021 04:02:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15342ShS072845; Thu, 3 Jun 2021 04:02:28 GMT (envelope-from git) Date: Thu, 3 Jun 2021 04:02:28 GMT Message-Id: <202106030402.15342ShS072845@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: cfae21201a2b - main - mmc-fdt: fix mmc_fdt_gpio_get_{present, readonly} MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cfae21201a2b28b4146a09923ed142af7b86cdec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 04:02:29 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cfae21201a2b28b4146a09923ed142af7b86cdec commit cfae21201a2b28b4146a09923ed142af7b86cdec Author: Priit Trees AuthorDate: 2021-03-31 20:15:31 +0000 Commit: Warner Losh 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