Skip to content

Commit 598de06

Browse files
casparfriedrichcarlescufi
authored andcommitted
drivers: ds2484: Fix wrong early exit during suspend/resume
The sleep pin is optional and the driver checks for availability during runtime. Currently the logic is inverted and therefore the driver exits early if the pin is actually available. This pr fixes this behavior. Also: Add `fallthrough` flags to switch/case Signed-off-by: Caspar Friedrich <[email protected]>
1 parent b0564df commit 598de06

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/w1/w1_ds2484.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,16 @@ static int ds2484_pm_control(const struct device *dev, enum pm_device_action act
9191

9292
switch (action) {
9393
case PM_DEVICE_ACTION_SUSPEND:
94-
if (config->slpz_spec.port) {
94+
if (!config->slpz_spec.port) {
9595
return -ENOTSUP;
9696
}
9797
return gpio_pin_set_dt(&config->slpz_spec, 1);
9898
case PM_DEVICE_ACTION_RESUME:
99-
if (config->slpz_spec.port) {
99+
if (!config->slpz_spec.port) {
100100
return -ENOTSUP;
101101
}
102102
return gpio_pin_set_dt(&config->slpz_spec, 0);
103-
case PM_DEVICE_ACTION_TURN_OFF:
104-
case PM_DEVICE_ACTION_TURN_ON:
105-
case PM_DEVICE_ACTION_FORCE_SUSPEND:
103+
default:
106104
return -ENOTSUP;
107105
};
108106

0 commit comments

Comments
 (0)