Skip to content

Commit 1977ac3

Browse files
pabigotnashif
authored andcommitted
lib: os: onoff: documentation clarifications
Note that the client structure must be reinitialized before each use, and make more clear that its internal fields are not part of the public API. Signed-off-by: Peter Bigot <[email protected]>
1 parent 1e80efa commit 1977ac3

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

include/sys/onoff.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,12 @@ typedef void (*onoff_client_callback)(struct onoff_service *srv,
270270
* * when operation completion is posted (signalled or callback
271271
* invoked).
272272
*
273-
* Only the result field is intended for direct use by clients, and it
274-
* is available for inspection only after control reverts to the
275-
* client.
273+
* After control has reverted to the client the state object must be
274+
* reinitialized for the next operation.
275+
*
276+
* The content of this structure is not public API: all configuration
277+
* and inspection should be done with functions like
278+
* onoff_client_init_callback() and onoff_client_fetch_result().
276279
*/
277280
struct onoff_client {
278281
/* Links the client into the set of waiting service users. */
@@ -341,6 +344,9 @@ static inline int onoff_client_fetch_result(const struct onoff_client *op,
341344
* notification, and instead must periodically check for completion
342345
* using onoff_client_fetch_result().
343346
*
347+
* On completion of the operation the client object must be
348+
* reinitialized before it can be re-used.
349+
*
344350
* @param cli pointer to the client state object.
345351
*/
346352
static inline void onoff_client_init_spinwait(struct onoff_client *cli)
@@ -360,6 +366,9 @@ static inline void onoff_client_init_spinwait(struct onoff_client *cli)
360366
* completion of operations submitted through onoff_request() and
361367
* onoff_release() through the provided signal.
362368
*
369+
* On completion of the operation the client object must be
370+
* reinitialized before it can be re-used.
371+
*
363372
* @note
364373
* @rst
365374
* This capability is available only when :option:`CONFIG_POLL` is
@@ -398,6 +407,9 @@ static inline void onoff_client_init_signal(struct onoff_client *cli,
398407
* from various contexts depending on the specific service; see
399408
* @ref onoff_client_callback.
400409
*
410+
* On completion of the operation the client object must be
411+
* reinitialized before it can be re-used.
412+
*
401413
* @param cli pointer to the client state object.
402414
*
403415
* @param handler a function pointer to use for notification.

0 commit comments

Comments
 (0)