Skip to content

rtio: More useful callback OPs #93227

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

teburd
Copy link
Contributor

@teburd teburd commented Jul 16, 2025

Callbacks now take a result parameter which may, if the callback was linked to by a previous submissions, have the result code from the last submission.

Additionally the callback op is now two, OP_CALLBACK and OP_CALLBACK_MUT where the primary difference is the arg0 parameter is mutable or immutable signaled by the const keyword.

Fixes #81014

DRAFT until a quick look at the API by folks I know who might be interested and agreement, will fix the rest then (tests, in tree code).

Copy link
Member

@ubieda ubieda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with the API. This is closer to what @bjarki-andreasen mentioned. Just left a question on which parameter to make const.

WRT the error linked to the callback: if we're getting the last-error, we may not get the root-cause errno: chained OPs end up ECANCELED if previous SQEs in the chain report an error; I'd suggest we consider ignoring those subsequent errors if possible.

@@ -693,7 +713,7 @@ static inline void rtio_sqe_prep_tiny_write(struct rtio_sqe *sqe,
*/
static inline void rtio_sqe_prep_callback(struct rtio_sqe *sqe,
rtio_callback_t callback,
void *arg0,
const void *arg0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you guys prefer arg0 vs userdata to be const? Not any preference but I was initially thinking the latter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly userdata being const in the sqe's makes good sense maybe more so, its meant to be an identifier/attached data thing that rtio stuff doesn't touch anyways, making it const probably makes more sense than making arg0 const

Callbacks now take a result parameter which may, if the callback was
linkd to by a previous submissions, have the result code from the last
submission.

Additionally the userdata is now const by default making it easier to
use the device pointer as the userdata which is very common.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drivers: sensors: rtio No error reporting from bus controller to application
3 participants