mirror of
https://github.com/esphome/esphome.git
synced 2025-04-09 20:30:31 +01:00
change tab to space
This commit is contained in:
parent
1e93c5b0db
commit
60d31a0f9f
@ -18,54 +18,54 @@ static size_t num_susp;
|
|||||||
|
|
||||||
static int pm_suspend_devices(void)
|
static int pm_suspend_devices(void)
|
||||||
{
|
{
|
||||||
const struct device *devs;
|
const struct device *devs;
|
||||||
size_t devc;
|
size_t devc;
|
||||||
|
|
||||||
devc = z_device_get_all_static(&devs);
|
devc = z_device_get_all_static(&devs);
|
||||||
|
|
||||||
num_susp = 0;
|
num_susp = 0;
|
||||||
|
|
||||||
for (const struct device *dev = devs + devc - 1; dev >= devs; dev--) {
|
for (const struct device *dev = devs + devc - 1; dev >= devs; dev--) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ignore uninitialized devices, busy devices, wake up sources, and
|
* Ignore uninitialized devices, busy devices, wake up sources, and
|
||||||
* devices with runtime PM enabled.
|
* devices with runtime PM enabled.
|
||||||
*/
|
*/
|
||||||
if (!device_is_ready(dev) || pm_device_is_busy(dev) ||
|
if (!device_is_ready(dev) || pm_device_is_busy(dev) ||
|
||||||
pm_device_state_is_locked(dev) ||
|
pm_device_state_is_locked(dev) ||
|
||||||
pm_device_wakeup_is_enabled(dev) ||
|
pm_device_wakeup_is_enabled(dev) ||
|
||||||
pm_device_runtime_is_enabled(dev)) {
|
pm_device_runtime_is_enabled(dev)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = pm_device_action_run(dev, PM_DEVICE_ACTION_SUSPEND);
|
ret = pm_device_action_run(dev, PM_DEVICE_ACTION_SUSPEND);
|
||||||
/* ignore devices not supporting or already at the given state */
|
/* ignore devices not supporting or already at the given state */
|
||||||
if ((ret == -ENOSYS) || (ret == -ENOTSUP) || (ret == -EALREADY)) {
|
if ((ret == -ENOSYS) || (ret == -ENOTSUP) || (ret == -EALREADY)) {
|
||||||
continue;
|
continue;
|
||||||
} else if (ret < 0) {
|
} else if (ret < 0) {
|
||||||
ESP_LOGE(TAG, "Device %s did not enter %s state (%d)",
|
ESP_LOGE(TAG, "Device %s did not enter %s state (%d)",
|
||||||
dev->name,
|
dev->name,
|
||||||
pm_device_state_str(PM_DEVICE_STATE_SUSPENDED),
|
pm_device_state_str(PM_DEVICE_STATE_SUSPENDED),
|
||||||
ret);
|
ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPE_SECTION_START(pm_device_slots)[num_susp] = dev;
|
TYPE_SECTION_START(pm_device_slots)[num_susp] = dev;
|
||||||
num_susp++;
|
num_susp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pm_resume_devices(void)
|
static void pm_resume_devices(void)
|
||||||
{
|
{
|
||||||
for (int i = (num_susp - 1); i >= 0; i--) {
|
for (int i = (num_susp - 1); i >= 0; i--) {
|
||||||
pm_device_action_run(TYPE_SECTION_START(pm_device_slots)[i],
|
pm_device_action_run(TYPE_SECTION_START(pm_device_slots)[i],
|
||||||
PM_DEVICE_ACTION_RESUME);
|
PM_DEVICE_ACTION_RESUME);
|
||||||
}
|
}
|
||||||
|
|
||||||
num_susp = 0;
|
num_susp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user