diff --git a/include/device.h b/include/device.h index ecb8be50f4a..2c2276e699f 100644 --- a/include/device.h +++ b/include/device.h @@ -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 * 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); } /** diff --git a/kernel/device.c b/kernel/device.c index 72ba96834ce..7934113f2a0 100644 --- a/kernel/device.c +++ b/kernel/device.c @@ -141,6 +141,14 @@ static inline int z_vrfy_device_usable_check(const struct device *dev) return z_impl_device_usable_check(dev); } #include + +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 #endif /* CONFIG_USERSPACE */ size_t z_device_get_all_static(struct device const **devices)