diff mbox

linux-generic: timer: set timer queue to ODP_QUEUE_INVALID on init

Message ID 1435141152-25579-1-git-send-email-ivan.khoronzhuk@linaro.org
State Superseded
Headers show

Commit Message

Ivan Khoronzhuk June 24, 2015, 10:19 a.m. UTC
The set_next_free() checks if timer queue is not set, that is
ODP_QUEUE_INVALID. In case of linux-generic the invalid queue is 0.
By coincidence, after allocation, the timer queue is also 0, by this
way the ODP_ASSERT is masked. In case ODP_QUEUE_INVALID is another
from 0 the test generates error. It's not correct, the code shouldn't
have such kind dependency from macro definition, and it prevents to
re-use this code for another platforms with different
ODP_QUEUE_INVALID. So, fix it.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 platform/linux-generic/odp_timer.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ola Liljedahl June 24, 2015, 12:17 p.m. UTC | #1
On 24 June 2015 at 12:19, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
wrote:

> The set_next_free() checks if timer queue is not set, that is
> ODP_QUEUE_INVALID. In case of linux-generic the invalid queue is 0.
>
the invalid queue *handle* is 0.


> By coincidence, after allocation, the timer queue is also 0, by this
> way the ODP_ASSERT is masked. In case ODP_QUEUE_INVALID is another
> from 0 the test generates error. It's not correct, the code shouldn't
> have such kind dependency from macro definition, and it prevents to
> re-use this code for another platforms with different
> ODP_QUEUE_INVALID. So, fix it.
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>
Reviewed-by: Ola Liljedahl <ola.liljedahl@linaro.org>


> ---
>  platform/linux-generic/odp_timer.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/platform/linux-generic/odp_timer.c
> b/platform/linux-generic/odp_timer.c
> index 0d0f48b..68d7b11 100644
> --- a/platform/linux-generic/odp_timer.c
> +++ b/platform/linux-generic/odp_timer.c
> @@ -244,6 +244,7 @@ static odp_timer_pool *odp_timer_pool_new(
>         /* Initialize all odp_timer entries */
>         uint32_t i;
>         for (i = 0; i < tp->param.num_timers; i++) {
> +               tp->timers[i].queue = ODP_QUEUE_INVALID;
>                 set_next_free(&tp->timers[i], i + 1);
>                 tp->timers[i].user_ptr = NULL;
>                 odp_atomic_init_u64(&tp->tick_buf[i].exp_tck, TMO_UNUSED);
> --
> 1.9.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 0d0f48b..68d7b11 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -244,6 +244,7 @@  static odp_timer_pool *odp_timer_pool_new(
 	/* Initialize all odp_timer entries */
 	uint32_t i;
 	for (i = 0; i < tp->param.num_timers; i++) {
+		tp->timers[i].queue = ODP_QUEUE_INVALID;
 		set_next_free(&tp->timers[i], i + 1);
 		tp->timers[i].user_ptr = NULL;
 		odp_atomic_init_u64(&tp->tick_buf[i].exp_tck, TMO_UNUSED);