zephyr/subsys
Gerard Marull-Paretas 59b455eb9c pm: device_runtime: simplify error handling for get/put
In case runtime PM is not enabled (or not built-in), the get/put
functions always return 0 (instead of -ENOTSUP/-ENOSYS). When runtime PM
is disabled, a device is left into active state. Similarly, when device
runtime PM is not built-in, it is safe to assume that a device will
be active when it is called. If a user implements a custom solution, it
is its responsability to make sure that a device is active when using
it. For all these reasons, the -ENOTSUP/-ENOSYS are error codes that
should always be ignored by devices using get/put, since in practice it
means that: device is active, function is a no-op. The example below
illustrates how error handling is simplified:

```c
/* before: safe to ignore -ENOSYS/-ENOTSUP since device is active (we
 * can continue)
 */
ret = pm_device_runtime_get(dev);
if ((ret < 0) && (ret != -ENOSYS) && (ret != -ENOTSUP)) {
	return ret;
}

/* now */
ret = pm_device_runtime_get(dev);
if (ret < 0) {
	return ret;
}
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
..
bluetooth Bluetooth: Mesh: Update Health Client API use 2021-12-16 10:15:36 +01:00
canbus drivers: can: deprecate the use of CAN-specific error return values 2021-12-09 12:37:40 -05:00
console console: Kconfig: Remove EXPERIMENTAL marker 2021-10-22 09:46:22 -04:00
cpp ARC: MWDT: get rid of MWDT startup libs 2021-09-01 17:08:32 -04:00
debug debug: coredump: add xtensa coredump 2021-12-14 07:40:55 -05:00
demand_paging demand_paging: eviction/nru: fix incorrect dirty bit return val 2021-09-20 19:43:02 -04:00
dfu
disk
emul i2c: emul: Add get_config function 2021-11-02 16:46:33 +01:00
fb samples: use chosen property to get default display controller 2021-12-10 12:47:30 +01:00
fs fs: littlefs: Add processing of FS_MOUNT_FLAG_USE_DISK_ACCESS flag 2021-12-06 08:08:26 -05:00
ipc ipc: use highest coop priority for IPM workqueue 2021-11-24 18:59:02 +01:00
jwt jwt: mbedTLS requires csprng 2021-10-07 14:02:40 -05:00
logging log_backend_net: local_addrX may be used uninitialized 2021-12-09 19:53:17 -05:00
lorawan kconfig: lorawan: experimental settings now uses select EXPERIMENTAL 2021-10-25 10:46:48 +02:00
mgmt samples: subsys: mcumgr: Remove deprecated <power/reboot.h> header 2021-12-10 10:30:41 +01:00
modbus
net drivers: can: deprecate the use of CAN-specific error return values 2021-12-09 12:37:40 -05:00
pm pm: device_runtime: simplify error handling for get/put 2021-12-16 10:41:04 +01:00
portability portability: cmsis: use correct type for atomics 2021-11-15 09:59:01 -05:00
random random: Fix sys_csrand_get build condition 2021-10-07 14:02:40 -05:00
settings settings: add shell commands for reading settings 2021-11-22 08:32:56 -05:00
shell device: remove inclusion of pm/device.h 2021-11-29 11:08:38 +01:00
stats stats: fixed implicit integer sign extension in stats_get_off() 2021-10-28 15:15:56 -04:00
storage storage/flash_map: Add option to use MBEDTLS for img integrity check. 2021-11-24 21:52:08 -05:00
task_wdt task_wdt: fix overflow in current_ticks making wdt get stuck 2021-11-22 20:22:11 -05:00
testsuite testsuite: busy_sim: Use xoshiro128++ when enabled 2021-12-01 10:00:50 +01:00
timing
tracing pm: device_runtime: Return possible error on enable 2021-12-14 19:23:05 -05:00
usb usb: bluetooth: do not start transfers when USB bus is suspended 2021-12-14 09:08:58 -05:00
CMakeLists.txt
Kconfig