R-Car I2C driver: some cleanups
Subsystems (4)
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 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.
--- drivers/i2c/busses/i2c-rcar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-rcar.c +1 -1
@@ -432,7 +432,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);
A message that is not in the archive (sent off-list or not yet received): 32018817.zX4x1fdR4T-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org
PATCH 2/3 i2c-rcar: make rcar_i2c_prepare_msg() *void*
rcar_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().
--- drivers/i2c/busses/i2c-rcar.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-rcar.c +2 -7
@@ -243,7 +243,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);
@@ -251,8 +251,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 ; }/*
@@ -435,10 +433,7 @@ 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); - -if (ret <0 ) -break ; +rcar_i2c_prepare_msg (priv); timeout = wait_event_timeout(priv->wait, rcar_i2c_flags_has(priv, ID_DONE),
PATCH 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().
--- drivers/i2c/busses/i2c-rcar.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-rcar.c +3 -5
@@ -317,7 +317,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;
@@ -327,7 +327,7 @@ static int rcar_i2c_irq_recv(struct rcar* Do nothing */ if (!(msr &MDR )) -return 0 ; +return ;if (msr &MAT ) {/*
@@ -354,8 +354,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)
@@ -387,7 +385,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));