Re: [PATCH REPOST 01/12] i2c: pxa: use official address byte helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 27, 2020 at 04:08:37PM +0100, 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@xxxxxxxxxxxxxxx>
> ---
>  drivers/i2c/busses/i2c-pxa.c | 19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index 466e4f681d7a..2765dc530c36 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -716,16 +716,6 @@ 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;
> @@ -733,8 +723,8 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
>  	/*
>  	 * 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);
> +	i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg);
> +	writel(i2c->req_slave_addr, _IDBR(i2c));
>  
>  	/*
>  	 * Step 2: initiate the write.
> @@ -963,6 +953,7 @@ static void i2c_pxa_master_complete(struct pxa_i2c *i2c, int ret)
>  static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr)
>  {
>  	u32 icr = readl(_ICR(i2c)) & ~(ICR_START|ICR_STOP|ICR_ACKNAK|ICR_TB);
> +	u8 addr;

Looks like I didn't update this series of these patches with the problem
that was pointed out last time - one of the problems of having to
maintain four different copies of the same patch series. I'll resend
shortly.

>  
>   again:
>  	/*
> @@ -1047,8 +1038,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);
> +		i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg);
> +		writel(i2c->req_slave_addr, _IDBR(i2c));
>  
>  		/*
>  		 * And trigger a repeated start, and send the byte.
> -- 
> 2.20.1
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux