linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Wolfram Sang <wsa@the-dreams.de>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] i2c: piix4: Use usleep_range()
Date: Thu, 1 Mar 2018 12:04:04 +0100	[thread overview]
Message-ID: <20180301120404.42f10064@endymion> (raw)
In-Reply-To: <1519678013-32749-1-git-send-email-linux@roeck-us.net>

On Mon, 26 Feb 2018 12:46:52 -0800, Guenter Roeck wrote:
> The piix4 i2c driver is extremely slow. Replacing msleep()
> with usleep_range() increases its speed substantially.
> Use sleep ranges similar to those used in the i2c-801 driver
> to keep things simple.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: Changed timeout values for usleep_range()
>     2000/2000 -> 2000/2100
>     500/1000 -> 250/500
>     200/500 -> 250/500
> 
>  drivers/i2c/busses/i2c-piix4.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
> index 462948e2c535..4c1f6aaec0fc 100644
> --- a/drivers/i2c/busses/i2c-piix4.c
> +++ b/drivers/i2c/busses/i2c-piix4.c
> @@ -462,13 +462,13 @@ static int piix4_transaction(struct i2c_adapter *piix4_adapter)
>  
>  	/* We will always wait for a fraction of a second! (See PIIX4 docs errata) */
>  	if (srvrworks_csb5_delay) /* Extra delay for SERVERWORKS_CSB5 */
> -		msleep(2);
> +		usleep_range(2000, 2100);
>  	else
> -		msleep(1);
> +		usleep_range(250, 500);
>  
>  	while ((++timeout < MAX_TIMEOUT) &&
>  	       ((temp = inb_p(SMBHSTSTS)) & 0x01))
> -		msleep(1);
> +		usleep_range(250, 500);
>  
>  	/* If the SMBus is still busy, we give up */
>  	if (timeout == MAX_TIMEOUT) {

Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
SUSE L3 Support

  parent reply	other threads:[~2018-03-01 11:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 20:46 [PATCH v2 1/2] i2c: piix4: Use usleep_range() Guenter Roeck
2018-02-26 20:46 ` [PATCH v2 2/2] i2c: piix4: Use request_muxed_region Guenter Roeck
2018-02-26 20:52   ` Wolfram Sang
2018-02-26 21:34     ` Guenter Roeck
2018-02-26 21:43       ` Wolfram Sang
2018-02-26 21:44         ` Wolfram Sang
2018-02-26 22:28           ` Guenter Roeck
2018-02-26 22:28         ` Guenter Roeck
2018-03-01 10:57   ` Jean Delvare
2018-03-02 10:17   ` Wolfram Sang
2018-03-01 11:04 ` Jean Delvare [this message]
2018-03-02 10:17 ` [PATCH v2 1/2] i2c: piix4: Use usleep_range() Wolfram Sang

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=20180301120404.42f10064@endymion \
    --to=jdelvare@suse.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wsa@the-dreams.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 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).