From d1813e547e8981ea6d0011a54143a65a348d42ec Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 17 Oct 2023 13:05:08 -0700 Subject: [PATCH] arm: using -EAGAIN directly instead of _k_neg_eagain _k_neg_eagain is there for used in assembly where including errno.h is not possible. However, the usage in ARM was simply to assign value to swap_return_value in a C file, which is no need to use _k_neg_eagain as errno.h can be included. So change that to use -EAGAIN directly. Saves 4 bytes in built binaries in rodata. Signed-off-by: Daniel Leung --- arch/arm/core/cortex_a_r/swap.c | 4 ++-- arch/arm/core/cortex_m/swap.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/cortex_a_r/swap.c b/arch/arm/core/cortex_a_r/swap.c index 258999be7c..2f7faba741 100644 --- a/arch/arm/core/cortex_a_r/swap.c +++ b/arch/arm/core/cortex_a_r/swap.c @@ -7,7 +7,7 @@ #include #include -extern const int _k_neg_eagain; +#include /* The 'key' actually represents the BASEPRI register * prior to disabling interrupts via the BASEPRI mechanism. @@ -18,7 +18,7 @@ int arch_swap(unsigned int key) { /* store off key and return value */ _current->arch.basepri = key; - _current->arch.swap_return_value = _k_neg_eagain; + _current->arch.swap_return_value = -EAGAIN; z_arm_cortex_r_svc(); irq_unlock(key); diff --git a/arch/arm/core/cortex_m/swap.c b/arch/arm/core/cortex_m/swap.c index f41ae2e4e8..9a597ef219 100644 --- a/arch/arm/core/cortex_m/swap.c +++ b/arch/arm/core/cortex_m/swap.c @@ -7,7 +7,7 @@ #include #include -extern const int _k_neg_eagain; +#include /* The 'key' actually represents the BASEPRI register * prior to disabling interrupts via the BASEPRI mechanism. @@ -34,7 +34,7 @@ int arch_swap(unsigned int key) { /* store off key and return value */ _current->arch.basepri = key; - _current->arch.swap_return_value = _k_neg_eagain; + _current->arch.swap_return_value = -EAGAIN; /* set pending bit to make sure we will take a PendSV exception */ SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;