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:
parent
b2b8fdf539
commit
47bfb6fb4c
2 changed files with 12 additions and 2 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue