sys_sem: straighten build time definition macros
Commit db48d3e22a
("sys_sem: add build time definition macros")
recently introduced SYS_SEM_DEFINE() and defined it in terms of
Z_DECL_ALIGN() and __in_section() to force the _k_sem linker section.
It is however cleaner and less obscur to use Z_STRUCT_SECTION_ITERABLE()
and list the _sys_sem linker section alongside the _k_sem one.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
parent
844d5b403c
commit
70c4aa4293
2 changed files with 2 additions and 2 deletions
|
@ -80,6 +80,7 @@
|
||||||
{
|
{
|
||||||
_k_sem_list_start = .;
|
_k_sem_list_start = .;
|
||||||
KEEP(*("._k_sem.static.*"))
|
KEEP(*("._k_sem.static.*"))
|
||||||
|
KEEP(*("._sys_sem.static.*"))
|
||||||
_k_sem_list_end = .;
|
_k_sem_list_end = .;
|
||||||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,7 @@ struct sys_sem {
|
||||||
* are identical and can be treated as a k_sem in the boot initialization code
|
* are identical and can be treated as a k_sem in the boot initialization code
|
||||||
*/
|
*/
|
||||||
#define SYS_SEM_DEFINE(_name, _initial_count, _count_limit) \
|
#define SYS_SEM_DEFINE(_name, _initial_count, _count_limit) \
|
||||||
Z_DECL_ALIGN(struct sys_sem) _name \
|
Z_STRUCT_SECTION_ITERABLE(sys_sem, _name) = { \
|
||||||
__in_section(_k_sem, static, _name) = { \
|
|
||||||
.kernel_sem = Z_SEM_INITIALIZER(_name.kernel_sem, \
|
.kernel_sem = Z_SEM_INITIALIZER(_name.kernel_sem, \
|
||||||
_initial_count, _count_limit) \
|
_initial_count, _count_limit) \
|
||||||
}; \
|
}; \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue