All the mail mirrored from lore.kernel.org
 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>,
	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 v1 7/8] i2c: mv64xxx: Use i2c_*bit_addr_from_msg() helpers
Date: Wed, 12 Feb 2025 18:32:32 +0200	[thread overview]
Message-ID: <20250212163359.2407327-8-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20250212163359.2407327-1-andriy.shevchenko@linux.intel.com>

Use i2c_*bit_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-mv64xxx.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 874309580c33..3f83c68947cc 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -27,7 +27,6 @@
 #include <linux/err.h>
 #include <linux/delay.h>
 
-#define MV64XXX_I2C_ADDR_ADDR(val)			((val & 0x7f) << 1)
 #define MV64XXX_I2C_BAUD_DIV_N(val)			(val & 0x7)
 #define MV64XXX_I2C_BAUD_DIV_M(val)			((val & 0xf) << 3)
 
@@ -176,22 +175,17 @@ static void
 mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data,
 	struct i2c_msg *msg)
 {
-	u32	dir = 0;
-
 	drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK |
 			      MV64XXX_I2C_REG_CONTROL_TWSIEN;
 
 	if (!drv_data->atomic)
 		drv_data->cntl_bits |= MV64XXX_I2C_REG_CONTROL_INTEN;
 
-	if (msg->flags & I2C_M_RD)
-		dir = 1;
-
 	if (msg->flags & I2C_M_TEN) {
-		drv_data->addr1 = 0xf0 | (((u32)msg->addr & 0x300) >> 7) | dir;
+		drv_data->addr1 = i2c_10bit_addr_from_msg(msg);
 		drv_data->addr2 = (u32)msg->addr & 0xff;
 	} else {
-		drv_data->addr1 = MV64XXX_I2C_ADDR_ADDR((u32)msg->addr) | dir;
+		drv_data->addr1 = i2c_8bit_addr_from_msg(msg);
 		drv_data->addr2 = 0;
 	}
 }
-- 
2.45.1.3035.g276e886db78b


  parent reply	other threads:[~2025-02-12 16:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 16:32 [PATCH v1 0/8] i2c: busses: Introduce and use i2c_10bit_addr_from_msg() Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 1/8] i2c: Introduce i2c_10bit_addr_from_msg() Andy Shevchenko
2025-02-12 17:06   ` Fabrizio Castro
2025-02-12 18:36   ` Geert Uytterhoeven
2025-02-12 19:04     ` Andy Shevchenko
2025-02-13 10:02       ` Wolfram Sang
2025-02-13 10:54         ` Andy Shevchenko
2025-02-13 13:04         ` Andy Shevchenko
2025-02-13 11:10       ` Geert Uytterhoeven
2025-02-13 22:41     ` Andi Shyti
2025-02-14  8:04       ` Geert Uytterhoeven
2025-02-14 13:55         ` Andy Shevchenko
2025-02-13 22:40   ` Andi Shyti
2025-02-12 16:32 ` [PATCH v1 2/8] i2c: axxia: Use i2c_10bit_addr_from_msg() helper Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 3/8] i2c: bcm-kona: " Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 4/8] i2c: eg20t: " Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 5/8] i2c: kempld: " Andy Shevchenko
2025-02-12 16:32 ` [PATCH v1 6/8] i2c: mt7621: " Andy Shevchenko
2025-02-12 16:32 ` Andy Shevchenko [this message]
2025-02-12 16:32 ` [PATCH v1 8/8] i2c: rzv2m: " Andy Shevchenko
2025-02-12 17:08   ` Fabrizio Castro

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=20250212163359.2407327-8-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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.