File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -588,6 +588,24 @@ static inline void rtio_iodev_sqe_err(struct rtio_iodev_sqe *iodev_sqe, int resu
588588 iodev_sqe -> r -> executor -> api -> err (iodev_sqe , result );
589589}
590590
591+ /**
592+ * @brief Cancel all requests that are pending for the iodev
593+ *
594+ * @param iodev IODev to cancel all requests for
595+ */
596+ static inline void rtio_iodev_cancel_all (struct rtio_iodev * iodev )
597+ {
598+ /* Clear pending requests as -ENODATA */
599+ struct rtio_mpsc_node * node = rtio_mpsc_pop (& iodev -> iodev_sq );
600+
601+ while (node != NULL ) {
602+ struct rtio_iodev_sqe * iodev_sqe = CONTAINER_OF (node , struct rtio_iodev_sqe , q );
603+
604+ rtio_iodev_sqe_err (iodev_sqe , - ECANCELED );
605+ node = rtio_mpsc_pop (& iodev -> iodev_sq );
606+ }
607+ }
608+
591609/**
592610 * Submit a completion queue event with a given result and userdata
593611 *
You can’t perform that action at this time.
0 commit comments