pm: constify all device instances
Run cocci script to constify device instances.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
diff --git a/include/pm/device.h b/include/pm/device.h
index 7886224..03354ae 100644
--- a/include/pm/device.h
+++ b/include/pm/device.h
@@ -414,7 +414,7 @@
* @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 @@
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 b1a2e40..677f3f2 100644
--- a/subsys/pm/device.c
+++ b/subsys/pm/device.c
@@ -200,7 +200,7 @@
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 963c9fa..344cea0 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 @@
/* 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 @@
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 381456c..8c6eaac 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_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 @@
k_sleep(SLEEP_TIMEOUT);
- pm_device_state_unlock((const struct device *)device_a);
+ pm_device_state_unlock(device_a);
testing_device_lock = false;
}