Skip to content

Commit

Permalink
drivers: sensor: fix PM Implementation for LM75 temperature sensor
Browse files Browse the repository at this point in the history
fixes the driver always returning -EIO  if PM_DEVICE_RUNTIME is enabled.

Signed-off-by: Jonas Woerner <[email protected]>
  • Loading branch information
CodingGhost committed May 31, 2024
1 parent 71b7101 commit 339b0a6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/sensor/lm75/lm75.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -83,6 +81,7 @@ static int lm75_sample_fetch(const struct device *dev,
break;
}

pm_device_runtime_put(dev);
return ret;
}

Expand Down

0 comments on commit 339b0a6

Please sign in to comment.