diff mbox series

[API-NEXT,v1,8/12] linux-gen: event: implement type multi

Message ID 1512140407-13534-9-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/12] api: event: add free multiple | expand

Commit Message

Github ODP bot Dec. 1, 2017, 3 p.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Simple implementation of the new event type multi function.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 318 (psavol:next-multi-apis)
 ** https://github.com/Linaro/odp/pull/318
 ** Patch: https://github.com/Linaro/odp/pull/318.patch
 ** Base sha: bdb7cbf620ada8682c89b5ae5a97cb84f16c0ed0
 ** Merge commit sha: aee2bcc574d2a8efdfcecc3b8e681ce391119798
 **/
 platform/linux-generic/odp_event.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c
index 2b0a7cddc..1c4ab5c1b 100644
--- a/platform/linux-generic/odp_event.c
+++ b/platform/linux-generic/odp_event.c
@@ -37,6 +37,22 @@  odp_event_type_t odp_event_types(odp_event_t event,
 	return _odp_buffer_event_type(buf);
 }
 
+int odp_event_type_multi(const odp_event_t event[], int num,
+			 odp_event_type_t *type_out)
+{
+	int i;
+	odp_event_type_t type = odp_event_type(event[0]);
+
+	for (i = 1; i < num; i++) {
+		if (odp_event_type(event[i]) != type)
+			break;
+	}
+
+	*type_out = type;
+
+	return i;
+}
+
 void odp_event_free(odp_event_t event)
 {
 	switch (odp_event_type(event)) {