public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Troy Kisky <troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Kevin Hilman <khilman-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH] i2c-davinci: Fix timeout handling
Date: Tue, 24 Feb 2009 11:49:40 -0700	[thread overview]
Message-ID: <49A44144.8000803@boundarydevices.com> (raw)
In-Reply-To: <20090223150554.203437b3-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>

Jean Delvare wrote:
> Properly set the adapter timeout value in jiffies, and then use that
> value in the driver, rather than a hard-coded constant.
> 
> Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: Troy Kisky <troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org>
> Cc: Kevin Hilman <khilman-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
> ---
> Troy, Kevin, can either of you please review, build test and run test
> this patch? Thanks.
> 
>  drivers/i2c/busses/i2c-davinci.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> --- linux-2.6.29-rc6.orig/drivers/i2c/busses/i2c-davinci.c	2009-02-23 08:50:47.000000000 +0100
> +++ linux-2.6.29-rc6/drivers/i2c/busses/i2c-davinci.c	2009-02-23 14:56:17.000000000 +0100
> @@ -216,7 +216,7 @@ static int i2c_davinci_wait_bus_not_busy
>  {
>  	unsigned long timeout;
>  
> -	timeout = jiffies + DAVINCI_I2C_TIMEOUT;
> +	timeout = jiffies + dev->adapter.timeout;
>  	while (davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG)
>  	       & DAVINCI_I2C_STR_BB) {
>  		if (time_after(jiffies, timeout)) {
> @@ -289,7 +289,7 @@ i2c_davinci_xfer_msg(struct i2c_adapter
>  	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
>  
>  	r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
> -						      DAVINCI_I2C_TIMEOUT);
> +						      dev->adapter.timeout);
>  	if (r == 0) {
>  		dev_err(dev->dev, "controller timed out\n");
>  		i2c_davinci_init(dev);
> @@ -546,9 +546,7 @@ static int davinci_i2c_probe(struct plat
>  	strlcpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name));
>  	adap->algo = &i2c_davinci_algo;
>  	adap->dev.parent = &pdev->dev;
> -
> -	/* FIXME */
> -	adap->timeout = 1;
> +	adap->timeout = DAVINCI_I2C_TIMEOUT;
>  
>  	adap->nr = pdev->id;
>  	r = i2c_add_numbered_adapter(adap);
> 
I tested this without issues.

Thanks
Troy

      parent reply	other threads:[~2009-02-24 18:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-23 14:05 [PATCH] i2c-davinci: Fix timeout handling Jean Delvare
     [not found] ` <20090223150554.203437b3-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-02-24 18:49   ` Troy Kisky [this message]

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=49A44144.8000803@boundarydevices.com \
    --to=troy.kisky-q5rjgjkts06cy9shamctrueocmrvltnr@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=khilman-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox