diff --git a/include/pm/device.h b/include/pm/device.h index 78862247aa7..03354aef9e5 100644 --- a/include/pm/device.h +++ b/include/pm/device.h @@ -414,7 +414,7 @@ bool pm_device_is_busy(const struct device *dev); * @retval true If the wakeup source was successfully enabled. * @retval false If the wakeup source was not successfully enabled. */ -bool pm_device_wakeup_enable(struct device *dev, bool enable); +bool pm_device_wakeup_enable(const struct device *dev, bool enable); /** * @brief Check if a device is enabled as a wake up source. @@ -498,7 +498,8 @@ static inline bool pm_device_is_busy(const struct device *dev) ARG_UNUSED(dev); return false; } -static inline bool pm_device_wakeup_enable(struct device *dev, bool enable) +static inline bool pm_device_wakeup_enable(const struct device *dev, + bool enable) { ARG_UNUSED(dev); ARG_UNUSED(enable); diff --git a/subsys/pm/device.c b/subsys/pm/device.c index b1a2e403905..677f3f20971 100644 --- a/subsys/pm/device.c +++ b/subsys/pm/device.c @@ -200,7 +200,7 @@ void pm_device_busy_clear(const struct device *dev) atomic_clear_bit(&pm->flags, PM_DEVICE_FLAG_BUSY); } -bool pm_device_wakeup_enable(struct device *dev, bool enable) +bool pm_device_wakeup_enable(const struct device *dev, bool enable) { atomic_val_t flags, new_flags; struct pm_device *pm = dev->pm; diff --git a/tests/subsys/pm/device_wakeup_api/src/main.c b/tests/subsys/pm/device_wakeup_api/src/main.c index 963c9fa0d22..344cea07c93 100644 --- a/tests/subsys/pm/device_wakeup_api/src/main.c +++ b/tests/subsys/pm/device_wakeup_api/src/main.c @@ -36,8 +36,7 @@ void pm_state_set(enum pm_state state, uint8_t substate_id) /* Enable wakeup source. Next time the system is called * to sleep, this device will still be active. */ - (void)pm_device_wakeup_enable((const struct device *)dev, - true); + (void)pm_device_wakeup_enable(dev, true); break; case 2: zassert_equal(state, PM_STATE_SUSPEND_TO_RAM, "Wrong system state"); @@ -87,13 +86,13 @@ void test_wakeup_device_api(void) ret = pm_device_wakeup_is_capable(dev); zassert_true(ret, "Device marked as capable"); - ret = pm_device_wakeup_enable((const struct device *)dev, true); + ret = pm_device_wakeup_enable(dev, true); zassert_true(ret, "Could not enable wakeup source"); ret = pm_device_wakeup_is_enabled(dev); zassert_true(ret, "Wakeup source not enabled"); - ret = pm_device_wakeup_enable((const struct device *)dev, false); + ret = pm_device_wakeup_enable(dev, false); zassert_true(ret, "Could not disable wakeup source"); ret = pm_device_wakeup_is_enabled(dev); diff --git a/tests/subsys/pm/power_mgmt/src/main.c b/tests/subsys/pm/power_mgmt/src/main.c index 381456c0bd0..8c6eaace6ad 100644 --- a/tests/subsys/pm/power_mgmt/src/main.c +++ b/tests/subsys/pm/power_mgmt/src/main.c @@ -417,7 +417,7 @@ void test_busy(void) void test_device_state_lock(void) { - pm_device_state_lock((const struct device *)device_a); + pm_device_state_lock(device_a); zassert_true(pm_device_state_is_locked(device_a), NULL); testing_device_lock = true; @@ -425,7 +425,7 @@ void test_device_state_lock(void) k_sleep(SLEEP_TIMEOUT); - pm_device_state_unlock((const struct device *)device_a); + pm_device_state_unlock(device_a); testing_device_lock = false; }