All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Ben Dooks <ben-linux@fluff.org>
Cc: Sascha Hauer <sha@pengutronix.de>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] i2c-imx: do not allow interruptions when waiting for I2C to complete (resend)
Date: Mon, 21 Jun 2010 09:07:51 +0200	[thread overview]
Message-ID: <4C1F0FC7.60605@pengutronix.de> (raw)
In-Reply-To: <20100620223321.GA12387@fluff.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

Ben Dooks wrote:
> On Tue, Jun 15, 2010 at 12:20:38PM +0200, Marc Kleine-Budde wrote:
>> The i2c_imx_trx_complete() 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 receives a signal, the wait will be
>> interrupted, returning an error. It is better to let the I2C operation
>> finished before handling the signal (i.e. returning into userspace).
>>
>> 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.
> 
> Hmm, if it times out, do you need to at-least try sending a stop
> on the bus? or does the caller do that for you?

The caller of the caller does this. "i2c_imx_xfer" will call
"i2c_imx_stop", and this function will generate the stop condition if
not already done so.

I'm sending a V3 version of the patch, which removes the only written to
variable "result".

cheers, Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
Cc: Sascha Hauer <sha-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V2] i2c-imx: do not allow interruptions when waiting for I2C to complete (resend)
Date: Mon, 21 Jun 2010 09:07:51 +0200	[thread overview]
Message-ID: <4C1F0FC7.60605@pengutronix.de> (raw)
In-Reply-To: <20100620223321.GA12387-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

Ben Dooks wrote:
> On Tue, Jun 15, 2010 at 12:20:38PM +0200, Marc Kleine-Budde wrote:
>> The i2c_imx_trx_complete() 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 receives a signal, the wait will be
>> interrupted, returning an error. It is better to let the I2C operation
>> finished before handling the signal (i.e. returning into userspace).
>>
>> 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.
> 
> Hmm, if it times out, do you need to at-least try sending a stop
> on the bus? or does the caller do that for you?

The caller of the caller does this. "i2c_imx_xfer" will call
"i2c_imx_stop", and this function will generate the stop condition if
not already done so.

I'm sending a V3 version of the patch, which removes the only written to
variable "result".

cheers, Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2010-06-21  7:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 10:20 [PATCH V2] i2c-imx: do not allow interruptions when waiting for I2C to complete (resend) Marc Kleine-Budde
2010-06-15 10:20 ` Marc Kleine-Budde
2010-06-20 22:33 ` Ben Dooks
2010-06-21  7:07   ` Marc Kleine-Budde [this message]
2010-06-21  7:07     ` Marc Kleine-Budde
     [not found]     ` <4C1F0FC7.60605-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-06-21  7:27       ` [PATCH V3] i2c-imx: do not allow interruptions when waiting for I2C to complete Marc Kleine-Budde
2010-07-15  7:49       ` [PATCH V3 RESEND] " Marc Kleine-Budde
2010-07-19  8:11       ` [PATCH V3 RESEND2] " Marc Kleine-Budde
2010-09-15 11:45       ` [PATCH V3 RESEND3] " Marc Kleine-Budde
2010-09-24 14:50       ` [PATCH V3 RESEND4] " Marc Kleine-Budde
     [not found]         ` <4C9CBAA1.5040202-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-09-28  9:05           ` Wolfram Sang
2010-10-04 14:22       ` [PATCH V3 RESEND5] " Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C1F0FC7.60605@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=ben-linux@fluff.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sha@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.