linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-renesas-soc@vger.kernel.org
Cc: Krzysztof Adamski <krzysztof.adamski@nokia.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Kamal Dasu <kamal.dasu@broadcom.com>, Stefan Roese <sr@denx.de>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Gregory CLEMENT <gregory.clement@bootlin.com>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Subject: [PATCH v2 04/10] i2c: brcmstb: Use i2c_10bit_addr_*_from_msg() helpers
Date: Thu, 13 Feb 2025 16:07:18 +0200	[thread overview]
Message-ID: <20250213141045.2716943-5-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20250213141045.2716943-1-andriy.shevchenko@linux.intel.com>

Use i2c_10bit_addr_*_from_msg() helpers instead of local copy.
No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-brcmstb.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
index 00f1a046e985..5fa30e8926c5 100644
--- a/drivers/i2c/busses/i2c-brcmstb.c
+++ b/drivers/i2c/busses/i2c-brcmstb.c
@@ -414,23 +414,22 @@ static int brcmstb_i2c_do_addr(struct brcmstb_i2c_dev *dev,
 
 	if (msg->flags & I2C_M_TEN) {
 		/* First byte is 11110XX0 where XX is upper 2 bits */
-		addr = 0xF0 | ((msg->addr & 0x300) >> 7);
+		addr = i2c_10bit_addr_hi_from_msg(msg) & ~I2C_M_RD;
 		bsc_writel(dev, addr, chip_address);
 
 		/* Second byte is the remaining 8 bits */
-		addr = msg->addr & 0xFF;
+		addr = i2c_10bit_addr_lo_from_msg(msg);
 		if (brcmstb_i2c_write_data_byte(dev, &addr, 0) < 0)
 			return -EREMOTEIO;
 
 		if (msg->flags & I2C_M_RD) {
 			/* For read, send restart without stop condition */
-			brcmstb_set_i2c_start_stop(dev, COND_RESTART
-						   | COND_NOSTOP);
+			brcmstb_set_i2c_start_stop(dev, COND_RESTART | COND_NOSTOP);
+
 			/* Then re-send the first byte with the read bit set */
-			addr = 0xF0 | ((msg->addr & 0x300) >> 7) | 0x01;
+			addr = i2c_10bit_addr_hi_from_msg(msg);
 			if (brcmstb_i2c_write_data_byte(dev, &addr, 0) < 0)
 				return -EREMOTEIO;
-
 		}
 	} else {
 		addr = i2c_8bit_addr_from_msg(msg);
-- 
2.45.1.3035.g276e886db78b



  parent reply	other threads:[~2025-02-13 14:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 14:07 [PATCH v2 00/10] i2c: busses: Introduce and use i2c_10bit_addr_*_from_msg() Andy Shevchenko
2025-02-13 14:07 ` [PATCH v2 01/10] i2c: Introduce i2c_10bit_addr_*_from_msg() helpers Andy Shevchenko
2025-02-13 16:01   ` AngeloGioacchino Del Regno
2025-02-13 14:07 ` [PATCH v2 02/10] i2c: axxia: Use " Andy Shevchenko
2025-02-13 14:07 ` [PATCH v2 03/10] i2c: bcm-kona: " Andy Shevchenko
2025-02-13 14:07 ` Andy Shevchenko [this message]
2025-02-13 14:07 ` [PATCH v2 05/10] i2c: eg20t: " Andy Shevchenko
2025-02-13 14:07 ` [PATCH v2 06/10] i2c: kempld: " Andy Shevchenko
2025-02-13 16:15   ` Wolfram Sang
2025-02-13 16:37     ` Andy Shevchenko
2025-02-13 14:07 ` [PATCH v2 07/10] i2c: mt7621: " Andy Shevchenko
2025-02-13 16:01   ` AngeloGioacchino Del Regno
2025-02-13 16:37     ` Andy Shevchenko
2025-02-13 14:07 ` [PATCH v2 08/10] i2c: rzv2m: " Andy Shevchenko
2025-02-13 14:07 ` [PATCH v2 09/10] i2c: ibm_iic: Use i2c_*bit_addr*_from_msg() helpers Andy Shevchenko
2025-02-13 14:07 ` [PATCH v2 10/10] i2c: mv64xxx: " Andy Shevchenko
2025-03-11  1:12 ` [PATCH v2 00/10] i2c: busses: Introduce and use i2c_10bit_addr_*_from_msg() Andi Shyti
2025-03-12  9:32   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250213141045.2716943-5-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=andi.shyti@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=gregory.clement@bootlin.com \
    --cc=kamal.dasu@broadcom.com \
    --cc=krzysztof.adamski@nokia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=sr@denx.de \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).