* [PATCH v2 0/1] hwmon: (asus-ec-sensors) fix EC read intervals
@ 2026-07-12 11:05 Eugene Shalygin
2026-07-12 11:05 ` [PATCH v2 1/1] " Eugene Shalygin
0 siblings, 1 reply; 3+ messages in thread
From: Eugene Shalygin @ 2026-07-12 11:05 UTC (permalink / raw)
To: eugene.shalygin
Cc: Guenter Roeck, open list:ASUS EC HARDWARE MONITOR DRIVER, open list
v2: revret updating `state->next_update` before the update_ec_sensors()
call.
Eugene Shalygin (1):
hwmon: (asus-ec-sensors) fix EC read intervals
drivers/hwmon/asus-ec-sensors.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/1] hwmon: (asus-ec-sensors) fix EC read intervals
2026-07-12 11:05 [PATCH v2 0/1] hwmon: (asus-ec-sensors) fix EC read intervals Eugene Shalygin
@ 2026-07-12 11:05 ` Eugene Shalygin
2026-07-19 14:13 ` Guenter Roeck
0 siblings, 1 reply; 3+ messages in thread
From: Eugene Shalygin @ 2026-07-12 11:05 UTC (permalink / raw)
To: eugene.shalygin
Cc: Guenter Roeck, open list:ASUS EC HARDWARE MONITOR DRIVER, open list
Take INITIAL_JIFFIES into account when setting up next update time.
Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com>
Fixes: d0ddfd241e57 ("hwmon: (asus-ec-sensors) add driver for ASUS EC")
---
drivers/hwmon/asus-ec-sensors.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
index 29a23484cbe7..eb71e41fd4f4 100644
--- a/drivers/hwmon/asus-ec-sensors.c
+++ b/drivers/hwmon/asus-ec-sensors.c
@@ -1009,7 +1009,7 @@ struct ec_sensors_data {
/* sorted list of unique register banks */
u8 banks[ASUS_EC_MAX_BANK + 1];
/* in jiffies */
- unsigned long last_updated;
+ u64 next_update;
struct lock_data lock_data;
/* number of board EC sensors */
u8 nr_sensors;
@@ -1278,13 +1278,12 @@ static int get_cached_value_or_update(const struct device *dev,
int sensor_index,
struct ec_sensors_data *state, s32 *value)
{
- if (time_after(jiffies, state->last_updated + HZ)) {
+ if (time_after64(get_jiffies_64(), state->next_update)) {
if (update_ec_sensors(dev, state)) {
dev_err(dev, "update_ec_sensors() failure\n");
return -EIO;
}
-
- state->last_updated = jiffies;
+ state->next_update = get_jiffies_64() + HZ;
}
*value = state->sensors[sensor_index].cached_value;
@@ -1402,6 +1401,7 @@ static int asus_ec_probe(struct platform_device *pdev)
if (!ec_data)
return -ENOMEM;
+ ec_data->next_update = INITIAL_JIFFIES;
dev_set_drvdata(dev, ec_data);
ec_data->board_info = pboard_info;
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] hwmon: (asus-ec-sensors) fix EC read intervals
2026-07-12 11:05 ` [PATCH v2 1/1] " Eugene Shalygin
@ 2026-07-19 14:13 ` Guenter Roeck
0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2026-07-19 14:13 UTC (permalink / raw)
To: Eugene Shalygin; +Cc: open list:ASUS EC HARDWARE MONITOR DRIVER, open list
On Sun, Jul 12, 2026 at 01:05:03PM +0200, Eugene Shalygin wrote:
> Take INITIAL_JIFFIES into account when setting up next update time.
>
> Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com>
>
> Fixes: d0ddfd241e57 ("hwmon: (asus-ec-sensors) add driver for ASUS EC")
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/asus-ec-sensors.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
> index 29a23484cbe7..eb71e41fd4f4 100644
> --- a/drivers/hwmon/asus-ec-sensors.c
> +++ b/drivers/hwmon/asus-ec-sensors.c
> @@ -1009,7 +1009,7 @@ struct ec_sensors_data {
> /* sorted list of unique register banks */
> u8 banks[ASUS_EC_MAX_BANK + 1];
> /* in jiffies */
> - unsigned long last_updated;
> + u64 next_update;
> struct lock_data lock_data;
> /* number of board EC sensors */
> u8 nr_sensors;
> @@ -1278,13 +1278,12 @@ static int get_cached_value_or_update(const struct device *dev,
> int sensor_index,
> struct ec_sensors_data *state, s32 *value)
> {
> - if (time_after(jiffies, state->last_updated + HZ)) {
> + if (time_after64(get_jiffies_64(), state->next_update)) {
> if (update_ec_sensors(dev, state)) {
> dev_err(dev, "update_ec_sensors() failure\n");
> return -EIO;
> }
> -
> - state->last_updated = jiffies;
> + state->next_update = get_jiffies_64() + HZ;
> }
>
> *value = state->sensors[sensor_index].cached_value;
> @@ -1402,6 +1401,7 @@ static int asus_ec_probe(struct platform_device *pdev)
> if (!ec_data)
> return -ENOMEM;
>
> + ec_data->next_update = INITIAL_JIFFIES;
> dev_set_drvdata(dev, ec_data);
> ec_data->board_info = pboard_info;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-19 14:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-12 11:05 [PATCH v2 0/1] hwmon: (asus-ec-sensors) fix EC read intervals Eugene Shalygin
2026-07-12 11:05 ` [PATCH v2 1/1] " Eugene Shalygin
2026-07-19 14:13 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome