-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
device: Remove z_device_is_ready #72906
Conversation
@@ -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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you calling the implementation directly here and not using device_is_ready
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we get here, it is already in kernel mode, so there is no need to do the check again whether you are in user mode or kernel mode (as in the syscall wrapper). Note that the wrapper calls the z_impl_*
directly if already in kernel mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we agree that calling implementation (z_impl) in general should not be the norm and that any direct usage of the implementation function need some justification? If yes, this justifcation should be in the commit message, i.e. what @dcpleung wrote above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nashif I have update the commit msg. Please take a look again.
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 <flavio.ceolin@intel.com>
This duplicates the functionality of device_is_ready.