* [PATCH 1/3] i2c-eg20t: Modify MODULE_AUTHOR's email address
@ 2012-03-26 5:55 Tomoya MORINAGA
2012-03-26 5:55 ` [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs Tomoya MORINAGA
[not found] ` <1332741325-7746-1-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 2 replies; 9+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26 5:55 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, Wolfram Sang, Feng Tang, Alexander Stein,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: qi.wang-ral2JQCrhuEAvxtiuMwx3w,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w, Tomoya MORINAGA
Signed-off-by: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/i2c/busses/i2c-eg20t.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index f086131..d73975b 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -1063,6 +1063,6 @@ module_exit(pch_pci_exit);
MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semico ML7213/ML7223/ML7831 IOH I2C");
MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Tomoya MORINAGA. <tomoya-linux-8lRStDepK8iSL1NxhRU65dBPR1lH4CV8@public.gmane.org>");
+MODULE_AUTHOR("Tomoya MORINAGA. <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>");
module_param(pch_i2c_speed, int, (S_IRUSR | S_IWUSR));
module_param(pch_clk, int, (S_IRUSR | S_IWUSR));
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs
2012-03-26 5:55 [PATCH 1/3] i2c-eg20t: Modify MODULE_AUTHOR's email address Tomoya MORINAGA
@ 2012-03-26 5:55 ` Tomoya MORINAGA
[not found] ` <1332741325-7746-2-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[not found] ` <1332741325-7746-1-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
1 sibling, 1 reply; 9+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26 5:55 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, Wolfram Sang, Feng Tang, Alexander Stein,
linux-i2c, linux-kernel
Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, Tomoya MORINAGA
Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
---
drivers/i2c/busses/i2c-eg20t.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index d73975b..714b070 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -445,7 +445,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
} else {
@@ -469,7 +471,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
@@ -490,7 +494,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
pch_clrbit(adap->pch_base_address, PCH_I2CSR,
I2CMIF_BIT);
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
}
@@ -598,7 +604,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
pch_i2c_restart(adap);
@@ -621,7 +629,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
} else {
@@ -648,7 +658,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
@@ -677,7 +689,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
return -EIO;
}
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
@@ -698,7 +712,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
return -EIO;
}
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] i2c-eg20t: change timeout value 50msec to 1000msec
[not found] ` <1332741325-7746-1-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-03-26 5:55 ` Tomoya MORINAGA
[not found] ` <1332741325-7746-3-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-18 14:58 ` [PATCH 1/3] i2c-eg20t: Modify MODULE_AUTHOR's email address Wolfram Sang
1 sibling, 1 reply; 9+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26 5:55 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, Wolfram Sang, Feng Tang, Alexander Stein,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: qi.wang-ral2JQCrhuEAvxtiuMwx3w,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w, Tomoya MORINAGA
Currently, during i2c works alone, wait-event timeout is not occurred.
However, as CPU load increases, timeout occurs frequently.
So, I modified like this patch.
Modifying like this patch, I've never seen the timeout event with high
load test.
Signed-off-by: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/i2c/busses/i2c-eg20t.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 714b070..ec8f4fa 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -324,7 +324,7 @@ static s32 pch_i2c_wait_for_xfer_complete(struct i2c_algo_pch_data *adap)
{
long ret;
ret = wait_event_timeout(pch_event,
- (adap->pch_event_flag != 0), msecs_to_jiffies(50));
+ (adap->pch_event_flag != 0), msecs_to_jiffies(1000));
if (ret == 0) {
pch_err(adap, "timeout: %x\n", adap->pch_event_flag);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3 v2] i2c-eg20t: Call init() when wait-event timeout occurs
[not found] ` <1332741325-7746-2-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-03-26 6:34 ` Tomoya MORINAGA
2012-04-18 15:05 ` [PATCH 2/3] " Wolfram Sang
1 sibling, 0 replies; 9+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26 6:34 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, Wolfram Sang, Feng Tang, Alexander Stein,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: qi.wang-ral2JQCrhuEAvxtiuMwx3w,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w, Tomoya MORINAGA
v1 had checkpatch warnings.
Signed-off-by: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
v2
- Updated for checkpatch
---
drivers/i2c/busses/i2c-eg20t.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index d73975b..0e3a89f 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -445,7 +445,10 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n",
+ __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
} else {
@@ -469,7 +472,10 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n",
+ __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
@@ -490,7 +496,10 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
pch_clrbit(adap->pch_base_address, PCH_I2CSR,
I2CMIF_BIT);
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n",
+ __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
}
@@ -598,7 +607,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n",
+ __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
pch_i2c_restart(adap);
@@ -621,7 +633,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n",
+ __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
} else {
@@ -648,7 +663,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n",
+ __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
@@ -677,7 +695,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
return -EIO;
}
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n",
+ __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
@@ -698,7 +719,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
return -EIO;
}
} else { /* wait-event timeout */
+ pch_err(adap, "%s(L.%d):wait-event timeout\n",
+ __func__, __LINE__);
pch_i2c_stop(adap);
+ pch_i2c_init(adap);
return -ETIME;
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] i2c-eg20t: Modify MODULE_AUTHOR's email address
[not found] ` <1332741325-7746-1-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-03-26 5:55 ` [PATCH 3/3] i2c-eg20t: change timeout value 50msec to 1000msec Tomoya MORINAGA
@ 2012-04-18 14:58 ` Wolfram Sang
1 sibling, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2012-04-18 14:58 UTC (permalink / raw)
To: Tomoya MORINAGA
Cc: Jean Delvare, Ben Dooks, Feng Tang, Alexander Stein,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
qi.wang-ral2JQCrhuEAvxtiuMwx3w,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w
[-- Attachment #1: Type: text/plain, Size: 329 bytes --]
On Mon, Mar 26, 2012 at 02:55:23PM +0900, Tomoya MORINAGA wrote:
>
> Signed-off-by: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Applied.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] i2c-eg20t: change timeout value 50msec to 1000msec
[not found] ` <1332741325-7746-3-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-04-18 15:00 ` Wolfram Sang
0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2012-04-18 15:00 UTC (permalink / raw)
To: Tomoya MORINAGA
Cc: Jean Delvare, Ben Dooks, Feng Tang, Alexander Stein,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
qi.wang-ral2JQCrhuEAvxtiuMwx3w,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]
On Mon, Mar 26, 2012 at 02:55:25PM +0900, Tomoya MORINAGA wrote:
> Currently, during i2c works alone, wait-event timeout is not occurred.
> However, as CPU load increases, timeout occurs frequently.
> So, I modified like this patch.
> Modifying like this patch, I've never seen the timeout event with high
> load test.
>
> Signed-off-by: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Applied. (I think we need to clarify the timeouts in I2C, but for now
this has to do.)
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs
[not found] ` <1332741325-7746-2-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-03-26 6:34 ` [PATCH 2/3 v2] " Tomoya MORINAGA
@ 2012-04-18 15:05 ` Wolfram Sang
[not found] ` <20120418150544.GE19802-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
1 sibling, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2012-04-18 15:05 UTC (permalink / raw)
To: Tomoya MORINAGA
Cc: Jean Delvare, Ben Dooks, Feng Tang, Alexander Stein,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
qi.wang-ral2JQCrhuEAvxtiuMwx3w,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w
[-- Attachment #1: Type: text/plain, Size: 4814 bytes --]
On Mon, Mar 26, 2012 at 02:55:24PM +0900, Tomoya MORINAGA wrote:
>
> Signed-off-by: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Woha, that's copy&paste code all over. May I ask to refactor this?
Something like:
rtn = pch_..._wait_for_checked_xfer();
if (rtn)
return rtn;
// All the things you have to do when rtn == 0
in that new function (the name was only a suugestion), you can do all
the checks which are now copy-pasted, e.g.:
458 rtn = pch_i2c_wait_for_xfer_complete(adap);
459 if (rtn == 0) {
460 if (pch_i2c_getack(adap)) {
461 pch_dbg(adap, "Receive NACK for slave address"
462 "setting\n");
463 return -EIO;
464 }
465 } else if (rtn == -EIO) { /* Arbitration Lost */
466 pch_err(adap, "Lost Arbitration\n");
467 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT);
468 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
469 pch_i2c_init(adap);
470 return -EAGAIN;
471 } else { /* wait-event timeout */
472 pch_i2c_stop(adap);
// Your current fixes added here
473 return -ETIME;
474 }
return 0;
It is only pseudo-code, but I think it can be done and will help the driver.
Thanks,
Wolfram
> ---
> drivers/i2c/busses/i2c-eg20t.c | 16 ++++++++++++++++
> 1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
> index d73975b..714b070 100644
> --- a/drivers/i2c/busses/i2c-eg20t.c
> +++ b/drivers/i2c/busses/i2c-eg20t.c
> @@ -445,7 +445,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
> pch_i2c_init(adap);
> return -EAGAIN;
> } else { /* wait-event timeout */
> + pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
> pch_i2c_stop(adap);
> + pch_i2c_init(adap);
> return -ETIME;
> }
> } else {
> @@ -469,7 +471,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
> pch_i2c_init(adap);
> return -EAGAIN;
> } else { /* wait-event timeout */
> + pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
> pch_i2c_stop(adap);
> + pch_i2c_init(adap);
> return -ETIME;
> }
>
> @@ -490,7 +494,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
> pch_clrbit(adap->pch_base_address, PCH_I2CSR,
> I2CMIF_BIT);
> } else { /* wait-event timeout */
> + pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
> pch_i2c_stop(adap);
> + pch_i2c_init(adap);
> return -ETIME;
> }
> }
> @@ -598,7 +604,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
> pch_i2c_init(adap);
> return -EAGAIN;
> } else { /* wait-event timeout */
> + pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
> pch_i2c_stop(adap);
> + pch_i2c_init(adap);
> return -ETIME;
> }
> pch_i2c_restart(adap);
> @@ -621,7 +629,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
> pch_i2c_init(adap);
> return -EAGAIN;
> } else { /* wait-event timeout */
> + pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
> pch_i2c_stop(adap);
> + pch_i2c_init(adap);
> return -ETIME;
> }
> } else {
> @@ -648,7 +658,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
> pch_i2c_init(adap);
> return -EAGAIN;
> } else { /* wait-event timeout */
> + pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
> pch_i2c_stop(adap);
> + pch_i2c_init(adap);
> return -ETIME;
> }
>
> @@ -677,7 +689,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
> return -EIO;
> }
> } else { /* wait-event timeout */
> + pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
> pch_i2c_stop(adap);
> + pch_i2c_init(adap);
> return -ETIME;
> }
>
> @@ -698,7 +712,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
> return -EIO;
> }
> } else { /* wait-event timeout */
> + pch_err(adap, "%s(L.%d):wait-event timeout\n", __func__, __LINE__);
> pch_i2c_stop(adap);
> + pch_i2c_init(adap);
> return -ETIME;
> }
>
> --
> 1.7.7.6
>
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs
[not found] ` <20120418150544.GE19802-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2012-04-19 6:19 ` Tomoya MORINAGA
[not found] ` <CANKRQng5nb0nU_e1o6TLnvOwPoXX1C_bJguNyjrsVfo+mubKaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Tomoya MORINAGA @ 2012-04-19 6:19 UTC (permalink / raw)
To: Wolfram Sang
Cc: Jean Delvare, Ben Dooks, Feng Tang, Alexander Stein,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
qi.wang-ral2JQCrhuEAvxtiuMwx3w,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w
On Thu, Apr 19, 2012 at 12:05 AM, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> On Mon, Mar 26, 2012 at 02:55:24PM +0900, Tomoya MORINAGA wrote:
>>
>> Signed-off-by: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> Woha, that's copy&paste code all over. May I ask to refactor this?
> Something like:
>
> rtn = pch_..._wait_for_checked_xfer();
> if (rtn)
> return rtn;
> // All the things you have to do when rtn == 0
>
> in that new function (the name was only a suugestion), you can do all
> the checks which are now copy-pasted, e.g.:
>
> 458 rtn = pch_i2c_wait_for_xfer_complete(adap);
> 459 if (rtn == 0) {
> 460 if (pch_i2c_getack(adap)) {
> 461 pch_dbg(adap, "Receive NACK for slave address"
> 462 "setting\n");
> 463 return -EIO;
> 464 }
> 465 } else if (rtn == -EIO) { /* Arbitration Lost */
> 466 pch_err(adap, "Lost Arbitration\n");
> 467 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT);
> 468 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
> 469 pch_i2c_init(adap);
> 470 return -EAGAIN;
> 471 } else { /* wait-event timeout */
> 472 pch_i2c_stop(adap);
> // Your current fixes added here
> 473 return -ETIME;
> 474 }
> return 0;
>
> It is only pseudo-code, but I think it can be done and will help the driver.
>
OK.
I'm ready to submit new patch you are saying.
So, firstly, could you accept this patch ?
After your accept, new patch series can be applicable.
thanks.
--
ROHM Co., Ltd.
tomoya
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs
[not found] ` <CANKRQng5nb0nU_e1o6TLnvOwPoXX1C_bJguNyjrsVfo+mubKaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-04-20 20:37 ` Wolfram Sang
0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2012-04-20 20:37 UTC (permalink / raw)
To: Tomoya MORINAGA
Cc: Jean Delvare, Ben Dooks, Feng Tang, Alexander Stein,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
qi.wang-ral2JQCrhuEAvxtiuMwx3w,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w
[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]
On Thu, Apr 19, 2012 at 03:19:14PM +0900, Tomoya MORINAGA wrote:
> On Thu, Apr 19, 2012 at 12:05 AM, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> > On Mon, Mar 26, 2012 at 02:55:24PM +0900, Tomoya MORINAGA wrote:
> >>
> >> Signed-off-by: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >
> > Woha, that's copy&paste code all over. May I ask to refactor this?
> > Something like:
> >
> > rtn = pch_..._wait_for_checked_xfer();
> > if (rtn)
> > return rtn;
> > // All the things you have to do when rtn == 0
> >
> > in that new function (the name was only a suugestion), you can do all
> > the checks which are now copy-pasted, e.g.:
> >
> > 458 rtn = pch_i2c_wait_for_xfer_complete(adap);
> > 459 if (rtn == 0) {
> > 460 if (pch_i2c_getack(adap)) {
> > 461 pch_dbg(adap, "Receive NACK for slave address"
> > 462 "setting\n");
> > 463 return -EIO;
> > 464 }
> > 465 } else if (rtn == -EIO) { /* Arbitration Lost */
> > 466 pch_err(adap, "Lost Arbitration\n");
> > 467 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT);
> > 468 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
> > 469 pch_i2c_init(adap);
> > 470 return -EAGAIN;
> > 471 } else { /* wait-event timeout */
> > 472 pch_i2c_stop(adap);
> > // Your current fixes added here
> > 473 return -ETIME;
> > 474 }
> > return 0;
> >
> > It is only pseudo-code, but I think it can be done and will help the driver.
> >
>
> OK.
> I'm ready to submit new patch you are saying.
Applied to next, thanks to the follow up patches :)
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-04-20 20:37 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-26 5:55 [PATCH 1/3] i2c-eg20t: Modify MODULE_AUTHOR's email address Tomoya MORINAGA
2012-03-26 5:55 ` [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs Tomoya MORINAGA
[not found] ` <1332741325-7746-2-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-03-26 6:34 ` [PATCH 2/3 v2] " Tomoya MORINAGA
2012-04-18 15:05 ` [PATCH 2/3] " Wolfram Sang
[not found] ` <20120418150544.GE19802-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-04-19 6:19 ` Tomoya MORINAGA
[not found] ` <CANKRQng5nb0nU_e1o6TLnvOwPoXX1C_bJguNyjrsVfo+mubKaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-20 20:37 ` Wolfram Sang
[not found] ` <1332741325-7746-1-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-03-26 5:55 ` [PATCH 3/3] i2c-eg20t: change timeout value 50msec to 1000msec Tomoya MORINAGA
[not found] ` <1332741325-7746-3-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-18 15:00 ` Wolfram Sang
2012-04-18 14:58 ` [PATCH 1/3] i2c-eg20t: Modify MODULE_AUTHOR's email address Wolfram Sang
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).