Skip to content

Commit d55c9b6

Browse files
Flavio Ceolinnashif
authored andcommitted
console: uart: Don't re-define functions as macros
Some functions were being re-defined as macros if certain conditions were not met. Fix violations to rule 5.5 Signed-off-by: Flavio Ceolin <[email protected]>
1 parent 419fabd commit d55c9b6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/console/uart_console.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,10 @@ static int console_out(int c)
9797

9898
#if defined(CONFIG_STDOUT_CONSOLE)
9999
extern void __stdout_hook_install(int (*hook)(int));
100-
#else
101-
#define __stdout_hook_install(x) \
102-
do { /* nothing */ \
103-
} while ((0))
104100
#endif
105101

106102
#if defined(CONFIG_PRINTK)
107103
extern void __printk_hook_install(int (*fn)(int));
108-
#else
109-
#define __printk_hook_install(x) \
110-
do { /* nothing */ \
111-
} while ((0))
112104
#endif
113105

114106
#if defined(CONFIG_CONSOLE_HANDLER)
@@ -564,9 +556,13 @@ void uart_register_input(struct k_fifo *avail, struct k_fifo *lines,
564556
}
565557

566558
#else
567-
#define uart_register_input(x) \
568-
do { /* nothing */ \
569-
} while ((0))
559+
void uart_register_input(struct k_fifo *avail, struct k_fifo *lines,
560+
uint8_t (*completion)(char *str, uint8_t len))
561+
{
562+
ARG_UNUSED(avail);
563+
ARG_UNUSED(lines);
564+
ARG_UNUSED(completion);
565+
}
570566
#endif
571567

572568
/**
@@ -578,8 +574,12 @@ void uart_register_input(struct k_fifo *avail, struct k_fifo *lines,
578574

579575
static void uart_console_hook_install(void)
580576
{
577+
#if defined(CONFIG_STDOUT_CONSOLE)
581578
__stdout_hook_install(console_out);
579+
#endif
580+
#if defined(CONFIG_PRINTK)
582581
__printk_hook_install(console_out);
582+
#endif
583583
}
584584

585585
/**

0 commit comments

Comments
 (0)