zephyr/tests
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
..
application_development/gen_inc_file cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
arch tests: arch: arm: irq_vector_table Add correct ISR table for iMX.RT SOCs 2021-12-13 20:13:21 -05:00
benchmarks tests: latency_measure: remove qemu_x86_64 exclusion 2021-11-24 14:16:13 -05:00
bluetooth test/bluetooth/tester: Use Health Client Unack API 2021-12-16 10:15:36 +01:00
boards drivers: Apply SPI API change to relevant places 2021-11-19 11:50:38 +01:00
boot/uefi tests: uefi: move uefi test out of hello world 2021-10-22 06:36:51 -04:00
cmake/config_dir cmake: APPLICATION_CONFIG_DIR support implemented 2021-11-10 08:25:36 -05:00
crypto tests: m2gl025_miv: exclude slow platform from some tests 2021-11-29 19:39:38 -05:00
drivers drivers: sensor: ina23x: add support for INA237 2021-12-14 13:48:54 -06:00
kernel kernel: Bring back object tracking 2021-12-14 07:42:31 -05:00
lib tests: lib: mpsc_pbuf: Fix address-of-packed-mem warning 2021-12-10 14:08:59 +01:00
misc cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
net boards: frdm_k64f: Solve conflict between UART3 and enet 2021-11-30 11:08:15 -06:00
posix tests: posix: common: increase main stack for TLS tests 2021-11-19 10:11:32 +01:00
subsys pm: device_runtime: simplify error handling for get/put 2021-12-16 10:41:04 +01:00
unit lib: os: cbprintf: Add flags to CBPRINTF_MUST_RUNTIME_PACKAGE 2021-11-29 21:13:56 +01:00
ztest testsuite: busy_sim: Add callback to the interrupt 2021-12-01 10:00:50 +01:00