Skip to contentSkip to conversation

hwmon: (sht3x) set initial jiffies to last_update

PATCH Applied Matt Ranostay 3 participants 3 messages Jul 25, 2016 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hwmon: (sht3x) set initial jiffies to last_update

Handling the wraparound requires the data->last_update to be set to an initial jiffies value. Otherwise on 32-bit systems you will not be able to request a reading till the 5 minute jiffies rollover happens.

Cc Guenter Roeck <[email protected]>
Cc David Frey <[email protected]>

---

Changes from v1:
* document more in commit message the reason for the patch
* mark last sample before driver load so initial reading can happen shortly after boot

 drivers/hwmon/sht3x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/sht3x.c +1 -1
index b73a48832732..6ea99cd6ae79 100644
@@ -720,7 +720,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 - msecs_to_jiffies(3000);
 	data->client = client;
 	crc8_populate_msb(sht3x_crc8_table, SHT3X_CRC8_POLYNOMIAL);
 
Signature · 1 line
2.7.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 22 lines · Matt Ranostay

Handling the wraparound requires the data->last_update to be set to an initial jiffies value. Otherwise on 32-bit systems you will not be able to request a reading till the 5 minute jiffies rollover happens.

Cc Guenter Roeck <[email protected]>
Cc David Frey <[email protected]>

---

Changes from v1:
* document more in commit message the reason for the patch
* mark last sample before driver load so initial reading can happen shortly after boot

 drivers/hwmon/sht3x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/sht3x.c +0 -0
index b73a48832732..6ea99cd6ae79 100644

drivers/hwmon/sht3x.c static int sht3x_probe(struct i2c_client *client, · line 726

Quoted 8 lines
drivers/hwmon/sht3x.c +1 -1
@@ -720,7 +720,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 - msecs_to_jiffies(3000);
 	data->client = client;
 	crc8_populate_msb(sht3x_crc8_table, SHT3X_CRC8_POLYNOMIAL);
 
Signature · 2 lines
Jean Delvare
SUSE L3 Support
maintainer Applied
#2 lore raw
In reply to Matt Ranostay
Quoted 7 lines · Matt Ranostay

Handling the wraparound requires the data->last_update to be set to an initial jiffies value. Otherwise on 32-bit systems you will not be able to request a reading till the 5 minute jiffies rollover happens.

Cc Guenter Roeck <[email protected]>
Cc David Frey <[email protected]>

Applied.

Thanks,
Guenter

Quoted 24 lines

---

Changes from v1:
* document more in commit message the reason for the patch
* mark last sample before driver load so initial reading can happen shortly after boot

  drivers/hwmon/sht3x.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/sht3x.c +1 -1
index b73a48832732..6ea99cd6ae79 100644
@@ -720,7 +720,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 - msecs_to_jiffies(3000);
  	data->client = client;
  	crc8_populate_msb(sht3x_crc8_table, SHT3X_CRC8_POLYNOMIAL);