pm: constify all device instances

Run cocci script to constify device instances.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2022-01-06 14:37:24 +01:00 committed by Carles Cufí
commit 521c9d13fb
4 changed files with 9 additions and 9 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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;
}