From 65fc5b7f17e47ebe51a6d00f41e3d61a412e02f2 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Thu, 16 May 2024 15:22:44 -0700 Subject: [PATCH] device: Remove z_device_is_ready This duplicates the functionality of device_is_ready. Calls for z_device_is_ready are being done in kernel mode, so it is safe to call its implementation directly. Signed-off-by: Flavio Ceolin --- include/zephyr/device.h | 21 --------------------- kernel/device.c | 6 +++--- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/include/zephyr/device.h b/include/zephyr/device.h index ddc69c17fd5..5d891c1e9ef 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -729,22 +729,6 @@ __syscall const struct device *device_get_binding(const char *name); */ size_t z_device_get_all_static(const struct device **devices); -/** - * @brief Verify that a device is ready for use. - * - * This is the implementation underlying device_is_ready(), without the overhead - * of a syscall wrapper. - * - * @param dev pointer to the device in question. - * - * @retval true If the device is ready for use. - * @retval false If the device is not ready for use or if a NULL device pointer - * is passed as argument. - * - * @see device_is_ready() - */ -bool z_device_is_ready(const struct device *dev); - /** * @brief Verify that a device is ready for use. * @@ -763,11 +747,6 @@ bool z_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 z_device_is_ready(dev); -} - /** * @brief Initialize a device. * diff --git a/kernel/device.c b/kernel/device.c index 45806fc9e76..37233f58372 100644 --- a/kernel/device.c +++ b/kernel/device.c @@ -40,13 +40,13 @@ const struct device *z_impl_device_get_binding(const char *name) * performed. Reserve string comparisons for a fallback. */ STRUCT_SECTION_FOREACH(device, dev) { - if (z_device_is_ready(dev) && (dev->name == name)) { + if (z_impl_device_is_ready(dev) && (dev->name == name)) { return dev; } } STRUCT_SECTION_FOREACH(device, dev) { - if (z_device_is_ready(dev) && (strcmp(name, dev->name) == 0)) { + if (z_impl_device_is_ready(dev) && (strcmp(name, dev->name) == 0)) { return dev; } } @@ -87,7 +87,7 @@ size_t z_device_get_all_static(struct device const **devices) return cnt; } -bool z_device_is_ready(const struct device *dev) +bool z_impl_device_is_ready(const struct device *dev) { /* * if an invalid device pointer is passed as argument, this call