diff mbox series

[3/4] i2c: xiic: Correct the datatype for rx_watermark

Message ID 20220420075924.14546-4-shubhrajyoti.datta@xilinx.com
State New
Headers show
Series i2c: xiic: misc fixes | expand

Commit Message

Shubhrajyoti Datta April 20, 2022, 7:59 a.m. UTC
The message length data type should be u16 as per the i2c_msg structure

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
 drivers/i2c/busses/i2c-xiic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michal Simek April 21, 2022, 8:50 a.m. UTC | #1
On 4/20/22 09:59, Shubhrajyoti Datta wrote:
> The message length data type should be u16 as per the i2c_msg structure
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
>   drivers/i2c/busses/i2c-xiic.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 16a7e3164e68..eb4d34e7c0fe 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -576,7 +576,7 @@ static int xiic_busy(struct xiic_i2c *i2c)
>   
>   static void xiic_start_recv(struct xiic_i2c *i2c)
>   {
> -	u8 rx_watermark;
> +	u16 rx_watermark;
>   	struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
>   
>   	/* Clear and enable Rx full interrupt. */

xiic_setreg8(struct xiic_i2c *i2c, int reg, u8 value) has u8 value it means I 
would expect you will also recast it.
Value can't be more then IIC_RX_FIFO_DEPTH anyway that's why it shouldn't be a 
problem.

xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, (u8)(rx_watermark - 1));

Thanks,
Michal
Wolfram Sang May 14, 2022, 2:04 p.m. UTC | #2
On Thu, Apr 21, 2022 at 10:50:32AM +0200, Michal Simek wrote:
> 
> 
> On 4/20/22 09:59, Shubhrajyoti Datta wrote:
> > The message length data type should be u16 as per the i2c_msg structure
> > 
> > Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> > ---
> >   drivers/i2c/busses/i2c-xiic.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> > index 16a7e3164e68..eb4d34e7c0fe 100644
> > --- a/drivers/i2c/busses/i2c-xiic.c
> > +++ b/drivers/i2c/busses/i2c-xiic.c
> > @@ -576,7 +576,7 @@ static int xiic_busy(struct xiic_i2c *i2c)
> >   static void xiic_start_recv(struct xiic_i2c *i2c)
> >   {
> > -	u8 rx_watermark;
> > +	u16 rx_watermark;
> >   	struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
> >   	/* Clear and enable Rx full interrupt. */
> 
> xiic_setreg8(struct xiic_i2c *i2c, int reg, u8 value) has u8 value it means
> I would expect you will also recast it.
> Value can't be more then IIC_RX_FIFO_DEPTH anyway that's why it shouldn't be
> a problem.
> 
> xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, (u8)(rx_watermark - 1));

Waiting for v2 here.
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 16a7e3164e68..eb4d34e7c0fe 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -576,7 +576,7 @@  static int xiic_busy(struct xiic_i2c *i2c)
 
 static void xiic_start_recv(struct xiic_i2c *i2c)
 {
-	u8 rx_watermark;
+	u16 rx_watermark;
 	struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
 
 	/* Clear and enable Rx full interrupt. */