net: buf: STRUCT_SECTION_ITERABLE for pool decl

Use the `STRUCT_SECTION_ITERABLE` helper macro when declaring buffer
pools instead of manually doing the same thing.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2021-11-24 21:07:40 +10:00 committed by Johan Hedberg
commit 1d7b63d0fe

View file

@ -1089,8 +1089,7 @@ extern const struct net_buf_data_alloc net_buf_heap_alloc;
*/ */
#define NET_BUF_POOL_HEAP_DEFINE(_name, _count, _ud_size, _destroy) \ #define NET_BUF_POOL_HEAP_DEFINE(_name, _count, _ud_size, _destroy) \
_NET_BUF_ARRAY_DEFINE(_name, _count, _ud_size); \ _NET_BUF_ARRAY_DEFINE(_name, _count, _ud_size); \
static struct net_buf_pool _name __net_buf_align \ static STRUCT_SECTION_ITERABLE(net_buf_pool, _name) = \
__in_section(_net_buf_pool, static, _name) = \
NET_BUF_POOL_INITIALIZER(_name, &net_buf_heap_alloc, \ NET_BUF_POOL_INITIALIZER(_name, &net_buf_heap_alloc, \
_net_buf_##_name, _count, _ud_size, \ _net_buf_##_name, _count, _ud_size, \
_destroy) _destroy)
@ -1143,8 +1142,7 @@ extern const struct net_buf_data_cb net_buf_fixed_cb;
.cb = &net_buf_fixed_cb, \ .cb = &net_buf_fixed_cb, \
.alloc_data = (void *)&net_buf_fixed_##_name, \ .alloc_data = (void *)&net_buf_fixed_##_name, \
}; \ }; \
static struct net_buf_pool _name __net_buf_align \ static STRUCT_SECTION_ITERABLE(net_buf_pool, _name) = \
__in_section(_net_buf_pool, static, _name) = \
NET_BUF_POOL_INITIALIZER(_name, &net_buf_fixed_alloc_##_name, \ NET_BUF_POOL_INITIALIZER(_name, &net_buf_fixed_alloc_##_name, \
_net_buf_##_name, _count, _ud_size, \ _net_buf_##_name, _count, _ud_size, \
_destroy) _destroy)
@ -1184,8 +1182,7 @@ extern const struct net_buf_data_cb net_buf_var_cb;
.cb = &net_buf_var_cb, \ .cb = &net_buf_var_cb, \
.alloc_data = &net_buf_mem_pool_##_name, \ .alloc_data = &net_buf_mem_pool_##_name, \
}; \ }; \
static struct net_buf_pool _name __net_buf_align \ static STRUCT_SECTION_ITERABLE(net_buf_pool, _name) = \
__in_section(_net_buf_pool, static, _name) = \
NET_BUF_POOL_INITIALIZER(_name, &net_buf_data_alloc_##_name, \ NET_BUF_POOL_INITIALIZER(_name, &net_buf_data_alloc_##_name, \
_net_buf_##_name, _count, _ud_size, \ _net_buf_##_name, _count, _ud_size, \
_destroy) _destroy)