From 19db48573723d9687183c5c8499a3ac9fed40d60 Mon Sep 17 00:00:00 2001 From: Katsuhiro Suzuki Date: Wed, 24 Mar 2021 01:54:15 +0900 Subject: [PATCH] kernel: arch: use ENOTSUP instead of ENOSYS in k_float_disable() This patch replaces ENOSYS into ENOTSUP to keep consistency with the return value specification of k_float_enable(). Signed-off-by: Katsuhiro Suzuki --- arch/sparc/core/thread.c | 2 +- arch/x86/core/ia32/thread.c | 2 +- include/kernel.h | 6 +++--- kernel/thread.c | 2 +- .../kernel/fpu_sharing/float_disable/src/k_float_disable.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/sparc/core/thread.c b/arch/sparc/core/thread.c index 2d5df753615..48c83408f09 100644 --- a/arch/sparc/core/thread.c +++ b/arch/sparc/core/thread.c @@ -76,7 +76,7 @@ void *z_arch_get_next_switch_handle(struct k_thread **old_thread) #if defined(CONFIG_FPU_SHARING) int arch_float_disable(struct k_thread *thread) { - return -ENOSYS; + return -ENOTSUP; } int arch_float_enable(struct k_thread *thread, unsigned int options) diff --git a/arch/x86/core/ia32/thread.c b/arch/x86/core/ia32/thread.c index cff38e92f88..3fe44abe221 100644 --- a/arch/x86/core/ia32/thread.c +++ b/arch/x86/core/ia32/thread.c @@ -56,7 +56,7 @@ int arch_float_disable(struct k_thread *thread) #if defined(CONFIG_LAZY_FPU_SHARING) return z_float_disable(thread); #else - return -ENOSYS; + return -ENOTSUP; #endif /* CONFIG_LAZY_FPU_SHARING */ } diff --git a/include/kernel.h b/include/kernel.h index 66c56b80a4f..332dec03409 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -5538,9 +5538,9 @@ __syscall void k_str_out(char *c, size_t n); * * @param thread ID of thread. * - * @retval 0 On success. - * @retval -ENOSYS If the floating point disabling is not implemented. - * -EINVAL If the floating point disabling could not be performed. + * @retval 0 On success. + * @retval -ENOTSUP If the floating point disabling is not implemented. + * -EINVAL If the floating point disabling could not be performed. */ __syscall int k_float_disable(struct k_thread *thread); diff --git a/kernel/thread.c b/kernel/thread.c index d479b46b2f7..3e2d2e6e197 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -880,7 +880,7 @@ int z_impl_k_float_disable(struct k_thread *thread) #if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) return arch_float_disable(thread); #else - return -ENOSYS; + return -ENOTSUP; #endif /* CONFIG_FPU && CONFIG_FPU_SHARING */ } diff --git a/tests/kernel/fpu_sharing/float_disable/src/k_float_disable.c b/tests/kernel/fpu_sharing/float_disable/src/k_float_disable.c index ce54868073f..56a3460ab09 100644 --- a/tests/kernel/fpu_sharing/float_disable/src/k_float_disable.c +++ b/tests/kernel/fpu_sharing/float_disable/src/k_float_disable.c @@ -36,7 +36,7 @@ static void usr_fp_thread_entry_1(void) (defined(CONFIG_X86) && defined(CONFIG_LAZY_FPU_SHARING)) #define K_FLOAT_DISABLE_SYSCALL_RETVAL 0 #else -#define K_FLOAT_DISABLE_SYSCALL_RETVAL -ENOSYS +#define K_FLOAT_DISABLE_SYSCALL_RETVAL -ENOTSUP #endif static void usr_fp_thread_entry_2(void) @@ -98,7 +98,7 @@ void test_k_float_disable_common(void) usr_fp_thread.base.user_options); #else /* Verify k_float_disable() is not supported */ - zassert_true((k_float_disable(&usr_fp_thread) == -ENOSYS), + zassert_true((k_float_disable(&usr_fp_thread) == -ENOTSUP), "k_float_disable() successful when not supported"); #endif }