From 407ea645a020e6b3765764a0de958dd0c87bc080 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 22 Jun 2021 16:51:47 -0700 Subject: [PATCH] drivers: ps2: Fix syscalls handlers This driver was using a very old macro to declare a syscall. Fix syscall handlers. Fixes #23745 Signed-off-by: Flavio Ceolin --- drivers/ps2/ps2_handlers.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/ps2/ps2_handlers.c b/drivers/ps2/ps2_handlers.c index 8cb0712b0c4..414e14f315d 100644 --- a/drivers/ps2/ps2_handlers.c +++ b/drivers/ps2/ps2_handlers.c @@ -7,33 +7,41 @@ #include #include -Z_SYSCALL_HANDLER(ps2_config, dev, callback_isr) +static inline int z_vrfy_ps2_config(const struct device *dev, + ps2_callback_t callback_isr) { Z_OOPS(Z_SYSCALL_DRIVER_PS2(dev, config)); - Z_OOPS(Z_SYSCALL_VERIFY_MSG(callback_isr == 0, + Z_OOPS(Z_SYSCALL_VERIFY_MSG(callback_isr == NULL, "callback not be set from user mode")); - return z_impl_ps2_config((const struct device *)dev, callback_isr); + return z_impl_ps2_config(dev, callback_isr); } +#include -Z_SYSCALL_HANDLER(ps2_write, dev, value) +static inline int z_vrfy_ps2_write(const struct device *dev, uint8_t value) { Z_OOPS(Z_SYSCALL_DRIVER_PS2(dev, write)); - return z_impl_ps2_write((const struct device *)dev, value); + return z_impl_ps2_write(dev, value); } +#include -Z_SYSCALL_HANDLER(ps2_read, dev, value) +static inline int z_vrfy_ps2_read(const struct device *dev, uint8_t *value) { Z_OOPS(Z_SYSCALL_DRIVER_PS2(dev, read)); Z_OOPS(Z_SYSCALL_MEMORY_WRITE(value, sizeof(uint8_t))); - return z_impl_ps2_read((const struct device *)dev, (uint32_t *)value); + return z_impl_ps2_read(dev, (uint32_t *)value); } +#include -Z_SYSCALL_HANDLER(ps2_enable_callback) +static inline int z_vrfy_ps2_enable_callback(const struct device *dev) { - return z_impl_ps2_enable_callback((const struct device *)dev); + Z_OOPS(Z_SYSCALL_DRIVER_PS2(dev, enable_callback)); + return z_impl_ps2_enable_callback(dev); } +#include -Z_SYSCALL_HANDLER(ps2_disable_callback, dev) +static inline int z_vrfy_ps2_disable_callback(const struct device *dev) { - return z_impl_ps2_disable_callback((const struct device *)dev); + Z_OOPS(Z_SYSCALL_DRIVER_PS2(dev, disable_callback)); + return z_impl_ps2_disable_callback(dev); } +#include