Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1431501

Re: [PATCH v2 3/5] hwmon: (tmp102) Improve handling of initial read delay

From Nishanth Menon <nm@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 3/5] hwmon: (tmp102) Improve handling of initial read delay
Date 2016-06-26 15:40 +0200
Message-ID <rOis1-3vu-11@gated-at.bofh.it> (permalink)
References <rO8j0-5rJ-13@gated-at.bofh.it> <rO8j0-5rJ-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 06/25/2016 09:40 PM, Guenter Roeck wrote:
[...]
>  /* convert left adjusted 13-bit TMP102 register value to milliCelsius */
> @@ -78,8 +82,16 @@ static struct tmp102 *tmp102_update_device(struct device *dev)
>  	struct tmp102 *tmp102 = dev_get_drvdata(dev);
>  	struct i2c_client *client = tmp102->client;
>  
> +	/* Is it too early to return a conversion ? */
> +	if (time_before(jiffies, tmp102->ready_time)) {
> +		unsigned long sleeptime = tmp102->ready_time - jiffies;
> +
> +		msleep(jiffies_to_msecs(sleeptime));
> +	}
> +

While msleep can indeed work and simplify, in case of usage for
example with thermal framework, if the data is not ready and we return
-EAGAIN, it lets the thermal framework go and read other sensors
instead of being blocked on the tmp102 conversion of data.

Eduardo, Rui: what is your view on this approach?
Patch: https://patchwork.kernel.org/patch/9198961/

-- 
Regards,
Nishanth Menon

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 3/5] hwmon: (tmp102) Improve handling of initial read delay Guenter Roeck <linux@roeck-us.net> - 2016-06-26 04:50 +0200
  Re: [PATCH v2 3/5] hwmon: (tmp102) Improve handling of initial read  delay Nishanth Menon <nm@ti.com> - 2016-06-26 15:40 +0200
    Re: [PATCH v2 3/5] hwmon: (tmp102) Improve handling of initial read  delay Guenter Roeck <linux@roeck-us.net> - 2016-06-26 16:10 +0200

csiph-web