Skip to content

Commit

Permalink
nzxt-kraken3: Add a timeout to the secondary reader wait_event call
Browse files Browse the repository at this point in the history
In the unlikely case that a reader gets stuck there under
weird circumstances, give it an automatic way out.

Signed-off-by: Aleksa Savic <[email protected]>
  • Loading branch information
aleksamagicka committed Oct 1, 2023
1 parent 05f50e2 commit a9b09a6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nzxt-kraken3.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,10 @@ static int kraken3_read(struct device *dev, enum hwmon_sensor_types type, u32 at
if (ret < 0)
return ret;
} else {
/* Wait for the main reader */
if (wait_event_interruptible
(priv->z53_reader_wq, priv->z53_status_processed))
/* Wait for the main reader with a timeout of 2 * STATUS_VALIDITY */
if (wait_event_interruptible_timeout
(priv->z53_reader_wq, priv->z53_status_processed,
msecs_to_jiffies(2 * STATUS_VALIDITY * 1000)) <= 0)
return -ENODATA;

/* Return saved error code if reader failed in some way */
Expand Down

0 comments on commit a9b09a6

Please sign in to comment.