* [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
@ 2009-02-06 14:00 Timur Tabi
2009-02-10 14:59 ` Timur Tabi
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Timur Tabi @ 2009-02-06 14:00 UTC (permalink / raw)
To: linuxppc-dev, linux-i2c, galak, broonie, mditto
The i2c_wait() function is using wait_event_interruptible_timeout() to wait for
the I2C controller to signal that it has completed an I2C bus operation. If
the process that causes the I2C operation terminated abruptly, the wait will
be interrupted, returning an error. It is better to let the I2C operation
finished before the process exits.
It is safe to use wait_event_timeout() instead, because the timeout will allow
the process to exit if the I2C bus hangs. It's also better to allow the
I2C operation to finish, because unacknowledged I2C operations can cause the
I2C bus to hang.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
A similar change should probably be done to i2c-cpm.c, and maybe all other
I2C drivers. Not many use wait_event_interruptible_timeout().
drivers/i2c/busses/i2c-mpc.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index a9a45fc..c0ace48 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -70,7 +70,7 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id)
/* Read again to allow register to stabilise */
i2c->interrupt = readb(i2c->base + MPC_I2C_SR);
writeb(0, i2c->base + MPC_I2C_SR);
- wake_up_interruptible(&i2c->queue);
+ wake_up(&i2c->queue);
}
return IRQ_HANDLED;
}
@@ -115,13 +115,10 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
writeb(0, i2c->base + MPC_I2C_SR);
} else {
/* Interrupt mode */
- result = wait_event_interruptible_timeout(i2c->queue,
+ result = wait_event_timeout(i2c->queue,
(i2c->interrupt & CSR_MIF), timeout * HZ);
- if (unlikely(result < 0)) {
- pr_debug("I2C: wait interrupted\n");
- writeccr(i2c, 0);
- } else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
+ if (unlikely(!(i2c->interrupt & CSR_MIF))) {
pr_debug("I2C: wait timeout\n");
writeccr(i2c, 0);
result = -ETIMEDOUT;
--
1.5.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-06 14:00 [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete Timur Tabi
@ 2009-02-10 14:59 ` Timur Tabi
2009-02-10 15:55 ` Jean Delvare
2009-02-10 15:11 ` Wolfram Sang
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Timur Tabi @ 2009-02-10 14:59 UTC (permalink / raw)
To: Jean Delvare; +Cc: linuxppc-dev, linux-i2c
On Fri, Feb 6, 2009 at 8:00 AM, Timur Tabi <timur@freescale.com> wrote:
> The i2c_wait() function is using wait_event_interruptible_timeout() to wait for
> the I2C controller to signal that it has completed an I2C bus operation. If
> the process that causes the I2C operation terminated abruptly, the wait will
> be interrupted, returning an error. It is better to let the I2C operation
> finished before the process exits.
>
> It is safe to use wait_event_timeout() instead, because the timeout will allow
> the process to exit if the I2C bus hangs. It's also better to allow the
> I2C operation to finish, because unacknowledged I2C operations can cause the
> I2C bus to hang.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
Jean,
Could you pick up this patch for 2.6.30?
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-06 14:00 [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete Timur Tabi
2009-02-10 14:59 ` Timur Tabi
@ 2009-02-10 15:11 ` Wolfram Sang
2009-02-11 0:17 ` Ben Dooks
2009-02-19 16:41 ` Kumar Gala
3 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2009-02-10 15:11 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, mditto, broonie, linux-i2c
[-- Attachment #1: Type: text/plain, Size: 946 bytes --]
On Fri, Feb 06, 2009 at 08:00:37AM -0600, Timur Tabi wrote:
> The i2c_wait() function is using wait_event_interruptible_timeout() to wait for
> the I2C controller to signal that it has completed an I2C bus operation. If
> the process that causes the I2C operation terminated abruptly, the wait will
> be interrupted, returning an error. It is better to let the I2C operation
> finished before the process exits.
>
> It is safe to use wait_event_timeout() instead, because the timeout will allow
> the process to exit if the I2C bus hangs. It's also better to allow the
> I2C operation to finish, because unacknowledged I2C operations can cause the
> I2C bus to hang.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-10 14:59 ` Timur Tabi
@ 2009-02-10 15:55 ` Jean Delvare
2009-02-10 16:01 ` Timur Tabi
0 siblings, 1 reply; 11+ messages in thread
From: Jean Delvare @ 2009-02-10 15:55 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, linux-i2c, Ben Dooks
On Tue, 10 Feb 2009 08:59:57 -0600, Timur Tabi wrote:
> On Fri, Feb 6, 2009 at 8:00 AM, Timur Tabi <timur@freescale.com> wrote:
> > The i2c_wait() function is using wait_event_interruptible_timeout() to wait for
> > the I2C controller to signal that it has completed an I2C bus operation. If
> > the process that causes the I2C operation terminated abruptly, the wait will
> > be interrupted, returning an error. It is better to let the I2C operation
> > finished before the process exits.
> >
> > It is safe to use wait_event_timeout() instead, because the timeout will allow
> > the process to exit if the I2C bus hangs. It's also better to allow the
> > I2C operation to finish, because unacknowledged I2C operations can cause the
> > I2C bus to hang.
> >
> > Signed-off-by: Timur Tabi <timur@freescale.com>
>
> Jean,
>
> Could you pick up this patch for 2.6.30?
No, that's something for either Ben Dooks (Cc'd) or the powerpc tree.
--
Jean Delvare
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-10 15:55 ` Jean Delvare
@ 2009-02-10 16:01 ` Timur Tabi
2009-02-10 16:10 ` Jean Delvare
0 siblings, 1 reply; 11+ messages in thread
From: Timur Tabi @ 2009-02-10 16:01 UTC (permalink / raw)
To: Jean Delvare; +Cc: linuxppc-dev, Kumar Gala, linux-i2c, Ben Dooks
Jean Delvare wrote:
> No, that's something for either Ben Dooks (Cc'd) or the powerpc tree.
This patch has nothing to do with ARM, so Kumar will pick it up, if you
ACK it.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-10 16:01 ` Timur Tabi
@ 2009-02-10 16:10 ` Jean Delvare
2009-02-10 16:21 ` Timur Tabi
0 siblings, 1 reply; 11+ messages in thread
From: Jean Delvare @ 2009-02-10 16:10 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, Kumar Gala, linux-i2c, Ben Dooks
On Tue, 10 Feb 2009 10:01:54 -0600, Timur Tabi wrote:
> Jean Delvare wrote:
>=20
> > No, that's something for either Ben Dooks (Cc'd) or the powerpc tree.
>=20
> This patch has nothing to do with ARM, so Kumar will pick it up, if you
> ACK it.
Why are you mentioning ARM?
=46rom MAINTAINERS:
I2C SUBSYSTEM
P: Jean Delvare (PC drivers, core)
M: khali@linux-fr.org
P: Ben Dooks (embedded platforms)
M: ben-linux@fluff.org
To the best of my knowledge i2c-mpc falls into the "embedded platforms"
category and is thus under Ben's responsibility.
Thanks,
--=20
Jean Delvare
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-10 16:10 ` Jean Delvare
@ 2009-02-10 16:21 ` Timur Tabi
2009-02-10 16:28 ` Wolfram Sang
2009-02-11 0:16 ` Ben Dooks
0 siblings, 2 replies; 11+ messages in thread
From: Timur Tabi @ 2009-02-10 16:21 UTC (permalink / raw)
To: Jean Delvare; +Cc: linuxppc-dev, Kumar Gala, linux-i2c, Ben Dooks
Jean Delvare wrote:
> To the best of my knowledge i2c-mpc falls into the "embedded platforms"
> category and is thus under Ben's responsibility.
I don't see his Signed-off-by on any patch to i2c-mpc.c for the past
three years (at least). I do see yours, however. You have directly
applied similar patches in the recent past, so of course I will assume
that you would apply this one.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-10 16:21 ` Timur Tabi
@ 2009-02-10 16:28 ` Wolfram Sang
2009-02-11 0:16 ` Ben Dooks
1 sibling, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2009-02-10 16:28 UTC (permalink / raw)
To: Timur Tabi; +Cc: Jean Delvare, linuxppc-dev, Kumar Gala, linux-i2c, Ben Dooks
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
> I don't see his Signed-off-by on any patch to i2c-mpc.c for the past
> three years (at least). I do see yours, however. You have directly
Ben is the I2C-"embedded"-maintainer. This job was created less than
a year ago, this is why you don't see sob from him regarding this
driver.
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-10 16:21 ` Timur Tabi
2009-02-10 16:28 ` Wolfram Sang
@ 2009-02-11 0:16 ` Ben Dooks
1 sibling, 0 replies; 11+ messages in thread
From: Ben Dooks @ 2009-02-11 0:16 UTC (permalink / raw)
To: Timur Tabi; +Cc: Jean Delvare, linuxppc-dev, Kumar Gala, linux-i2c, Ben Dooks
On Tue, Feb 10, 2009 at 10:21:04AM -0600, Timur Tabi wrote:
> Jean Delvare wrote:
>
> > To the best of my knowledge i2c-mpc falls into the "embedded platforms"
> > category and is thus under Ben's responsibility.
>
> I don't see his Signed-off-by on any patch to i2c-mpc.c for the past
> three years (at least). I do see yours, however. You have directly
> applied similar patches in the recent past, so of course I will assume
> that you would apply this one.
My appointment as an embedded maintainer is relatively recent.
I do try and review patches, and sometimes these patches get sent
to another maintainer.
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-06 14:00 [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete Timur Tabi
2009-02-10 14:59 ` Timur Tabi
2009-02-10 15:11 ` Wolfram Sang
@ 2009-02-11 0:17 ` Ben Dooks
2009-02-19 16:41 ` Kumar Gala
3 siblings, 0 replies; 11+ messages in thread
From: Ben Dooks @ 2009-02-11 0:17 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, mditto, broonie, linux-i2c
On Fri, Feb 06, 2009 at 08:00:37AM -0600, Timur Tabi wrote:
> The i2c_wait() function is using wait_event_interruptible_timeout() to wait for
> the I2C controller to signal that it has completed an I2C bus operation. If
> the process that causes the I2C operation terminated abruptly, the wait will
> be interrupted, returning an error. It is better to let the I2C operation
> finished before the process exits.
>
> It is safe to use wait_event_timeout() instead, because the timeout will allow
> the process to exit if the I2C bus hangs. It's also better to allow the
> I2C operation to finish, because unacknowledged I2C operations can cause the
> I2C bus to hang.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
Acked-by: Ben Dooks <ben-linux@fluff.org>
> ---
>
> A similar change should probably be done to i2c-cpm.c, and maybe all other
> I2C drivers. Not many use wait_event_interruptible_timeout().
>
> drivers/i2c/busses/i2c-mpc.c | 9 +++------
> 1 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index a9a45fc..c0ace48 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -70,7 +70,7 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id)
> /* Read again to allow register to stabilise */
> i2c->interrupt = readb(i2c->base + MPC_I2C_SR);
> writeb(0, i2c->base + MPC_I2C_SR);
> - wake_up_interruptible(&i2c->queue);
> + wake_up(&i2c->queue);
> }
> return IRQ_HANDLED;
> }
> @@ -115,13 +115,10 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
> writeb(0, i2c->base + MPC_I2C_SR);
> } else {
> /* Interrupt mode */
> - result = wait_event_interruptible_timeout(i2c->queue,
> + result = wait_event_timeout(i2c->queue,
> (i2c->interrupt & CSR_MIF), timeout * HZ);
>
> - if (unlikely(result < 0)) {
> - pr_debug("I2C: wait interrupted\n");
> - writeccr(i2c, 0);
> - } else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
> + if (unlikely(!(i2c->interrupt & CSR_MIF))) {
> pr_debug("I2C: wait timeout\n");
> writeccr(i2c, 0);
> result = -ETIMEDOUT;
> --
> 1.5.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete
2009-02-06 14:00 [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete Timur Tabi
` (2 preceding siblings ...)
2009-02-11 0:17 ` Ben Dooks
@ 2009-02-19 16:41 ` Kumar Gala
3 siblings, 0 replies; 11+ messages in thread
From: Kumar Gala @ 2009-02-19 16:41 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, broonie, linux-i2c, mditto
On Feb 6, 2009, at 8:00 AM, Timur Tabi wrote:
> The i2c_wait() function is using wait_event_interruptible_timeout()
> to wait for
> the I2C controller to signal that it has completed an I2C bus
> operation. If
> the process that causes the I2C operation terminated abruptly, the
> wait will
> be interrupted, returning an error. It is better to let the I2C
> operation
> finished before the process exits.
>
> It is safe to use wait_event_timeout() instead, because the timeout
> will allow
> the process to exit if the I2C bus hangs. It's also better to allow
> the
> I2C operation to finish, because unacknowledged I2C operations can
> cause the
> I2C bus to hang.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> A similar change should probably be done to i2c-cpm.c, and maybe all
> other
> I2C drivers. Not many use wait_event_interruptible_timeout().
>
> drivers/i2c/busses/i2c-mpc.c | 9 +++------
> 1 files changed, 3 insertions(+), 6 deletions(-)
applied to next
- k
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2009-02-19 16:41 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-06 14:00 [PATCH] i2c-mpc: do not allow interruptions when waiting for I2C to complete Timur Tabi
2009-02-10 14:59 ` Timur Tabi
2009-02-10 15:55 ` Jean Delvare
2009-02-10 16:01 ` Timur Tabi
2009-02-10 16:10 ` Jean Delvare
2009-02-10 16:21 ` Timur Tabi
2009-02-10 16:28 ` Wolfram Sang
2009-02-11 0:16 ` Ben Dooks
2009-02-10 15:11 ` Wolfram Sang
2009-02-11 0:17 ` Ben Dooks
2009-02-19 16:41 ` Kumar Gala
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).