* [PATCH 0/3] R-Car I2C driver: some cleanups
@ 2014-08-22 14:21 Sergei Shtylyov
2014-08-22 14:22 ` [PATCH 1/3] i2c-rcar: simplify check for last message Sergei Shtylyov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2014-08-22 14:21 UTC (permalink / raw)
To: wsa, linux-i2c; +Cc: linux-sh
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] i2c-rcar: simplify check for last message
2014-08-22 14:21 [PATCH 0/3] R-Car I2C driver: some cleanups Sergei Shtylyov
@ 2014-08-22 14:22 ` Sergei Shtylyov
[not found] ` <32018817.zX4x1fdR4T-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
2014-08-22 14:24 ` [PATCH 3/3] i2c-rcar: make rcar_i2c_irq_recv() *void* Sergei Shtylyov
2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2014-08-22 14:22 UTC (permalink / raw)
To: wsa, linux-i2c; +Cc: linux-sh
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 <sergei.shtylyov@cogentembedded.com>
---
drivers/i2c/busses/i2c-rcar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux/drivers/i2c/busses/i2c-rcar.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-rcar.c
+++ linux/drivers/i2c/busses/i2c-rcar.c
@@ -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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] i2c-rcar: make rcar_i2c_prepare_msg() *void*
[not found] ` <32018817.zX4x1fdR4T-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
@ 2014-08-22 14:23 ` Sergei Shtylyov
0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2014-08-22 14:23 UTC (permalink / raw)
To: wsa-z923LK4zBo2bacvFa/9K2g, linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: linux-sh-u79uwXL29TY76Z2rM5mHXA
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().
Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
---
drivers/i2c/busses/i2c-rcar.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
Index: linux/drivers/i2c/busses/i2c-rcar.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-rcar.c
+++ linux/drivers/i2c/busses/i2c-rcar.c
@@ -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 r
rcar_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 i
if (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),
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] i2c-rcar: make rcar_i2c_irq_recv() *void*
2014-08-22 14:21 [PATCH 0/3] R-Car I2C driver: some cleanups Sergei Shtylyov
2014-08-22 14:22 ` [PATCH 1/3] i2c-rcar: simplify check for last message Sergei Shtylyov
[not found] ` <32018817.zX4x1fdR4T-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
@ 2014-08-22 14:24 ` Sergei Shtylyov
2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2014-08-22 14:24 UTC (permalink / raw)
To: wsa, linux-i2c; +Cc: linux-sh
rcar_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().
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/i2c/busses/i2c-rcar.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
Index: linux/drivers/i2c/busses/i2c-rcar.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-rcar.c
+++ linux/drivers/i2c/busses/i2c-rcar.c
@@ -317,7 +317,7 @@ static int rcar_i2c_irq_send(struct rcar
return 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 rcar
rcar_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));
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-22 14:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-22 14:21 [PATCH 0/3] R-Car I2C driver: some cleanups Sergei Shtylyov
2014-08-22 14:22 ` [PATCH 1/3] i2c-rcar: simplify check for last message Sergei Shtylyov
[not found] ` <32018817.zX4x1fdR4T-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
2014-08-22 14:23 ` [PATCH 2/3] i2c-rcar: make rcar_i2c_prepare_msg() *void* Sergei Shtylyov
2014-08-22 14:24 ` [PATCH 3/3] i2c-rcar: make rcar_i2c_irq_recv() *void* Sergei Shtylyov
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).