lib: os: use a typedef for __printk_hook_install argument

Use a typedef for the printk hook function argument.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2024-07-23 19:01:18 +01:00 committed by Anas Nashif
parent ef14c9b867
commit 36768aa7ff
2 changed files with 12 additions and 3 deletions

View file

@ -7,6 +7,15 @@
#ifndef ZEPHYR_INCLUDE_SYS_PRINTK_HOOKS_H_
#define ZEPHYR_INCLUDE_SYS_PRINTK_HOOKS_H_
/**
* @brief printk function handler
*
* @param c Character to output
*
* @returns The character passed as input.
*/
typedef int (*printk_hook_fn_t)(int c);
/**
* @brief Install the character output routine for printk
*
@ -14,7 +23,7 @@
* routine that outputs one ASCII character at a time.
* @param fn putc routine to install
*/
void __printk_hook_install(int (*fn)(int c));
void __printk_hook_install(printk_hook_fn_t fn);
/**
* @brief Get the current character output routine for printk

View file

@ -53,9 +53,9 @@ __attribute__((weak)) int arch_printk_char_out(int c)
}
/* LCOV_EXCL_STOP */
static int (*_char_out)(int c) = arch_printk_char_out;
static printk_hook_fn_t _char_out = arch_printk_char_out;
void __printk_hook_install(int (*fn)(int c))
void __printk_hook_install(printk_hook_fn_t fn)
{
_char_out = fn;
}