Instead of converting types let odp_event_free() to do the right thing.

Signed-off-by: Zoltan Kiss <zoltan.k...@linaro.org>
---
 example/timer/odp_timer_test.c                            |  2 +-
 platform/linux-generic/odp_schedule.c                     |  5 +----
 test/performance/odp_pktio_perf.c                         |  4 ++--
 test/performance/odp_scheduling.c                         |  4 +---
 test/validation/classification/odp_classification_tests.c |  2 +-
 test/validation/odp_pktio.c                               |  6 +++---
 test/validation/odp_scheduler.c                           | 11 +++--------
 test/validation/odp_timer.c                               |  2 +-
 8 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 735c4c6..6ea5773 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -167,7 +167,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls)
        /* Cancel and free last timer used */
        (void)odp_timer_cancel(ttp->tim, &ttp->ev);
        if (ttp->ev != ODP_EVENT_INVALID)
-               odp_timeout_free(odp_timeout_from_event(ttp->ev));
+               odp_event_free(ttp->ev);
        else
                EXAMPLE_ERR("Lost timeout event at timer cancel\n");
        /* Since we have cancelled the timer, there is no timeout event to
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 7fe42d7..9206d5c 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -328,10 +328,7 @@ int schedule_queue_init(queue_entry_t *qe)
 
 void schedule_queue_destroy(queue_entry_t *qe)
 {
-       odp_buffer_t buf;
-
-       buf = odp_buffer_from_event(qe->s.cmd_ev);
-       odp_buffer_free(buf);
+       odp_event_free(qe->s.cmd_ev);
 
        pri_clr_queue(queue_handle(qe), queue_prio(qe));
 
diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index fbe27a0..d362669 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -395,7 +395,7 @@ static void *run_thread_rx(void *arg TEST_UNUSED)
                                        stats->s.rx_ignore++;
                        }
 
-                       odp_buffer_free(odp_buffer_from_event(ev));
+                       odp_event_free(ev);
                } else if (odp_atomic_load_u32(&shutdown)) {
                        break;
                }
@@ -732,7 +732,7 @@ static int destroy_inq(odp_pktio_t pktio)
                        ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
 
                if (ev != ODP_EVENT_INVALID)
-                       odp_buffer_free(odp_buffer_from_event(ev));
+                       odp_event_free(ev);
                else
                        break;
        }
diff --git a/test/performance/odp_scheduling.c 
b/test/performance/odp_scheduling.c
index 99f0f9b..558fec8 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -69,7 +69,6 @@ typedef struct {
 static void clear_sched_queues(void)
 {
        odp_event_t ev;
-       odp_buffer_t buf;
 
        while (1) {
                ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
@@ -77,8 +76,7 @@ static void clear_sched_queues(void)
                if (ev == ODP_EVENT_INVALID)
                        break;
 
-               buf = odp_buffer_from_event(ev);
-               odp_buffer_free(buf);
+               odp_event_free(ev);
        }
 }
 
diff --git a/test/validation/classification/odp_classification_tests.c 
b/test/validation/classification/odp_classification_tests.c
index 131ac91..441c194 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -176,7 +176,7 @@ static int destroy_inq(odp_pktio_t pktio)
                ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
 
                if (ev != ODP_EVENT_INVALID)
-                       odp_buffer_free(odp_buffer_from_event(ev));
+                       odp_event_free(ev);
                else
                        break;
        }
diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index 7c1a666..090057b 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -283,7 +283,7 @@ static int destroy_inq(odp_pktio_t pktio)
                        ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
 
                if (ev != ODP_EVENT_INVALID)
-                       odp_buffer_free(odp_buffer_from_event(ev));
+                       odp_event_free(ev);
                else
                        break;
        }
@@ -332,7 +332,7 @@ static odp_packet_t wait_for_packet(odp_queue_t queue,
                        }
 
                        /* not interested in this event */
-                       odp_buffer_free(odp_buffer_from_event(ev));
+                       odp_event_free(ev);
                }
 
                now = odp_time_cycles();
@@ -550,7 +550,7 @@ static void test_odp_pktio_inq_remdef(void)
        for (i = 0; i < 100; i++) {
                ev = odp_schedule(NULL, ODP_TIME_MSEC);
                if (ev != ODP_EVENT_INVALID) {
-                       odp_buffer_free(odp_buffer_from_event(ev));
+                       odp_event_free(ev);
                        CU_FAIL("received unexpected event");
                }
        }
diff --git a/test/validation/odp_scheduler.c b/test/validation/odp_scheduler.c
index c2eb996..e4df4f2 100644
--- a/test/validation/odp_scheduler.c
+++ b/test/validation/odp_scheduler.c
@@ -67,10 +67,7 @@ static int exit_schedule_loop(void)
 
        while ((ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT))
              != ODP_EVENT_INVALID) {
-               odp_buffer_t buf;
-
-               buf = odp_buffer_from_event(ev);
-               odp_buffer_free(buf);
+               odp_event_free(ev);
                ret++;
        }
 
@@ -199,10 +196,8 @@ static void *schedule_common_(void *arg)
                        CU_ASSERT(num <= BURST_BUF_SIZE);
                        if (num == 0)
                                continue;
-                       for (j = 0; j < num; j++) {
-                               buf = odp_buffer_from_event(events[j]);
-                               odp_buffer_free(buf);
-                       }
+                       for (j = 0; j < num; j++)
+                               odp_event_free(events[j]);
                } else {
                        ev  = odp_schedule(&from, ODP_SCHED_NO_WAIT);
                        buf = odp_buffer_from_event(ev);
diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 554b353..d268808 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -424,7 +424,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
        CU_ASSERT(rc == 0);
        for (i = 0; i < NTIMERS; i++) {
                if (tt[i].ev != ODP_EVENT_INVALID)
-                       odp_timeout_free(odp_timeout_from_event(tt[i].ev));
+                       odp_event_free(tt[i].ev);
        }
 
        free(tt);
-- 
1.9.1

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to