* [PATCH 00/21] i2c: make use of i2c_8bit_addr_from_msg
@ 2018-05-14 14:53 Peter Rosin
2018-05-14 14:53 ` [PATCH 16/21] i2c: pasemi: " Peter Rosin
2018-05-14 16:11 ` [PATCH 00/21] i2c: " Joe Perches
0 siblings, 2 replies; 4+ messages in thread
From: Peter Rosin @ 2018-05-14 14:53 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Rosin, Brendan Higgins, Benjamin Herrenschmidt,
Joel Stanley, Andrew Jeffery, Guenter Roeck,
Uwe Kleine-König, Pengutronix Kernel Team, Wolfram Sang,
Peter Korsgaard, Andy Gross, David Brown, Linus Walleij,
linux-i2c, openbmc, linux-arm-kernel, linux-aspeed, linuxppc-dev,
linux-arm-msm, linux-soc
Hi!
The nice little inline i2c_8bit_addr_from_msg is not getting
enough use. This series improves the situation and drops a
bunch of lines in the process.
I have only compile-tested (that part fine, at least over here).
Cheers,
Peter
Peter Rosin (21):
i2c: algo: bit: make use of i2c_8bit_addr_from_msg
i2c: algo: pca: make use of i2c_8bit_addr_from_msg
i2c: algo: pcf: make use of i2c_8bit_addr_from_msg
i2c: aspeed: make use of i2c_8bit_addr_from_msg
i2c: axxia: make use of i2c_8bit_addr_from_msg
i2c: diolan: make use of i2c_8bit_addr_from_msg
i2c: efm32: make use of i2c_8bit_addr_from_msg
i2c: eg20t: make use of i2c_8bit_addr_from_msg
i2c: emev2: make use of i2c_8bit_addr_from_msg
i2c: hix5hd2: make use of i2c_8bit_addr_from_msg
i2c: imx-lpi2c: make use of i2c_8bit_addr_from_msg
i2c: imx: make use of i2c_8bit_addr_from_msg
i2c: kempld: make use of i2c_8bit_addr_from_msg
i2c: mxs: make use of i2c_8bit_addr_from_msg
i2c: ocores: make use of i2c_8bit_addr_from_msg
i2c: pasemi: make use of i2c_8bit_addr_from_msg
i2c: qup: make use of i2c_8bit_addr_from_msg
i2c: rcar: make use of i2c_8bit_addr_from_msg
i2c: riic: make use of i2c_8bit_addr_from_msg
i2c: stu300: make use of i2c_8bit_addr_from_msg
i2c: xiic: make use of i2c_8bit_addr_from_msg
drivers/i2c/algos/i2c-algo-bit.c | 4 +---
drivers/i2c/algos/i2c-algo-pca.c | 5 +----
drivers/i2c/algos/i2c-algo-pcf.c | 5 +----
drivers/i2c/busses/i2c-aspeed.c | 3 +--
drivers/i2c/busses/i2c-axxia.c | 5 +++--
drivers/i2c/busses/i2c-diolan-u2c.c | 11 ++++-------
drivers/i2c/busses/i2c-efm32.c | 3 +--
drivers/i2c/busses/i2c-eg20t.c | 5 ++---
drivers/i2c/busses/i2c-emev2.c | 2 +-
drivers/i2c/busses/i2c-hix5hd2.c | 9 ++-------
drivers/i2c/busses/i2c-imx-lpi2c.c | 4 +---
drivers/i2c/busses/i2c-imx.c | 10 +++++-----
drivers/i2c/busses/i2c-kempld.c | 7 +++----
drivers/i2c/busses/i2c-mxs.c | 9 +++------
drivers/i2c/busses/i2c-ocores.c | 5 +----
drivers/i2c/busses/i2c-pasemi.c | 2 +-
drivers/i2c/busses/i2c-qup.c | 2 +-
drivers/i2c/busses/i2c-rcar.c | 2 +-
drivers/i2c/busses/i2c-riic.c | 5 ++---
drivers/i2c/busses/i2c-stu300.c | 22 +++++++++++++---------
drivers/i2c/busses/i2c-xiic.c | 11 ++---------
21 files changed, 50 insertions(+), 81 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 16/21] i2c: pasemi: make use of i2c_8bit_addr_from_msg
2018-05-14 14:53 [PATCH 00/21] i2c: make use of i2c_8bit_addr_from_msg Peter Rosin
@ 2018-05-14 14:53 ` Peter Rosin
2018-05-14 16:11 ` [PATCH 00/21] i2c: " Joe Perches
1 sibling, 0 replies; 4+ messages in thread
From: Peter Rosin @ 2018-05-14 14:53 UTC (permalink / raw)
To: linux-kernel; +Cc: Peter Rosin, linuxppc-dev, linux-i2c, Wolfram Sang
Because it looks neater.
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/i2c/busses/i2c-pasemi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index df1dbc92a024..55fd5c6f3cca 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -121,7 +121,7 @@ static int pasemi_i2c_xfer_msg(struct i2c_adapter *adapter,
read = msg->flags & I2C_M_RD ? 1 : 0;
- TXFIFO_WR(smbus, MTXFIFO_START | (msg->addr << 1) | read);
+ TXFIFO_WR(smbus, MTXFIFO_START | i2c_8bit_addr_from_msg(msg));
if (read) {
TXFIFO_WR(smbus, msg->len | MTXFIFO_READ |
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 00/21] i2c: make use of i2c_8bit_addr_from_msg
2018-05-14 14:53 [PATCH 00/21] i2c: make use of i2c_8bit_addr_from_msg Peter Rosin
2018-05-14 14:53 ` [PATCH 16/21] i2c: pasemi: " Peter Rosin
@ 2018-05-14 16:11 ` Joe Perches
2018-05-14 17:01 ` Peter Rosin
1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2018-05-14 16:11 UTC (permalink / raw)
To: Peter Rosin, linux-kernel
Cc: Brendan Higgins, Benjamin Herrenschmidt, Joel Stanley,
Andrew Jeffery, Guenter Roeck, Uwe Kleine-König,
Pengutronix Kernel Team, Wolfram Sang, Peter Korsgaard,
Andy Gross, David Brown, Linus Walleij, linux-i2c, openbmc,
linux-arm-kernel, linux-aspeed, linuxppc-dev, linux-arm-msm,
linux-soc
On Mon, 2018-05-14 at 16:53 +0200, Peter Rosin wrote:
> Hi!
>
> The nice little inline i2c_8bit_addr_from_msg is not getting
> enough use. This series improves the situation and drops a
> bunch of lines in the process.
Perhaps the inline should test for I2C_M_REV_DIR_ADDR
as there is at least one use like
- addr = msg->addr << 1;
- if (flags & I2C_M_RD)
- addr |= 1;
+ addr = i2c_8bit_addr_from_msg(msg);
if (flags & I2C_M_REV_DIR_ADDR)
addr ^= 1;
which look odd
Do any of these changes now no longer need
the temporary flags variable?
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 00/21] i2c: make use of i2c_8bit_addr_from_msg
2018-05-14 16:11 ` [PATCH 00/21] i2c: " Joe Perches
@ 2018-05-14 17:01 ` Peter Rosin
0 siblings, 0 replies; 4+ messages in thread
From: Peter Rosin @ 2018-05-14 17:01 UTC (permalink / raw)
To: Joe Perches, linux-kernel
Cc: Brendan Higgins, Benjamin Herrenschmidt, Joel Stanley,
Andrew Jeffery, Guenter Roeck, Uwe Kleine-König,
Pengutronix Kernel Team, Wolfram Sang, Peter Korsgaard,
Andy Gross, David Brown, Linus Walleij, linux-i2c, openbmc,
linux-arm-kernel, linux-aspeed, linuxppc-dev, linux-arm-msm,
linux-soc
On 2018-05-14 18:11, Joe Perches wrote:
> On Mon, 2018-05-14 at 16:53 +0200, Peter Rosin wrote:
>> Hi!
>>
>> The nice little inline i2c_8bit_addr_from_msg is not getting
>> enough use. This series improves the situation and drops a
>> bunch of lines in the process.
>
> Perhaps the inline should test for I2C_M_REV_DIR_ADDR
> as there is at least one use like
>
> - addr = msg->addr << 1;
> - if (flags & I2C_M_RD)
> - addr |= 1;
> + addr = i2c_8bit_addr_from_msg(msg);
> if (flags & I2C_M_REV_DIR_ADDR)
> addr ^= 1;
>
> which look odd
I say no, because the driver has to also indicate support with
I2C_FUNC_PROTOCOL_MANGLING and I don't see a sane way to check
that part of the contract. But what do I know. Seems orthogonal.
> Do any of these changes now no longer need
> the temporary flags variable?
Right, I thought I had made any obvious further simplification made
possible by these changes, but I overlooked that one. The flags
variable is certainly over-engineered in i2c-algo-pcf.c and would
be a good candidate for removal. But that's only patch 3/21.
I'll wait for a bit with an update, and Wolfram can adjust this on
the way in if he feels like it.
Cheers,
Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-14 17:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-14 14:53 [PATCH 00/21] i2c: make use of i2c_8bit_addr_from_msg Peter Rosin
2018-05-14 14:53 ` [PATCH 16/21] i2c: pasemi: " Peter Rosin
2018-05-14 16:11 ` [PATCH 00/21] i2c: " Joe Perches
2018-05-14 17:01 ` Peter Rosin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox