From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Peter Rosin <peda@axentia.se>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH 01/12] i2c: pxa: use official address byte helper
Date: Mon, 20 Jan 2020 19:13:11 +0000 [thread overview]
Message-ID: <20200120191311.GE25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <c3d57cc4-5ec4-492f-e233-580ac1aba2cd@axentia.se>
On Mon, Jan 20, 2020 at 05:03:26PM +0000, Peter Rosin wrote:
> On 2019-12-15 17:05, Russell King wrote:
> > i2c-pxa was created before i2c_8bit_addr_from_msg() was implemented,
> > and used its own i2c_pxa_addr_byte() which is functionally the same.
> > Sadly, it was never updated to use this new helper. Switch it over.
> >
> > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> > ---
> > drivers/i2c/busses/i2c-pxa.c | 21 +++++++--------------
> > 1 file changed, 7 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> > index 2c3c3d6935c0..966000923e8e 100644
> > --- a/drivers/i2c/busses/i2c-pxa.c
> > +++ b/drivers/i2c/busses/i2c-pxa.c
> > @@ -675,25 +675,18 @@ static void i2c_pxa_slave_stop(struct pxa_i2c *i2c)
> > * PXA I2C Master mode
> > */
> >
> > -static inline unsigned int i2c_pxa_addr_byte(struct i2c_msg *msg)
> > -{
> > - unsigned int addr = (msg->addr & 0x7f) << 1;
> > -
> > - if (msg->flags & I2C_M_RD)
> > - addr |= 1;
> > -
> > - return addr;
> > -}
> > -
> > static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
> > {
> > u32 icr;
> > + u8 addr;
> > +
> > + addr = i2c_8bit_addr_from_msg(i2c->msg);
> >
> > /*
> > * Step 1: target slave address into IDBR
> > */
> > - writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
> > - i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
> > + writel(addr, _IDBR(i2c));
> > + i2c->req_slave_addr = addr;
>
> You are introducing a temporary variable (addr) here...
>
> >
> > /*
> > * Step 2: initiate the write.
> > @@ -1006,8 +999,8 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr)
> > /*
> > * Write the next address.
> > */
> > - writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
> > - i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
> > + writel(i2c_8bit_addr_from_msg(i2c->msg), _IDBR(i2c));
> > + i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg);
>
> ...but not here. But it seems like the same pattern. Any particular reason for
> that difference?
No real reason. If I assign i2c->req_slave_addr first, I don't need
a separate variable...
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
next prev parent reply other threads:[~2020-01-20 19:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191215160444.GB25745@shell.armlinux.org.uk>
[not found] ` <E1igWOT-0005Dp-Sb@rmk-PC.armlinux.org.uk>
2020-01-20 17:03 ` [PATCH 01/12] i2c: pxa: use official address byte helper Peter Rosin
2020-01-20 19:13 ` Russell King - ARM Linux admin [this message]
2020-04-27 15:07 ` [PATCH REPOST 00/12] i2c-pxa cleanups Russell King - ARM Linux admin
2020-04-27 15:08 ` [PATCH REPOST 01/12] i2c: pxa: use official address byte helper Russell King
2020-04-27 17:59 ` Russell King - ARM Linux admin
2020-04-27 15:08 ` [PATCH REPOST 02/12] i2c: pxa: remove unneeded includes Russell King
2020-04-27 15:08 ` [PATCH REPOST 03/12] i2c: pxa: re-arrange includes to be in alphabetical order Russell King
2020-04-27 15:08 ` [PATCH REPOST 04/12] i2c: pxa: re-arrange functions to flow better Russell King
2020-04-27 15:08 ` [PATCH REPOST 05/12] i2c: pxa: re-arrange register field definitions Russell King
2020-04-27 15:09 ` [PATCH REPOST 06/12] i2c: pxa: add and use definitions for IBMR register Russell King
2020-04-27 15:09 ` [PATCH REPOST 07/12] i2c: pxa: always set fm and hs members for each type Russell King
2020-04-27 15:09 ` [PATCH REPOST 08/12] i2c: pxa: move private definitions to i2c-pxa.c Russell King
2020-04-27 15:09 ` [PATCH REPOST 09/12] i2c: pxa: move DT IDs along side platform IDs Russell King
2020-04-27 15:09 ` [PATCH REPOST 10/12] i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output Russell King
2020-04-27 15:09 ` [PATCH REPOST 11/12] i2c: pxa: clean up decode_bits() Russell King
2020-04-27 15:09 ` [PATCH REPOST 12/12] i2c: pxa: fix i2c_pxa_wait_bus_not_busy() boundary condition Russell King
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=20200120191311.GE25745@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=linux-i2c@vger.kernel.org \
--cc=peda@axentia.se \
/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).