device: implement device_is_ready as syscall

Instead of using device_usable_check() syscall, implement a new syscall
for device_is_ready that uses z_device_is_ready underneath.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-12-23 17:21:41 +01:00 committed by Anas Nashif
commit 47bfb6fb4c
2 changed files with 12 additions and 2 deletions

View file

@ -789,9 +789,11 @@ static inline int z_impl_device_usable_check(const struct device *dev)
* @retval false if the device is not ready for use or if a NULL device pointer * @retval false if the device is not ready for use or if a NULL device pointer
* is passed as argument. * is passed as argument.
*/ */
static inline bool device_is_ready(const struct device *dev) __syscall bool device_is_ready(const struct device *dev);
static inline bool z_impl_device_is_ready(const struct device *dev)
{ {
return device_usable_check(dev) == 0; return z_device_is_ready(dev);
} }
/** /**

View file

@ -141,6 +141,14 @@ static inline int z_vrfy_device_usable_check(const struct device *dev)
return z_impl_device_usable_check(dev); return z_impl_device_usable_check(dev);
} }
#include <syscalls/device_usable_check_mrsh.c> #include <syscalls/device_usable_check_mrsh.c>
static inline bool z_vrfy_device_is_ready(const struct device *dev)
{
Z_OOPS(Z_SYSCALL_OBJ_INIT(dev, K_OBJ_ANY));
return z_impl_device_is_ready(dev);
}
#include <syscalls/device_is_ready_mrsh.c>
#endif /* CONFIG_USERSPACE */ #endif /* CONFIG_USERSPACE */
size_t z_device_get_all_static(struct device const **devices) size_t z_device_get_all_static(struct device const **devices)