R-Car I2C driver: some cleanups
Subsystems (4)
v2 cover R-Car I2C driver: some cleanups
Hello.
Here's the set of 3 patches against Wolfram Sang's 'linux.git' repo's
'i2c/for-next' branch.
[1/3] i2c-rcar: simplify check for last message [2/3] i2c-rcar: make rcar_i2c_prepare_msg() *void* [3/3] i2c-rcar: make rcar_i2c_irq_recv() *void*
WBR, Sergei
PATCH v2 1/3 i2c-rcar: simplify check for last message
rcar_i2c_master_xfer() needlessly compares the message pointers (using indirect addressing) in order to detect the last I2C message, while it's enough to only compare the message indexes.
---
Changes in version 2:
- refreshed patch.
drivers/i2c/busses/i2c-rcar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-rcar.c +1 -1
@@ -453,7 +453,7 @@ static int rcar_i2c_master_xfer(struct i priv->msg = &msgs[i]; priv->pos =0 ; priv->flags =0 ; -if (priv->msg == &msgs[num -1 ]) +if (i == num -1 )rcar_i2c_flags_set (priv,ID_LAST_MSG ); ret =rcar_i2c_prepare_msg (priv);
Wolfram Sang
AppliedRe: [PATCH v2 1/3] i2c-rcar: simplify check for last message
Quoted 6 lines · Sergei Shtylyov
rcar_i2c_master_xfer()needlessly compares the message pointers (using indirect addressing) in order to detect the last I2C message, while it's enough to only compare the message indexes.Signed-off-by Sergei Shtylyov <[email protected]>
Applied to for-next, thanks!
PATCH v2 2/3 i2c-rcar: make rcar_i2c_prepare_msg() *void*
In reply to Sergei Shtylyovrcar_i2c_prepare_msg() always returns 0, so we can make this function return *void* and thus remove the result check in rcar_i2c_master_xfer().
---
Changes in version 2:
- resolved reject, refreshed patch.
drivers/i2c/busses/i2c-rcar.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-rcar.c +2 -7
@@ -245,7 +245,7 @@ scgd_find:return 0 ; } -static int rcar_i2c_prepare_msg (struct rcar_i2c_priv *priv) +static void rcar_i2c_prepare_msg (struct rcar_i2c_priv *priv) {int read = !!rcar_i2c_is_recv (priv);
@@ -253,8 +253,6 @@ static int rcar_i2c_prepare_msg(struct rrcar_i2c_write (priv,ICMSR ,0 );rcar_i2c_write (priv,ICMCR ,RCAR_BUS_PHASE_START );rcar_i2c_write (priv,ICMIER , read ?RCAR_IRQ_RECV :RCAR_IRQ_SEND ); - -return 0 ; }/*
@@ -456,14 +454,11 @@ static int rcar_i2c_master_xfer(struct iif (i == num -1 )rcar_i2c_flags_set (priv,ID_LAST_MSG ); - ret =rcar_i2c_prepare_msg (priv); +rcar_i2c_prepare_msg (priv);spin_unlock_irqrestore (&priv->lock, flags);/*-------------- spin unlock -----------------*/ -if (ret <0 ) -break ; - timeout =wait_event_timeout (priv->wait,rcar_i2c_flags_has (priv,ID_DONE ),5 *HZ );
Wolfram Sang
AppliedRe: [PATCH v2 2/3] i2c-rcar: make rcar_i2c_prepare_msg() *void*
Quoted 5 lines · Sergei Shtylyov
rcar_i2c_prepare_msg()always returns 0, so we can make this function return *void* and thus remove the result check inrcar_i2c_master_xfer().Signed-off-by Sergei Shtylyov <[email protected]>
Applied to for-next, thanks!
PATCH v2 3/3 i2c-rcar: make rcar_i2c_irq_recv() *void*
In reply to Sergei Shtylyovrcar_i2c_irq_recv() always returns 0, so we can make this function return *void* and also remove rcar_i2c_flags_set() invocation in rcar_i2c_irq().
---
Changes in version 2:
- refreshed patch.
drivers/i2c/busses/i2c-rcar.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-rcar.c +3 -5
@@ -319,7 +319,7 @@ static int rcar_i2c_irq_send(struct rcarreturn 0 ; } -static int rcar_i2c_irq_recv (struct rcar_i2c_priv *priv,u32 msr) +static void rcar_i2c_irq_recv (struct rcar_i2c_priv *priv,u32 msr) {struct i2c_msg *msg = priv->msg;
@@ -329,7 +329,7 @@ static int rcar_i2c_irq_recv(struct rcar* Do nothing */ if (!(msr &MDR )) -return 0 ; +return ;if (msr &MAT ) {/*
@@ -356,8 +356,6 @@ static int rcar_i2c_irq_recv(struct rcarrcar_i2c_write (priv,ICMCR ,RCAR_BUS_PHASE_DATA );rcar_i2c_write (priv,ICMSR ,RCAR_IRQ_ACK_RECV ); - -return 0 ; }static irqreturn_t rcar_i2c_irq (int irq,void *ptr)
@@ -395,7 +393,7 @@ static irqreturn_t rcar_i2c_irq(int irq, }if (rcar_i2c_is_recv (priv)) -rcar_i2c_flags_set (priv,rcar_i2c_irq_recv (priv, msr)); +rcar_i2c_irq_recv (priv, msr);else rcar_i2c_flags_set (priv,rcar_i2c_irq_send (priv, msr));
Re: [PATCH v2 3/3] i2c-rcar: make rcar_i2c_irq_recv() *void*
Quoted 4 lines · Sergei Shtylyov
rcar_i2c_irq_recv()always returns 0, so we can make this function return *void* and also removercar_i2c_flags_set()invocation inrcar_i2c_irq().Signed-off-by Sergei Shtylyov <[email protected]>
I prefer to skip this patch to have more similarity between the send_irq and recv_irq routines.