Skip to contentSkip to conversation

hwmon: (tmp421) Allow reading at 2Hz instead of 0.5Hz

PATCH Applied Kyle Roeschley 2 participants 2 messages Oct 14, 2019 – Oct 17, 2019 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (tmp421) Allow reading at 2Hz instead of 0.5Hz

Our driver configures the device to read at 2Hz, but then only allows the user to read cached temp values at up to 0.5Hz. Let's allow users to read as quickly as we do.

---
 drivers/hwmon/tmp421.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hwmon/tmp421.c +2 -1
index a94e35cff3e5..83a4fab151d2 100644
@@ -127,7 +127,8 @@ static struct tmp421_data *tmp421_update_device(struct device *dev)
 
 	mutex_lock(&data->update_lock);
 
-	if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + (HZ / 2)) ||
+	    !data->valid) {
 		data->config = i2c_smbus_read_byte_data(client,
 			TMP421_CONFIG_REG_1);
 
Signature · 1 line
2.23.0.rc1
maintainer Applied
#1 lore raw
Quoted 5 lines · Kyle Roeschley

Our driver configures the device to read at 2Hz, but then only allows the user to read cached temp values at up to 0.5Hz. Let's allow users to read as quickly as we do.

Applied.

Thanks,
Guenter

Quoted 18 lines
---
 drivers/hwmon/tmp421.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hwmon/tmp421.c +2 -1
index a94e35cff3e5..83a4fab151d2 100644
@@ -127,7 +127,8 @@ static struct tmp421_data *tmp421_update_device(struct device *dev)
 
 	mutex_lock(&data->update_lock);
 
-	if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + (HZ / 2)) ||
+	    !data->valid) {
 		data->config = i2c_smbus_read_byte_data(client,
 			TMP421_CONFIG_REG_1);