From 6e12b0210f3ad4c2c84050554859c1bfd3d85ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Thu, 22 Feb 2024 14:03:49 +0100 Subject: [PATCH] log: net: move log_backend_net_get() to header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This moves the declaration of log_backend_net_get() to zephyr/logging/log_backend_net.h Signed-off-by: Fin Maaß --- include/zephyr/logging/log_backend_net.h | 9 +++++++++ samples/net/syslog_net/src/main.c | 4 ---- subsys/logging/backends/log_backend_net.c | 2 -- subsys/net/lib/config/init.c | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/zephyr/logging/log_backend_net.h b/include/zephyr/logging/log_backend_net.h index 8f3b0eb9ad7..d42a511a023 100644 --- a/include/zephyr/logging/log_backend_net.h +++ b/include/zephyr/logging/log_backend_net.h @@ -61,6 +61,15 @@ static inline void log_backend_net_hostname_set(const char *hostname, size_t len } #endif +/** + * @brief Get the net logger backend + * + * @details This function returns the net logger backend. + * + * @return Pointer to the net logger backend. + */ +const struct log_backend *log_backend_net_get(void); + #ifdef __cplusplus } #endif diff --git a/samples/net/syslog_net/src/main.c b/samples/net/syslog_net/src/main.c index b842e0ec03b..f0362648f05 100644 --- a/samples/net/syslog_net/src/main.c +++ b/samples/net/syslog_net/src/main.c @@ -19,10 +19,6 @@ BUILD_ASSERT(IS_ENABLED(CONFIG_LOG_BACKEND_NET), "syslog backend not enabled"); #define SLEEP_BETWEEN_PRINTS 3 -#if defined(CONFIG_LOG_BACKEND_NET) -extern const struct log_backend *log_backend_net_get(void); -#endif - int main(void) { int i, count, sleep; diff --git a/subsys/logging/backends/log_backend_net.c b/subsys/logging/backends/log_backend_net.c index 92b2f3f719c..b9ffd315de3 100644 --- a/subsys/logging/backends/log_backend_net.c +++ b/subsys/logging/backends/log_backend_net.c @@ -42,8 +42,6 @@ static struct log_backend_net_ctx { .sock = -1, }; -const struct log_backend *log_backend_net_get(void); - static int line_out(uint8_t *data, size_t length, void *output_ctx) { struct log_backend_net_ctx *ctx = (struct log_backend_net_ctx *)output_ctx; diff --git a/subsys/net/lib/config/init.c b/subsys/net/lib/config/init.c index 2cc7236dfcc..734ca16998c 100644 --- a/subsys/net/lib/config/init.c +++ b/subsys/net/lib/config/init.c @@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_config, CONFIG_NET_CONFIG_LOG_LEVEL); #include #include +#include #include #include #include @@ -30,7 +31,6 @@ LOG_MODULE_REGISTER(net_config, CONFIG_NET_CONFIG_LOG_LEVEL); #include "ieee802154_settings.h" #include "bt_settings.h" -extern const struct log_backend *log_backend_net_get(void); extern int net_init_clock_via_sntp(void); static K_SEM_DEFINE(waiter, 0, 1);