From 4d01efbf908ad9828468f41addce0f2665281704 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Mon, 10 Mar 2025 15:33:24 +0100 Subject: [PATCH] lib: net_buf: remove deprecated net_buf_put() and net_buf_get() functions Remove the deprecated net_buf_put() and net_buf_get() functions. Signed-off-by: Henrik Brix Andersen --- doc/releases/release-notes-4.0.rst | 4 +--- include/zephyr/net_buf.h | 33 ------------------------------ lib/net_buf/buf.c | 29 -------------------------- 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 3a4f341012c..357d6c67ff7 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -105,7 +105,7 @@ Removed APIs in this release Deprecated in this release ========================== -* Deprecated the :c:func:`net_buf_put` and :c:func:`net_buf_get` API functions in favor of +* Deprecated the ``net_buf_put()`` and ``net_buf_get()`` API functions in favor of :c:func:`k_fifo_put` and :c:func:`k_fifo_get`. * The :ref:`kscan_api` subsystem has been marked as deprecated. @@ -119,8 +119,6 @@ Deprecated in this release ``include/zephyr/net_buf.h>``. The old header will be removed in future releases and its usage should be avoided. -* Deprecated the :c:func:`net_buf_put` and :c:func:`net_buf_get` API functions. - Architectures ************* diff --git a/include/zephyr/net_buf.h b/include/zephyr/net_buf.h index c349147afd7..c4cc6a71e68 100644 --- a/include/zephyr/net_buf.h +++ b/include/zephyr/net_buf.h @@ -1423,29 +1423,6 @@ struct net_buf * __must_check net_buf_alloc_with_data(struct net_buf_pool *pool, k_timeout_t timeout); #endif -/** - * @brief Get a buffer from a FIFO. - * - * @deprecated Use @a k_fifo_get() instead. - * - * @param fifo Which FIFO to take the buffer from. - * @param timeout Affects the action taken should the FIFO be empty. - * If K_NO_WAIT, then return immediately. If K_FOREVER, then wait as - * long as necessary. Otherwise, wait until the specified timeout. - * - * @return New buffer or NULL if the FIFO is empty. - */ -#if defined(CONFIG_NET_BUF_LOG) -__deprecated struct net_buf * __must_check net_buf_get_debug(struct k_fifo *fifo, - k_timeout_t timeout, - const char *func, int line); -#define net_buf_get(_fifo, _timeout) \ - net_buf_get_debug(_fifo, _timeout, __func__, __LINE__) -#else -__deprecated struct net_buf * __must_check net_buf_get(struct k_fifo *fifo, - k_timeout_t timeout); -#endif - /** * @brief Destroy buffer from custom destroy callback * @@ -1505,16 +1482,6 @@ void net_buf_slist_put(sys_slist_t *list, struct net_buf *buf); */ struct net_buf * __must_check net_buf_slist_get(sys_slist_t *list); -/** - * @brief Put a buffer to the end of a FIFO. - * - * @deprecated Use @a k_fifo_put() instead. - * - * @param fifo Which FIFO to put the buffer to. - * @param buf Buffer. - */ -__deprecated void net_buf_put(struct k_fifo *fifo, struct net_buf *buf); - /** * @brief Decrements the reference count of a buffer. * diff --git a/lib/net_buf/buf.c b/lib/net_buf/buf.c index 7b89e89fd7b..fc861012ebc 100644 --- a/lib/net_buf/buf.c +++ b/lib/net_buf/buf.c @@ -388,27 +388,6 @@ struct net_buf *net_buf_alloc_with_data(struct net_buf_pool *pool, return buf; } -#if defined(CONFIG_NET_BUF_LOG) -struct net_buf *net_buf_get_debug(struct k_fifo *fifo, k_timeout_t timeout, - const char *func, int line) -#else -struct net_buf *net_buf_get(struct k_fifo *fifo, k_timeout_t timeout) -#endif -{ - struct net_buf *buf; - - NET_BUF_DBG("%s():%d: fifo %p", func, line, fifo); - - buf = k_fifo_get(fifo, timeout); - if (!buf) { - return NULL; - } - - NET_BUF_DBG("%s():%d: buf %p fifo %p", func, line, buf, fifo); - - return buf; -} - static struct k_spinlock net_buf_slist_lock; void net_buf_slist_put(sys_slist_t *list, struct net_buf *buf) @@ -439,14 +418,6 @@ struct net_buf *net_buf_slist_get(sys_slist_t *list) return buf; } -void net_buf_put(struct k_fifo *fifo, struct net_buf *buf) -{ - __ASSERT_NO_MSG(fifo); - __ASSERT_NO_MSG(buf); - - k_fifo_put(fifo, buf); -} - #if defined(CONFIG_NET_BUF_LOG) void net_buf_unref_debug(struct net_buf *buf, const char *func, int line) #else