Skip to content

Commit

Permalink
kernel: arch: use ENOTSUP instead of ENOSYS in k_float_disable()
Browse files Browse the repository at this point in the history
This patch replaces ENOSYS into ENOTSUP to keep consistency with
the return value specification of k_float_enable().

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
  • Loading branch information
katsuster authored and carlescufi committed Mar 25, 2021
1 parent 59903e2 commit 19db485
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion arch/sparc/core/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/core/ia32/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}

Expand Down
6 changes: 3 additions & 3 deletions include/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion kernel/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}

Expand Down
4 changes: 2 additions & 2 deletions tests/kernel/fpu_sharing/float_disable/src/k_float_disable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 19db485

Please sign in to comment.