Linux-Hwmon Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] hwmon: (tmp421) Allow reading at 2Hz instead of 0.5Hz
@ 2019-10-14 14:03 Kyle Roeschley
  2019-10-17 13:41 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Roeschley @ 2019-10-14 14:03 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck; +Cc: linux-hwmon, linux-kernel

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.

Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
---
 drivers/hwmon/tmp421.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index a94e35cff3e5..83a4fab151d2 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -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);
 
-- 
2.23.0.rc1


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

* Re: [PATCH] hwmon: (tmp421) Allow reading at 2Hz instead of 0.5Hz
  2019-10-14 14:03 [PATCH] hwmon: (tmp421) Allow reading at 2Hz instead of 0.5Hz Kyle Roeschley
@ 2019-10-17 13:41 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-10-17 13:41 UTC (permalink / raw)
  To: Kyle Roeschley; +Cc: Jean Delvare, linux-hwmon, linux-kernel

On Mon, Oct 14, 2019 at 09:03:10AM -0500, Kyle Roeschley wrote:
> 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.
> 
> Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/tmp421.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
> index a94e35cff3e5..83a4fab151d2 100644
> --- a/drivers/hwmon/tmp421.c
> +++ b/drivers/hwmon/tmp421.c
> @@ -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);
>  

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 14:03 [PATCH] hwmon: (tmp421) Allow reading at 2Hz instead of 0.5Hz Kyle Roeschley
2019-10-17 13:41 ` Guenter Roeck

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org
	public-inbox-index linux-hwmon

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git