public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: sht3x: set initial jiffies to last_update
@ 2016-07-08  2:46 Matt Ranostay
  2016-07-08  7:56 ` Jean Delvare
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Ranostay @ 2016-07-08  2:46 UTC (permalink / raw)
  To: linux-hwmon; +Cc: Matt Ranostay, Guenter Roeck, David Frey

Handling the wraparound requires the data->last_update to be set to an
initial jiffies value. Otherwise you can start in a state where the
sensor will never request a reading.

Cc: Guenter Roeck <linux@roeck-us.net>
Cc: David Frey <david.frey@sensirion.com>
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
---
 drivers/hwmon/sht3x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c
index 450645b6053d..05a925257938 100644
--- a/drivers/hwmon/sht3x.c
+++ b/drivers/hwmon/sht3x.c
@@ -722,7 +722,7 @@ static int sht3x_probe(struct i2c_client *client,
 	data->setup.blocking_io = false;
 	data->setup.high_precision = true;
 	data->mode = 0;
-	data->last_update = 0;
+	data->last_update = jiffies;
 	data->client = client;
 	crc8_populate_msb(sht3x_crc8_table, SHT3X_CRC8_POLYNOMIAL);
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-25  8:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-08  2:46 [PATCH] hwmon: sht3x: set initial jiffies to last_update Matt Ranostay
2016-07-08  7:56 ` Jean Delvare
2016-07-09  0:22   ` Matt Ranostay
2016-07-21  6:10     ` Jean Delvare
2016-07-24 23:50       ` Matt Ranostay
2016-07-25  8:42         ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox