From 339b0a62655d1bae08a8c31c6ad1bd007a044a27 Mon Sep 17 00:00:00 2001 From: Jonas Woerner Date: Tue, 14 May 2024 14:09:51 +0200 Subject: [PATCH] drivers: sensor: fix PM Implementation for LM75 temperature sensor fixes the driver always returning -EIO if PM_DEVICE_RUNTIME is enabled. Signed-off-by: Jonas Woerner --- drivers/sensor/lm75/lm75.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/sensor/lm75/lm75.c b/drivers/sensor/lm75/lm75.c index e01a691a58e6d83..11c2b64d875e75b 100644 --- a/drivers/sensor/lm75/lm75.c +++ b/drivers/sensor/lm75/lm75.c @@ -64,12 +64,10 @@ static int lm75_sample_fetch(const struct device *dev, { struct lm75_data *data = dev->data; const struct lm75_config *cfg = dev->config; - enum pm_device_state pm_state; int ret; - - (void)pm_device_state_get(dev, &pm_state); - if (pm_state != PM_DEVICE_STATE_ACTIVE) { - ret = -EIO; + + ret = pm_device_runtime_get(dev); + if (ret < 0) { return ret; } @@ -83,6 +81,7 @@ static int lm75_sample_fetch(const struct device *dev, break; } + pm_device_runtime_put(dev); return ret; }