From nobody Wed Dec 22 06:51:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 04ABD18F78D8; Wed, 22 Dec 2021 06:51:34 +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 4JJkWS64zDz3LKC; Wed, 22 Dec 2021 06:51:32 +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 2B83718B3C; Wed, 22 Dec 2021 06:51:32 +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 1BM6pW5Z036064; Wed, 22 Dec 2021 06:51:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BM6pWpo036063; Wed, 22 Dec 2021 06:51:32 GMT (envelope-from git) Date: Wed, 22 Dec 2021 06:51:32 GMT Message-Id: <202112220651.1BM6pWpo036063@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 94427ab8f276 - stable/13 - rk_i2c_transfer: minor improvement to bit twiddling List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 94427ab8f276c6f1aba8cca2aef6607bb6d17ac0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640155893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0xYofOuUt0x+cCVx0pn3DzJfPAcijuCRd3/FIluvDlI=; b=vdVB9G7D8fDEKvypwN9bBS1n9nQHqFqRg81MfJarZewfJF4+t1T5WCRLYyQW9ngcPac8ck 9na0Ge8slOvZuxPUIJeBg9oauH4YBx96/Hv7iSypU9VSe74fTGAAs7wF0KRgeXhTQqLhrY Sk/ImGcs7AwUdt6Rv0wRzfZ0Ro5cH2hhFDGPmxs/waaVMERNQEw8kaybN9Q0xLA4+7ZUaw 52gDgCBV8OLCaD7j8HbeLhFylSK5NPEdz4PzXBqSrS8N5Uj9sc/6XsFXAcN7PKwDKsJAbt xdZYl/NScl4fSsL2g+E0q9PQBoOAo6fi4ZrjEiSgvHBuDsh4pBtWyNj7c/jp7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640155893; a=rsa-sha256; cv=none; b=rOAxbkV/32Di6KHHizlYi5jIPTd0fG45siDNmRE6q/TSlKVNQd01AmeelKi8CUzA7VskCK aZT8oMfvN6Q4qs+mdD4DipvUHg8HbQkixchz4SN4lBHYSAa95F6ZepiazRP4NPQb5TZsRh vC99dnaW/Fo61UZfOy92xLfH2IlT15BA0KBFBdegCZ0pNrYZKP5GHX/5TrnO//Q8OvnzUh f2UbYcsxKJI5eYFrhI9qFYb0nW4lLdmUNqCGXxEGU5TAa+mwR2ifEnOhDSoHKin2dMOwCL RdVDc6ZJiOX8ynjIP9pE+s7N/H7lzdU7hB8at+FRAc4ZFw7u6Jm/vPreipz8eg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=94427ab8f276c6f1aba8cca2aef6607bb6d17ac0 commit 94427ab8f276c6f1aba8cca2aef6607bb6d17ac0 Author: Andriy Gapon AuthorDate: 2021-12-15 09:11:15 +0000 Commit: Andriy Gapon CommitDate: 2021-12-22 06:49:15 +0000 rk_i2c_transfer: minor improvement to bit twiddling No need to mask a uint8_t with 0xff, the mask covers the whole type. Explcitly cast to uint32_t before bit shifting instead of relying on the implicit promotion to signed int. (cherry picked from commit 25e92673b54ea3b66cbaf53826cfd01df3441ea3) --- sys/arm64/rockchip/rk_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/rockchip/rk_i2c.c b/sys/arm64/rockchip/rk_i2c.c index 2be6716af4eb..fcfdde1bb202 100644 --- a/sys/arm64/rockchip/rk_i2c.c +++ b/sys/arm64/rockchip/rk_i2c.c @@ -501,7 +501,7 @@ rk_i2c_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) /* Write slave register address */ reg = 0; for (j = 0; j < msgs[i].len ; j++) { - reg |= (msgs[i].buf[j] & 0xff) << (j * 8); + reg |= (uint32_t)msgs[i].buf[j] << (j * 8); reg |= RK_I2C_MRXADDR_VALID(j); } RK_I2C_WRITE(sc, RK_I2C_MRXRADDR, reg);