Skip to content

Commit 8be0472

Browse files
gmarullnashif
authored andcommitted
pm: add type for device PM control callback
Add a type and documentation for the device PM control callback. This way possible return codes and its meaning are documented. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 6d273f4 commit 8be0472

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

include/device.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,7 @@ struct device {
384384
const device_handle_t *const handles;
385385
#ifdef CONFIG_PM_DEVICE
386386
/** Power Management function */
387-
int (*pm_control)(const struct device *dev,
388-
enum pm_device_state state);
387+
pm_device_control_callback_t pm_control;
389388
/** Pointer to device instance power management data */
390389
struct pm_device * const pm;
391390
#endif

include/pm/device.h

+13
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ struct pm_device {
9393
struct k_condvar condvar;
9494
};
9595

96+
/**
97+
* @brief Device power management control function callback.
98+
*
99+
* @param dev Device instance.
100+
* @param state Requested state.
101+
*
102+
* @retval 0 If successful.
103+
* @retval -ENOTSUP If the requested state is not supported.
104+
* @retval Errno Other negative errno on failure.
105+
*/
106+
typedef int (*pm_device_control_callback_t)(const struct device *dev,
107+
enum pm_device_state state);
108+
96109
/**
97110
* @brief Get name of device PM state
98111
*

0 commit comments

Comments
 (0)