Skip to content

Commit 2de12df

Browse files
mbolivar-nordicnashif
authored andcommitted
drivers: clock_control: clock_control_on should be blocking
Document this behavior. This partially addresses #20708, but we'll have to deal with driver bugs case by case now that the desired behavior is clear. Signed-off-by: Martí Bolívar <[email protected]>
1 parent fc5cd77 commit 2de12df

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

include/drivers/clock_control.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,17 @@ struct clock_control_driver_api {
102102
};
103103

104104
/**
105-
* @brief Enable the clock of a sub-system controlled by the device
106-
* @param dev Pointer to the device structure for the clock controller driver
107-
* instance
108-
* @param sys A pointer to an opaque data representing the sub-system
105+
* @brief Enable a clock controlled by the device
106+
*
107+
* On success, the clock is enabled and ready when this function
108+
* returns. This function may sleep, and thus can only be called from
109+
* thread context.
110+
*
111+
* Use @ref clock_control_async_on() for non-blocking operation.
112+
*
113+
* @param dev Device structure whose driver controls the clock.
114+
* @param sys Opaque data representing the clock.
115+
* @return 0 on success, negative errno on failure.
109116
*/
110117
static inline int clock_control_on(struct device *dev,
111118
clock_control_subsys_t sys)
@@ -117,13 +124,14 @@ static inline int clock_control_on(struct device *dev,
117124
}
118125

119126
/**
120-
* @brief Disable the clock of a sub-system controlled by the device.
127+
* @brief Disable a clock controlled by the device
121128
*
122-
* Function is non-blocking and can be called from any context.
129+
* This function is non-blocking and can be called from any context.
130+
* On success, the clock is disabled when this function returns.
123131
*
124-
* @param dev Pointer to the device structure for the clock controller driver
125-
* instance
126-
* @param sys A pointer to an opaque data representing the sub-system
132+
* @param dev Device structure whose driver controls the clock
133+
* @param sys Opaque data representing the clock
134+
* @return 0 on success, negative errno on failure.
127135
*/
128136
static inline int clock_control_off(struct device *dev,
129137
clock_control_subsys_t sys)

0 commit comments

Comments
 (0)