pm: device_runtime: use atomic_test_bit
Use `atomic_test_bit` when checking pm flags instead of manually using bitwise operations. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
ab0bf48660
commit
8a2eed6cbd
1 changed files with 4 additions and 4 deletions
|
@ -47,7 +47,7 @@ static int runtime_suspend(const struct device *dev, bool async)
|
|||
(void)k_mutex_lock(&pm->lock, K_FOREVER);
|
||||
}
|
||||
|
||||
if ((pm->flags & BIT(PM_DEVICE_FLAG_RUNTIME_ENABLED)) == 0U) {
|
||||
if (!atomic_test_bit(&pm->flags, PM_DEVICE_FLAG_RUNTIME_ENABLED)) {
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ int pm_device_runtime_get(const struct device *dev)
|
|||
(void)k_mutex_lock(&pm->lock, K_FOREVER);
|
||||
}
|
||||
|
||||
if ((pm->flags & BIT(PM_DEVICE_FLAG_RUNTIME_ENABLED)) == 0U) {
|
||||
if (!atomic_test_bit(&pm->flags, PM_DEVICE_FLAG_RUNTIME_ENABLED)) {
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ int pm_device_runtime_enable(const struct device *dev)
|
|||
(void)k_mutex_lock(&pm->lock, K_FOREVER);
|
||||
}
|
||||
|
||||
if ((pm->flags & BIT(PM_DEVICE_FLAG_RUNTIME_ENABLED)) != 0U) {
|
||||
if (atomic_test_bit(&pm->flags, PM_DEVICE_FLAG_RUNTIME_ENABLED)) {
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ int pm_device_runtime_disable(const struct device *dev)
|
|||
(void)k_mutex_lock(&pm->lock, K_FOREVER);
|
||||
}
|
||||
|
||||
if ((pm->flags & BIT(PM_DEVICE_FLAG_RUNTIME_ENABLED)) == 0U) {
|
||||
if (!atomic_test_bit(&pm->flags, PM_DEVICE_FLAG_RUNTIME_ENABLED)) {
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue