kernel: flag isr-ok functions using funcprops

Replace old notes marking ISR safe functions with the recently
introduced funcprops.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-03-04 19:50:02 +01:00 committed by Anas Nashif
commit 9de14e8596

View file

@ -902,7 +902,7 @@ extern void k_sched_time_slice_set(int32_t slice, int prio);
* This routine allows the caller to customize its actions, depending on
* whether it is a thread or an ISR.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @return false if invoked by a thread.
* @return true if invoked by an ISR.
@ -920,7 +920,7 @@ extern bool k_is_in_isr(void);
* - The thread's priority is in the preemptible range.
* - The thread has not locked the scheduler.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @return 0 if invoked by an ISR or by a cooperative thread.
* @return Non-zero if invoked by a preemptible thread.
@ -933,7 +933,7 @@ __syscall int k_is_preempt_thread(void);
* This routine allows the caller to customize its actions, depending on
* whether it being invoked before the kernel is fully active.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @return true if invoked before post-kernel initialization
* @return false if invoked during/after post-kernel initialization
@ -1414,8 +1414,10 @@ __syscall void k_timer_start(struct k_timer *timer,
* Attempting to stop a timer that is not running is permitted, but has no
* effect on the timer.
*
* @note Can be called by ISRs. The stop handler has to be callable from ISRs
* if @a k_timer_stop is to be called from ISRs.
* @note The stop handler has to be callable from ISRs if @a k_timer_stop is to
* be called from ISRs.
*
* @funcprops \isr_ok
*
* @param timer Address of timer.
*
@ -1701,7 +1703,7 @@ __syscall void k_queue_init(struct k_queue *queue);
* -EINTR and K_POLL_STATE_CANCELLED state (and per above, subsequent
* k_queue_get() will return NULL).
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param queue Address of the queue.
*
@ -1716,7 +1718,7 @@ __syscall void k_queue_cancel_wait(struct k_queue *queue);
* aligned on a word boundary, and the first word of the item is reserved
* for the kernel's use.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param data Address of the data item.
@ -1733,7 +1735,7 @@ extern void k_queue_append(struct k_queue *queue, void *data);
* the calling thread's resource pool, which is automatically freed when the
* item is removed. The data itself is not copied.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param data Address of the data item.
@ -1750,7 +1752,7 @@ __syscall int32_t k_queue_alloc_append(struct k_queue *queue, void *data);
* aligned on a word boundary, and the first word of the item is reserved
* for the kernel's use.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param data Address of the data item.
@ -1767,7 +1769,7 @@ extern void k_queue_prepend(struct k_queue *queue, void *data);
* the calling thread's resource pool, which is automatically freed when the
* item is removed. The data itself is not copied.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param data Address of the data item.
@ -1784,7 +1786,7 @@ __syscall int32_t k_queue_alloc_prepend(struct k_queue *queue, void *data);
* data item must be aligned on a word boundary, and the first word of
* the item is reserved for the kernel's use.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param prev Address of the previous data item.
@ -1802,7 +1804,7 @@ extern void k_queue_insert(struct k_queue *queue, void *prev, void *data);
* in each data item pointing to the next data item; the list must be
* NULL-terminated.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param head Pointer to first node in singly-linked list.
@ -1821,7 +1823,7 @@ extern int k_queue_append_list(struct k_queue *queue, void *head, void *tail);
* The data items must be in a singly-linked list implemented using a
* sys_slist_t object. Upon completion, the original list is empty.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param list Pointer to sys_slist_t object.
@ -1837,7 +1839,9 @@ extern int k_queue_merge_slist(struct k_queue *queue, sys_slist_t *list);
* This routine removes first data item from @a queue. The first word of the
* data item is reserved for the kernel's use.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param timeout Non-negative waiting period to obtain a data item
@ -1856,7 +1860,9 @@ __syscall void *k_queue_get(struct k_queue *queue, k_timeout_t timeout);
* data item is reserved for the kernel's use. Removing elements from k_queue
* rely on sys_slist_find_and_remove which is not a constant time operation.
*
* @note Can be called by ISRs
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param data Address of the data item.
@ -1875,7 +1881,7 @@ static inline bool k_queue_remove(struct k_queue *queue, void *data)
* item is reserved for the kernel's use. Appending elements to k_queue
* relies on sys_slist_is_node_in_list which is not a constant time operation.
*
* @note Can be called by ISRs
* @funcprops \isr_ok
*
* @param queue Address of the queue.
* @param data Address of the data item.
@ -1902,7 +1908,7 @@ static inline bool k_queue_unique_append(struct k_queue *queue, void *data)
* Note that the data might be already gone by the time this function returns
* if other threads are also trying to read from the queue.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param queue Address of the queue.
*
@ -2082,7 +2088,7 @@ struct k_fifo {
* return from k_fifo_get() call with NULL value (as if timeout
* expired).
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param fifo Address of the FIFO queue.
*
@ -2098,7 +2104,7 @@ struct k_fifo {
* aligned on a word boundary, and the first word of the item is reserved
* for the kernel's use.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param fifo Address of the FIFO.
* @param data Address of the data item.
@ -2116,7 +2122,7 @@ struct k_fifo {
* the calling thread's resource pool, which is automatically freed when the
* item is removed. The data itself is not copied.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param fifo Address of the FIFO.
* @param data Address of the data item.
@ -2135,7 +2141,7 @@ struct k_fifo {
* each data item pointing to the next data item; the list must be
* NULL-terminated.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param fifo Address of the FIFO queue.
* @param head Pointer to first node in singly-linked list.
@ -2154,7 +2160,7 @@ struct k_fifo {
* sys_slist_t object. Upon completion, the sys_slist_t object is invalid
* and must be re-initialized via sys_slist_init().
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param fifo Address of the FIFO queue.
* @param list Pointer to sys_slist_t object.
@ -2170,7 +2176,9 @@ struct k_fifo {
* This routine removes a data item from @a fifo in a "first in, first out"
* manner. The first word of the data item is reserved for the kernel's use.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param fifo Address of the FIFO queue.
* @param timeout Waiting period to obtain a data item,
@ -2188,7 +2196,7 @@ struct k_fifo {
* Note that the data might be already gone by the time this function returns
* if other threads is also trying to read from the FIFO.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param fifo Address of the FIFO queue.
*
@ -2285,7 +2293,7 @@ struct k_lifo {
* aligned on a word boundary, and the first word of the item is
* reserved for the kernel's use.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param lifo Address of the LIFO queue.
* @param data Address of the data item.
@ -2303,7 +2311,7 @@ struct k_lifo {
* the calling thread's resource pool, which is automatically freed when the
* item is removed. The data itself is not copied.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param lifo Address of the LIFO.
* @param data Address of the data item.
@ -2320,7 +2328,9 @@ struct k_lifo {
* This routine removes a data item from @a LIFO in a "last in, first out"
* manner. The first word of the data item is reserved for the kernel's use.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param lifo Address of the LIFO queue.
* @param timeout Waiting period to obtain a data item,
@ -2433,7 +2443,7 @@ int k_stack_cleanup(struct k_stack *stack);
*
* This routine adds a stack_data_t value @a data to @a stack.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param stack Address of the stack.
* @param data Value to push onto the stack.
@ -2449,7 +2459,9 @@ __syscall int k_stack_push(struct k_stack *stack, stack_data_t data);
* This routine removes a stack_data_t value from @a stack in a "last in,
* first out" manner and stores the value in @a data.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param stack Address of the stack.
* @param data Address of area to hold the value popped from the stack.
@ -2761,7 +2773,9 @@ __syscall int k_sem_init(struct k_sem *sem, unsigned int initial_count,
*
* This routine takes @a sem.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param sem Address of the semaphore.
* @param timeout Waiting period to take the semaphore,
@ -2780,7 +2794,7 @@ __syscall int k_sem_take(struct k_sem *sem, k_timeout_t timeout);
* This routine gives @a sem, unless the semaphore is already at its maximum
* permitted count.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param sem Address of the semaphore.
*
@ -2872,7 +2886,7 @@ typedef void (*k_work_handler_t)(struct k_work *work);
* re-invoked to change the associated handler, but this must be done when the
* work item is idle.
*
* @note Safe to invoke from ISRs.
* @funcprops \isr_ok
*
* @param work the work structure to be initialized.
*
@ -2885,11 +2899,11 @@ void k_work_init(struct k_work *work,
*
* A zero return value indicates the work item appears to be idle.
*
* @note Safe to invoke from ISRs.
*
* @note This is a live snapshot of state, which may change before the result
* is checked. Use locks where appropriate.
*
* @funcprops \isr_ok
*
* @param work pointer to the work item.
*
* @return a mask of flags K_WORK_DELAYED, K_WORK_QUEUED,
@ -2901,11 +2915,11 @@ int k_work_busy_get(const struct k_work *work);
*
* Wrapper to determine whether a work item is in a non-idle dstate.
*
* @note Safe to invoke from ISRs.
*
* @note This is a live snapshot of state, which may change before the result
* is checked. Use locks where appropriate.
*
* @funcprops \isr_ok
*
* @param work pointer to the work item.
*
* @return true if and only if k_work_busy_get() returns a non-zero value.
@ -2913,12 +2927,12 @@ int k_work_busy_get(const struct k_work *work);
static inline bool k_work_is_pending(const struct k_work *work);
/** @brief Submit a work item to a queue.
*
* @note Safe to invoke from ISRs.
*
* @param queue pointer to the work queue on which the item should run. If
* NULL the queue from the most recent submission will be used.
*
* @funcprops \isr_ok
*
* @param work pointer to the work item.
*
* @retval 0 if work was already submitted to a queue
@ -2936,7 +2950,7 @@ int k_work_submit_to_queue(struct k_work_q *queue,
/** @brief Submit a work item to the system queue.
*
* @note Safe to invoke from ISRs.
* @funcprops \isr_ok
*
* @param work pointer to the work item.
*
@ -2986,7 +3000,7 @@ bool k_work_flush(struct k_work *work,
*
* See also k_work_cancel_sync().
*
* @note Safe to invoke from ISRs.
* @funcprops \isr_ok
*
* @param work pointer to the work item.
*
@ -3090,7 +3104,7 @@ int k_work_queue_drain(struct k_work_q *queue, bool plug);
* is invoked with the @p plug option enabled. If this is invoked before the
* drain completes new items may be submitted as soon as the drain completes.
*
* @note Safe to invoke from ISRs.
* @funcprops \isr_ok
*
* @param queue pointer to the queue structure.
*
@ -3106,7 +3120,7 @@ int k_work_queue_unplug(struct k_work_q *queue);
* can be re-invoked to change the associated handler, but this must be done
* when the work item is idle.
*
* @note Safe to invoke from ISRs.
* @funcprops \isr_ok
*
* @param dwork the delayable work structure to be initialized.
*
@ -3131,7 +3145,7 @@ k_work_delayable_from_work(struct k_work *work);
/** @brief Busy state flags from the delayable work item.
*
* @note Safe to invoke from ISRs.
* @funcprops \isr_ok
*
* @note This is a live snapshot of state, which may change before the result
* can be inspected. Use locks where appropriate.
@ -3148,11 +3162,11 @@ int k_work_delayable_busy_get(const struct k_work_delayable *dwork);
*
* Wrapper to determine whether a delayed work item is in a non-idle state.
*
* @note Safe to invoke from ISRs.
*
* @note This is a live snapshot of state, which may change before the result
* can be inspected. Use locks where appropriate.
*
* @funcprops \isr_ok
*
* @param dwork pointer to the delayable work item.
*
* @return true if and only if k_work_delayable_busy_get() returns a non-zero
@ -3164,11 +3178,11 @@ static inline bool k_work_delayable_is_pending(
/** @brief Get the absolute tick count at which a scheduled delayable work
* will be submitted.
*
* @note Safe to invoke from ISRs.
*
* @note This is a live snapshot of state, which may change before the result
* can be inspected. Use locks where appropriate.
*
* @funcprops \isr_ok
*
* @param dwork pointer to the delayable work item.
*
* @return the tick count when the timer that will schedule the work item will
@ -3180,11 +3194,11 @@ static inline k_ticks_t k_work_delayable_expires_get(
/** @brief Get the number of ticks until a scheduled delayable work will be
* submitted.
*
* @note Safe to invoke from ISRs.
*
* @note This is a live snapshot of state, which may change before the result
* can be inspected. Use locks where appropriate.
*
* @funcprops \isr_ok
*
* @param dwork pointer to the delayable work item.
*
* @return the number of ticks until the timer that will schedule the work
@ -3198,7 +3212,7 @@ static inline k_ticks_t k_work_delayable_remaining_get(
* Unlike k_work_reschedule_for_queue() this is a no-op if the work item is
* already scheduled or submitted, even if @p delay is @c K_NO_WAIT.
*
* @note Safe to invoke from ISRs.
* @funcprops \isr_ok
*
* @param queue the queue on which the work item should be submitted after the
* delay.
@ -3242,7 +3256,7 @@ static inline int k_work_schedule(struct k_work_delayable *dwork,
* (e.g. is submitted or running). This function does not affect ("unsubmit")
* a work item that has been submitted to a queue.
*
* @note Safe to invoke from ISRs.
* @funcprops \isr_ok
*
* @param queue the queue on which the work item should be submitted after the
* delay.
@ -3319,8 +3333,6 @@ bool k_work_flush_delayable(struct k_work_delayable *dwork,
* scheduled or submitted it is canceled. This function does not wait for the
* cancellation to complete.
*
* @note Safe to invoke from ISRs.
*
* @note The work may still be running when this returns. Use
* k_work_flush_delayable() or k_work_cancel_delayable_sync() to ensure it is
* not running.
@ -3328,6 +3340,8 @@ bool k_work_flush_delayable(struct k_work_delayable *dwork,
* @note Canceling delayable work does not prevent rescheduling it. It does
* prevent submitting it until the cancellation completes.
*
* @funcprops \isr_ok
*
* @param dwork pointer to the delayable work item.
*
* @return the k_work_delayable_busy_get() status indicating the state of the
@ -3857,7 +3871,7 @@ static inline void k_work_user_init(struct k_work_user *work,
* work will still be pending when this information is used. It is up to
* the caller to make sure that this information is used in a safe manner.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param work Address of work item.
*
@ -3877,7 +3891,7 @@ static inline bool k_work_user_is_pending(struct k_work_user *work)
* thread must have memory access to the k_work item being submitted. The caller
* must have permission granted on the work_q parameter's queue object.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param work_q Address of workqueue.
* @param work Address of work item.
@ -4016,7 +4030,7 @@ extern void k_work_poll_init(struct k_work_poll *work,
* to race conditions with the pre-existing triggered work item and work queue,
* so care must be taken to synchronize such resubmissions externally.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @warning
* Provided array of events as well as a triggered work item must be placed
@ -4056,7 +4070,7 @@ extern int k_work_poll_submit_to_queue(struct k_work_q *work_q,
* to race conditions with the pre-existing triggered work item and work queue,
* so care must be taken to synchronize such resubmissions externally.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @warning
* Provided array of events as well as a triggered work item must not be
@ -4088,7 +4102,7 @@ static inline int k_work_poll_submit(struct k_work_poll *work,
* A triggered work item can only be canceled if no event triggered work
* submission.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param work Address of delayed work item.
*
@ -4262,11 +4276,12 @@ int k_msgq_cleanup(struct k_msgq *msgq);
*
* This routine sends a message to message queue @a q.
*
* @note Can be called by ISRs.
* @note The message content is copied from @a data into @a msgq and the @a data
* pointer is not retained, so the message content will not be modified
* by this function.
*
* @funcprops \isr_ok
*
* @param msgq Address of the message queue.
* @param data Pointer to the message.
* @param timeout Non-negative waiting period to add the message,
@ -4285,7 +4300,9 @@ __syscall int k_msgq_put(struct k_msgq *msgq, const void *data, k_timeout_t time
* This routine receives a message from message queue @a q in a "first in,
* first out" manner.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param msgq Address of the message queue.
* @param data Address of area to hold the received message.
@ -4305,7 +4322,7 @@ __syscall int k_msgq_get(struct k_msgq *msgq, void *data, k_timeout_t timeout);
* This routine reads a message from message queue @a q in a "first in,
* first out" manner and leaves the message in the queue.
*
* @note Can be called by ISRs.
* @funcprops \isr_ok
*
* @param msgq Address of the message queue.
* @param data Address of area to hold the message read from the queue.
@ -4823,7 +4840,9 @@ extern int k_mem_slab_init(struct k_mem_slab *slab, void *buffer,
*
* This routine allocates a memory block from a memory slab.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param slab Address of the memory slab.
* @param mem Pointer to block address area.
@ -4941,7 +4960,9 @@ void k_heap_init(struct k_heap *h, void *mem, size_t bytes);
* bytes. The resulting memory can be returned to the heap using
* k_heap_free().
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param h Heap from which to allocate
* @param align Alignment in bytes, must be a power of two
@ -4962,7 +4983,9 @@ void *k_heap_aligned_alloc(struct k_heap *h, size_t align, size_t bytes,
* freed. If the allocation cannot be performed by the expiration of
* the timeout, NULL will be returned.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* @note @a timeout must be set to K_NO_WAIT if called from ISR.
*
* @funcprops \isr_ok
*
* @param h Heap from which to allocate
* @param bytes Desired size of block to allocate