Commit 6af58d3e authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Andi Shyti
Browse files

i2c: axxia: Use i2c_10bit_addr_*_from_msg() helpers



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

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250213141045.2716943-3-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
parent e794dc30
Loading
Loading
Loading
Loading
+3 −18
Original line number Diff line number Diff line
@@ -255,11 +255,6 @@ static int i2c_m_rd(const struct i2c_msg *msg)
	return (msg->flags & I2C_M_RD) != 0;
}

static int i2c_m_ten(const struct i2c_msg *msg)
{
	return (msg->flags & I2C_M_TEN) != 0;
}

static int i2c_m_recv_len(const struct i2c_msg *msg)
{
	return (msg->flags & I2C_M_RECV_LEN) != 0;
@@ -439,20 +434,10 @@ static void axxia_i2c_set_addr(struct axxia_i2c_dev *idev, struct i2c_msg *msg)
{
	u32 addr_1, addr_2;

	if (i2c_m_ten(msg)) {
		/* 10-bit address
		 *   addr_1: 5'b11110 | addr[9:8] | (R/nW)
		 *   addr_2: addr[7:0]
		 */
		addr_1 = 0xF0 | ((msg->addr >> 7) & 0x06);
		if (i2c_m_rd(msg))
			addr_1 |= 1;	/* Set the R/nW bit of the address */
		addr_2 = msg->addr & 0xFF;
	if (msg->flags & I2C_M_TEN) {
		addr_1 = i2c_10bit_addr_hi_from_msg(msg);
		addr_2 = i2c_10bit_addr_lo_from_msg(msg);
	} else {
		/* 7-bit address
		 *   addr_1: addr[6:0] | (R/nW)
		 *   addr_2: dont care
		 */
		addr_1 = i2c_8bit_addr_from_msg(msg);
		addr_2 = 0;
	}