From nobody Wed Dec 22 06:59:22 2021 X-Original-To: dev-commits-src-branches@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 BA74018FA773; Wed, 22 Dec 2021 06:59:23 +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 4JJkhV6htWz3PVM; Wed, 22 Dec 2021 06:59:22 +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 7129718E8F; Wed, 22 Dec 2021 06:59:22 +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 1BM6xMXa036961; Wed, 22 Dec 2021 06:59:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BM6xMqD036960; Wed, 22 Dec 2021 06:59:22 GMT (envelope-from git) Date: Wed, 22 Dec 2021 06:59:22 GMT Message-Id: <202112220659.1BM6xMqD036960@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: ee74d0c3619e - stable/12 - rk_i2c_transfer: minor improvement to bit twiddling List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/12 X-Git-Reftype: branch X-Git-Commit: ee74d0c3619e763b7bc354ab4f41ba37583c1471 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640156363; 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=/WIvfsUXQ8tC4br1b60jhCREhoddFeTYTsv9x80N7FQ=; b=A72axmqI1lE3AIuhWA6xtbUB6Zfq+qWizYF+4bUp2sG4A8vgWRKL3dHnrcmPykkEMPoVn3 kWR3iU2YnHiNQQ3RpfgI86i9h5L0/cqoftRTDECNI8s3cbjXLluNy7g0SfR3AYyKm0JCXJ kwfVSOwBPOlSHOyZ40gYVZBjkdMshosTFRrlysT3pu7eQV1abjH1SZSeoAMa9Cgf1IHxjY oEsoMnexsP68ttRminAX8JvHlkjFAZK1IpTphbENv4XxvUtMI2/WR3HFpVG0jvGs++LEVF BMS211tTSIlhIZm0zv3WLZ0fKj+E1EQ6nennC4Al+UBzPcMZtk3ZJtkw3OrlvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640156363; a=rsa-sha256; cv=none; b=vl3G4TPEVidInQjXCNgrb+1M6rqN8OpRppk+ySpJucI2h6sxeFpscp0SEw9FaLFQiossUr ypo4N7H2CfZFrPymHVxOZWMLlKJP3WBd0ZnU9yLh/esB+ZkcVrJ7p879JiICxB5WdtnAai e8HQU8QsD6gA/yP149+wWZsxiTzaSneL4jyQwMGoYHz5Jpd2ACNCJad4K0nBcb6mAxavp1 aiHrwRuJzrIWKBu+gkTBwpf1sHq7l+EEOeC3bZG6OBXkDXRIyveonB9H1v8Zk5+oh7euto zlofmPX13zh2tw1GpkzGs6XD4TDlCVWiCuGdQ1RkDP3RdDkK1GxqNwb6M3A2eg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=ee74d0c3619e763b7bc354ab4f41ba37583c1471 commit ee74d0c3619e763b7bc354ab4f41ba37583c1471 Author: Andriy Gapon AuthorDate: 2021-12-15 09:11:15 +0000 Commit: Andriy Gapon CommitDate: 2021-12-22 06:57:22 +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 9158eb8222eb..09bfd52a5abe 100644 --- a/sys/arm64/rockchip/rk_i2c.c +++ b/sys/arm64/rockchip/rk_i2c.c @@ -503,7 +503,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);