device: deprecate (z_)device_usable_check
The functionality provided by device_usable_check is already provided by device_is_ready. The (z_)device_usable_check APIs have been re-implemented using the (z_)device_is_ready APIs and have been marked as deprecated. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
8b3560a119
commit
0b0435a96c
2 changed files with 33 additions and 40 deletions
|
@ -741,38 +741,6 @@ size_t z_device_get_all_static(const struct device * *devices);
|
|||
*/
|
||||
bool z_device_is_ready(const struct device *dev);
|
||||
|
||||
/** @brief Determine whether a device is ready for use
|
||||
*
|
||||
* This is the implementation underlying `device_usable_check()`, without the
|
||||
* overhead of a syscall wrapper.
|
||||
*
|
||||
* @param dev pointer to the device in question.
|
||||
*
|
||||
* @return a non-positive integer as documented in device_usable_check().
|
||||
*/
|
||||
static inline int z_device_usable_check(const struct device *dev)
|
||||
{
|
||||
return z_device_is_ready(dev) ? 0 : -ENODEV;
|
||||
}
|
||||
|
||||
/** @brief Determine whether a device is ready for use.
|
||||
*
|
||||
* This checks whether a device can be used, returning 0 if it can, and
|
||||
* distinct error values that identify the reason if it cannot.
|
||||
*
|
||||
* @retval 0 if the device is usable.
|
||||
* @retval -ENODEV if the device has not been initialized, the device pointer
|
||||
* is NULL or the initialization failed.
|
||||
* @retval other negative error codes to indicate additional conditions that
|
||||
* make the device unusable.
|
||||
*/
|
||||
__syscall int device_usable_check(const struct device *dev);
|
||||
|
||||
static inline int z_impl_device_usable_check(const struct device *dev)
|
||||
{
|
||||
return z_device_usable_check(dev);
|
||||
}
|
||||
|
||||
/** @brief Verify that a device is ready for use.
|
||||
*
|
||||
* Indicates whether the provided device pointer is for a device known to be
|
||||
|
@ -796,6 +764,39 @@ static inline bool z_impl_device_is_ready(const struct device *dev)
|
|||
return z_device_is_ready(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determine whether a device is ready for use
|
||||
*
|
||||
* This is equivalent to device_usable_check(), without the overhead of a
|
||||
* syscall wrapper.
|
||||
*
|
||||
* @deprecated Use z_device_is_ready() instead.
|
||||
*
|
||||
* @param dev Device instance.
|
||||
*
|
||||
* @retval 0 If device is usable.
|
||||
* @retval -ENODEV If device is not usable.
|
||||
*/
|
||||
__deprecated static inline int z_device_usable_check(const struct device *dev)
|
||||
{
|
||||
return z_device_is_ready(dev) ? 0 : -ENODEV;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determine whether a device is ready for use
|
||||
*
|
||||
* @deprecated Use device_is_ready() instead.
|
||||
*
|
||||
* @param dev Device instance.
|
||||
*
|
||||
* @retval 0 If device is usable.
|
||||
* @retval -ENODEV If device is not usable.
|
||||
*/
|
||||
__deprecated static inline int device_usable_check(const struct device *dev)
|
||||
{
|
||||
return device_is_ready(dev) ? 0 : -ENODEV;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue