[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <576FD940.4070102@ti.com>
Date: Sun, 26 Jun 2016 08:31:44 -0500
From: Nishanth Menon <nm@...com>
To: Guenter Roeck <linux@...ck-us.net>,
Jean Delvare <jdelvare@...e.com>
CC: <linux-hwmon@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Eduardo Valentin <edubezval@...il.com>,
Zhang Rui <rui.zhang@...el.com>
Subject: Re: [PATCH v2 3/5] hwmon: (tmp102) Improve handling of initial read
delay
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
Powered by blists - more mailing lists