diff mbox

[API-NEXT] linux-generic: tm: use intermediate casts to avoid strict warnings

Message ID 1448909109-2721-1-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit d8c3a1326a0f1e9dc56cb93dd4eaca3908bb8509
Headers show

Commit Message

Bill Fischofer Nov. 30, 2015, 6:45 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 .../include/odp_traffic_mngr_internal.h            | 15 +++---
 platform/linux-generic/odp_name_table.c            | 58 ++++++++++++----------
 platform/linux-generic/odp_pkt_queue.c             | 12 ++---
 platform/linux-generic/odp_sorted_list.c           | 16 +++---
 platform/linux-generic/odp_timer_wheel.c           | 18 +++----
 platform/linux-generic/odp_traffic_mngr.c          |  4 +-
 6 files changed, 67 insertions(+), 56 deletions(-)

Comments

Mike Holmes Nov. 30, 2015, 7:22 p.m. UTC | #1
On 30 November 2015 at 13:45, Bill Fischofer <bill.fischofer@linaro.org>
wrote:

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

>


Reviewed-by: Mike Holmes <mike.holmes@linaro.org>



> ---

>  .../include/odp_traffic_mngr_internal.h            | 15 +++---

>  platform/linux-generic/odp_name_table.c            | 58

> ++++++++++++----------

>  platform/linux-generic/odp_pkt_queue.c             | 12 ++---

>  platform/linux-generic/odp_sorted_list.c           | 16 +++---

>  platform/linux-generic/odp_timer_wheel.c           | 18 +++----

>  platform/linux-generic/odp_traffic_mngr.c          |  4 +-

>  6 files changed, 67 insertions(+), 56 deletions(-)

>

> diff --git a/platform/linux-generic/include/odp_traffic_mngr_internal.h

> b/platform/linux-generic/include/odp_traffic_mngr_internal.h

> index c2d5cf4..e48e213 100644

> --- a/platform/linux-generic/include/odp_traffic_mngr_internal.h

> +++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h

> @@ -48,8 +48,8 @@ typedef struct stat  file_stat_t;

>

>  /* Macros to convert handles to internal pointers and vice versa. */

>

> -#define MAKE_ODP_TM_HANDLE(tm_system)  ((odp_tm_t)tm_system)

> -#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t *)odp_tm)

> +#define MAKE_ODP_TM_HANDLE(tm_system)  ((odp_tm_t)(uintptr_t)tm_system)

> +#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t *)(uintptr_t)odp_tm)

>

>  #define MAKE_PROFILE_HANDLE(profile_kind, tbl_idx) \

>         (((profile_kind & 0xF) << 28) | ((tbl_idx + 1) & 0xFFFFFFF))

> @@ -59,11 +59,14 @@ typedef struct stat  file_stat_t;

>

>  #define GET_TBL_IDX(profile_handle)  ((profile_handle & 0xFFFFFFF) - 1)

>

> -#define MAKE_ODP_TM_NODE(tm_node_obj)  ((odp_tm_node_t)(tm_node_obj))

> -#define GET_TM_NODE_OBJ(odp_tm_node)   ((tm_node_obj_t *)(odp_tm_node))

> +#define MAKE_ODP_TM_NODE(tm_node_obj)

> ((odp_tm_node_t)(uintptr_t)(tm_node_obj))

> +#define GET_TM_NODE_OBJ(odp_tm_node) \

> +       ((tm_node_obj_t *)(uintptr_t)(odp_tm_node))

>

> -#define MAKE_ODP_TM_QUEUE(tm_queue_obj)  ((odp_tm_queue_t)(tm_queue_obj))

> -#define GET_TM_QUEUE_OBJ(odp_tm_queue)   ((tm_queue_obj_t

> *)(odp_tm_queue))

> +#define MAKE_ODP_TM_QUEUE(tm_queue_obj) \

> +       ((odp_tm_queue_t)(uintptr_t)(tm_queue_obj))

> +#define GET_TM_QUEUE_OBJ(odp_tm_queue) \

> +       ((tm_queue_obj_t *)(uintptr_t)(odp_tm_queue))

>

>  typedef uint64_t tm_handle_t;

>

> diff --git a/platform/linux-generic/odp_name_table.c

> b/platform/linux-generic/odp_name_table.c

> index 10ce099..10a760e 100644

> --- a/platform/linux-generic/odp_name_table.c

> +++ b/platform/linux-generic/odp_name_table.c

> @@ -567,7 +567,7 @@ static hash_tbl_entry_t

> make_hash_tbl_entry(name_tbl_entry_t *name_tbl_entry,

>         uint32_t         new_entry_cnt;

>

>         new_entry_cnt   = MIN(entry_cnt + 1, 0x3F);

> -       hash_tbl_entry  = (hash_tbl_entry_t)name_tbl_entry;

> +       hash_tbl_entry  = (hash_tbl_entry_t)(uintptr_t)name_tbl_entry;

>         hash_tbl_entry &= ~0x3F;

>         hash_tbl_entry |= new_entry_cnt;

>         return hash_tbl_entry;

> @@ -584,18 +584,18 @@ static name_tbl_entry_t

> *name_hash_tbl_lookup(uint32_t hash_value)

>         if (hash_tbl_entry == 0)

>                 return NULL;

>         else if ((hash_tbl_entry & 0x3F) != 0)

> -               return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);

> +               return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>

>         /* This hash_tbl_entry references a secondary hash table, so get

>         * some more hash_value bits and index that table.

>         */

>         hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE -

> 1);

> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

> +       secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;

>         hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>         if (hash_tbl_entry == 0)

>                 return NULL;

>         else if ((hash_tbl_entry & 0x3F) != 0)

> -               return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);

> +               return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>

>         /* Yet again, this hash_tbl_entry references a secondary hash

> table,

>         * so get some more hash_value bits and index that table.  We only

> @@ -604,12 +604,12 @@ static name_tbl_entry_t

> *name_hash_tbl_lookup(uint32_t hash_value)

>         * returning NULL.

>         */

>         hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE -

> 1);

> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

> +       secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;

>         hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>         if (hash_tbl_entry == 0)

>                 return NULL;

>         else if ((hash_tbl_entry & 0x3F) != 0)

> -               return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);

> +               return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>

>         return NULL;

>  }

> @@ -655,7 +655,8 @@ static hash_tbl_entry_t

> secondary_hash_add(name_tbl_entry_t *name_tbl_entry,

>

>                 hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>                 entry_cnt      = hash_tbl_entry & 0x3F;

> -               first_entry    = (name_tbl_entry_t *)(hash_tbl_entry &

> ~0x3F);

> +               first_entry    =

> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>

>                 name_tbl_entry->next_entry = first_entry;

>                 new_hash_tbl_entry =

> @@ -666,7 +667,7 @@ static hash_tbl_entry_t

> secondary_hash_add(name_tbl_entry_t *name_tbl_entry,

>         }

>

>         /* secondary_hash_dump(secondary_hash); */

> -       return (hash_tbl_entry_t)secondary_hash;

> +       return (hash_tbl_entry_t)(uintptr_t)secondary_hash;

>  }

>

>  static hash_tbl_entry_t hash_tbl_remove(secondary_hash_tbl_t *hash_tbl,

> @@ -693,11 +694,11 @@ static hash_tbl_entry_t

> hash_tbl_remove(secondary_hash_tbl_t *hash_tbl,

>                                  * new entry onto the front of it.

>                                  */

>                                 head_entry = (name_tbl_entry_t *)

> -                                       (hash_tbl_entry & ~0x3F);

> +                                       (uintptr_t)(hash_tbl_entry &

> ~0x3F);

>                                 tail_entry = head_entry;

>                         } else {

>                                 secondary_hash = (secondary_hash_tbl_t *)

> -                                       hash_tbl_entry;

> +                                       (uintptr_t)hash_tbl_entry;

>                                 check_secondary_hash(secondary_hash);

>                                 if (level == 1)

>                                         break;

> @@ -758,7 +759,8 @@ static int name_hash_tbl_add(name_tbl_entry_t

> *entry_to_add,

>                 /* This primary hash table entry points to a

> name_tbl_entry_t

>                  * linked list, so add this new entry onto the front of it.

>                  */

> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

> ~0x3F);

> +               name_tbl_entry =

> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>                 entry_to_add->next_entry = name_tbl_entry;

>                 hash_tbl_entry = make_hash_tbl_entry(entry_to_add,

> entry_cnt);

>                 name_hash_tbl.hash_entries[primary_hash_idx] =

> hash_tbl_entry;

> @@ -783,7 +785,7 @@ static int name_hash_tbl_add(name_tbl_entry_t

> *entry_to_add,

>         * some more hash_value bits and index that table.

>         */

>         hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE -

> 1);

> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

> +       secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;

>         check_secondary_hash(secondary_hash);

>         hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>         entry_cnt      = hash_tbl_entry & 0x3F;

> @@ -799,7 +801,8 @@ static int name_hash_tbl_add(name_tbl_entry_t

> *entry_to_add,

>                  * name_tbl_entry_t linked list, so add this new entry onto

>                  * the front of it.

>                  */

> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

> ~0x3F);

> +               name_tbl_entry =

> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>                 entry_to_add->next_entry = name_tbl_entry;

>                 hash_tbl_entry = make_hash_tbl_entry(entry_to_add,

> entry_cnt);

>                 secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;

> @@ -827,7 +830,7 @@ static int name_hash_tbl_add(name_tbl_entry_t

> *entry_to_add,

>         * signal failure by returning -1.

>         */

>         hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE -

> 1);

> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

> +       secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;

>         check_secondary_hash(secondary_hash);

>         hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>         entry_cnt      = hash_tbl_entry & 0x3F;

> @@ -846,7 +849,8 @@ static int name_hash_tbl_add(name_tbl_entry_t

> *entry_to_add,

>                  * linked list, we never add another hash table, so we

> don't

>                  * need to update any secondary table counts.

>                  */

> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

> ~0x3F);

> +               name_tbl_entry =

> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>                 entry_to_add->next_entry = name_tbl_entry;

>                 hash_tbl_entry = make_hash_tbl_entry(entry_to_add,

> entry_cnt);

>                 secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;

> @@ -875,7 +879,8 @@ static int name_tbl_entry_list_remove(hash_tbl_entry_t

> *hash_entry_ptr,

>                          * deleted.

>                          */

>                         if (!prev_entry) {

> -                               hash_tbl_entry  =

> (hash_tbl_entry_t)next_entry;

> +                               hash_tbl_entry  =

> +

>  (hash_tbl_entry_t)(uintptr_t)next_entry;

>                                 hash_tbl_entry &= ~0x3F;

>                                 hash_tbl_entry |= entry_cnt;

>                                 *hash_entry_ptr = hash_tbl_entry;

> @@ -922,7 +927,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t

> *entry_to_delete,

>                 /* This primary hash table entry points to a

> name_tbl_entry_t

>                  * linked list, so remove entry from this linked list.

>                  */

> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

> ~0x3F);

> +               name_tbl_entry =

> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>                 rc = name_tbl_entry_list_remove(hash_entry_ptr,

> name_tbl_entry,

>                                                 entry_to_delete,

> entry_cnt);

>                 tbn = (*hash_entry_ptr) & ~0x3F;

> @@ -940,7 +946,7 @@ static int name_hash_tbl_delete(name_tbl_entry_t

> *entry_to_delete,

>         * some more hash_value bits and index that table.

>         */

>         hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE -

> 1);

> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

> +       secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;

>         check_secondary_hash(secondary_hash);

>         hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];

>         hash_tbl_entry = *hash_entry_ptr;

> @@ -955,7 +961,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t

> *entry_to_delete,

>                  * name_tbl_entry_t linked list, so try to remove

>                  * entry_to_delete from this linked list.

>                  */

> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

> ~0x3F);

> +               name_tbl_entry =

> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>                 rc = name_tbl_entry_list_remove(hash_entry_ptr,

> name_tbl_entry,

>                                                 entry_to_delete,

> entry_cnt);

>                 tbn = (*hash_entry_ptr) & ~0x3F;

> @@ -988,7 +995,7 @@ static int name_hash_tbl_delete(name_tbl_entry_t

> *entry_to_delete,

>         * signal failure by returning -1.

>         */

>         hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE -

> 1);

> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

> +       secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;

>         check_secondary_hash(secondary_hash);

>         hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];

>         hash_tbl_entry = *hash_entry_ptr;

> @@ -1003,7 +1010,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t

> *entry_to_delete,

>                  * name_tbl_entry_t linked list, so try to remove

>                  * entry_to_delete from this linked list.

>                  */

> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

> ~0x3F);

> +               name_tbl_entry =

> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

> ~0x3F);

>                 rc = name_tbl_entry_list_remove(hash_entry_ptr,

> name_tbl_entry,

>                                                 entry_to_delete,

> entry_cnt);

>                 tbn = (*hash_entry_ptr) & ~0x3F;

> @@ -1172,7 +1180,7 @@ static uint32_t

> level2_hash_histo(secondary_hash_tbl_t *hash_tbl,

>                         collisions = 0;

>                 } else {

>                         name_tbl_entry = (name_tbl_entry_t *)

> -                               (hash_tbl_entry & ~0x3F);

> +                               (uintptr_t)(hash_tbl_entry & ~0x3F);

>                         collisions     = linked_list_len(name_tbl_entry);

>                 }

>

> @@ -1199,11 +1207,11 @@ static uint32_t

> level1_hash_histo(secondary_hash_tbl_t *hash_tbl,

>                         collisions = 0;

>                 } else if ((hash_tbl_entry & 0x3F) != 0) {

>                         name_tbl_entry = (name_tbl_entry_t *)

> -                               (hash_tbl_entry & ~0x3F);

> +                               (uintptr_t)(hash_tbl_entry & ~0x3F);

>                         collisions     = linked_list_len(name_tbl_entry);

>                 } else {

>                         secondary_hash = (secondary_hash_tbl_t *)

> -                               hash_tbl_entry;

> +                               (uintptr_t)hash_tbl_entry;

>                         collisions     = level2_hash_histo(secondary_hash,

>                                                            level2_histo);

>                 }

> @@ -1232,7 +1240,7 @@ static void secondary_hash_histo_print(void)

>                          * hash table

>                          */

>                         secondary_hash = (secondary_hash_tbl_t *)

> -                               hash_tbl_entry;

> +                               (uintptr_t)hash_tbl_entry;

>                         level1_hash_histo(secondary_hash, level1_histo,

>                                           level2_histo);

>                 }

> diff --git a/platform/linux-generic/odp_pkt_queue.c

> b/platform/linux-generic/odp_pkt_queue.c

> index 45508eb..88520b1 100644

> --- a/platform/linux-generic/odp_pkt_queue.c

> +++ b/platform/linux-generic/odp_pkt_queue.c

> @@ -215,7 +215,7 @@ _odp_int_queue_pool_t _odp_queue_pool_create(uint32_t

> max_num_queues,

>

>         pool->min_free_list_size = pool->free_list_size;

>         pool->peak_free_list_size = pool->free_list_size;

> -       return (_odp_int_queue_pool_t)pool;

> +       return (_odp_int_queue_pool_t)(uintptr_t)pool;

>  }

>

>  _odp_int_pkt_queue_t _odp_pkt_queue_create(_odp_int_queue_pool_t

> queue_pool)

> @@ -223,7 +223,7 @@ _odp_int_pkt_queue_t

> _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool)

>         queue_pool_t *pool;

>         uint32_t queue_num;

>

> -       pool = (queue_pool_t *)queue_pool;

> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>         queue_num = pool->next_queue_num++;

>         if (pool->max_queue_num < queue_num)

>                 return _ODP_INT_PKT_QUEUE_INVALID;

> @@ -239,7 +239,7 @@ int _odp_pkt_queue_append(_odp_int_queue_pool_t

> queue_pool,

>         uint32_t queue_num, first_blk_idx, tail_blk_idx, new_tail_blk_idx;

>         uint32_t idx;

>

> -       pool = (queue_pool_t *)queue_pool;

> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>         queue_num = (uint32_t)pkt_queue;

>         if ((queue_num == 0) || (pool->max_queue_num < queue_num))

>                 return -2;

> @@ -296,7 +296,7 @@ int _odp_pkt_queue_remove(_odp_int_queue_pool_t

> queue_pool,

>         queue_blk_t *first_blk, *second_blk;

>         uint32_t queue_num, first_blk_idx, next_blk_idx, idx;

>

> -       pool = (queue_pool_t *)queue_pool;

> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>         queue_num = (uint32_t)pkt_queue;

>         if ((queue_num == 0) || (pool->max_queue_num < queue_num))

>                 return -2;

> @@ -347,7 +347,7 @@ void _odp_pkt_queue_stats_print(_odp_int_queue_pool_t

> queue_pool)

>  {

>         queue_pool_t *pool;

>

> -       pool = (queue_pool_t *)queue_pool;

> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>         ODP_DBG("pkt_queue_stats - queue_pool=0x%lX\n", queue_pool);

>         ODP_DBG("  max_queue_num=%u max_queued_pkts=%u

> next_queue_num=%u\n",

>                 pool->max_queue_num, pool->max_queued_pkts,

> @@ -367,7 +367,7 @@ void _odp_queue_pool_destroy(_odp_int_queue_pool_t

> queue_pool)

>         queue_pool_t *pool;

>         uint32_t idx;

>

> -       pool = (queue_pool_t *)queue_pool;

> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>         for (idx = 0; idx < 16; idx++) {

>                 queue_region_desc = &pool->queue_region_descs[idx];

>                 if (queue_region_desc->queue_blks)

> diff --git a/platform/linux-generic/odp_sorted_list.c

> b/platform/linux-generic/odp_sorted_list.c

> index 221754d..5811266 100644

> --- a/platform/linux-generic/odp_sorted_list.c

> +++ b/platform/linux-generic/odp_sorted_list.c

> @@ -56,7 +56,7 @@ _odp_int_sorted_pool_t _odp_sorted_pool_create(uint32_t

> max_sorted_lists)

>         list_descs = malloc(malloc_len);

>         memset(list_descs, 0, malloc_len);

>         pool->list_descs = list_descs;

> -       return (_odp_int_sorted_pool_t)pool;

> +       return (_odp_int_sorted_pool_t)(uintptr_t)pool;

>  }

>

>  _odp_int_sorted_list_t

> @@ -66,7 +66,7 @@ _odp_sorted_list_create(_odp_int_sorted_pool_t

> sorted_pool,

>         sorted_pool_t *pool;

>         uint32_t       list_idx;

>

> -       pool     = (sorted_pool_t *)sorted_pool;

> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>         list_idx = pool->next_list_idx++;

>         return (_odp_int_sorted_list_t)list_idx;

>  }

> @@ -81,7 +81,7 @@ int _odp_sorted_list_insert(_odp_int_sorted_pool_t

> sorted_pool,

>         sorted_pool_t      *pool;

>         uint32_t            list_idx;

>

> -       pool     = (sorted_pool_t *)sorted_pool;

> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>         list_idx = (uint32_t)sorted_list;

>         if ((pool->next_list_idx    <= list_idx) ||

>             (pool->max_sorted_lists <= list_idx))

> @@ -125,7 +125,7 @@ int _odp_sorted_list_find(_odp_int_sorted_pool_t

> sorted_pool,

>         sorted_pool_t      *pool;

>         uint32_t            list_idx;

>

> -       pool     = (sorted_pool_t *)sorted_pool;

> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>         list_idx = (uint32_t)sorted_list;

>         if ((pool->next_list_idx    <= list_idx) ||

>             (pool->max_sorted_lists <= list_idx))

> @@ -161,7 +161,7 @@ int _odp_sorted_list_delete(_odp_int_sorted_pool_t

> sorted_pool,

>         sorted_pool_t      *pool;

>         uint32_t            list_idx;

>

> -       pool     = (sorted_pool_t *)sorted_pool;

> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>         list_idx = (uint32_t)sorted_list;

>         if ((pool->next_list_idx    <= list_idx) ||

>             (pool->max_sorted_lists <= list_idx))

> @@ -207,7 +207,7 @@ int _odp_sorted_list_remove(_odp_int_sorted_pool_t

> sorted_pool,

>         sorted_pool_t      *pool;

>         uint32_t            list_idx;

>

> -       pool     = (sorted_pool_t *)sorted_pool;

> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>         list_idx = (uint32_t)sorted_list;

>         if ((pool->next_list_idx    <= list_idx) ||

>             (pool->max_sorted_lists <= list_idx))

> @@ -237,7 +237,7 @@ void

> _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool)

>  {

>         sorted_pool_t *pool;

>

> -       pool = (sorted_pool_t *)sorted_pool;

> +       pool = (sorted_pool_t *)(uintptr_t)sorted_pool;

>         ODP_DBG("sorted_pool=0x%lX\n", sorted_pool);

>         ODP_DBG("  max_sorted_lists=%u next_list_idx=%u\n",

>                 pool->max_sorted_lists, pool->next_list_idx);

> @@ -253,7 +253,7 @@ void _odp_sorted_pool_destroy(_odp_int_sorted_pool_t

> sorted_pool)

>         sorted_pool_t       *pool;

>         uint32_t             list_idx;

>

> -       pool       = (sorted_pool_t *)sorted_pool;

> +       pool       = (sorted_pool_t *)(uintptr_t)sorted_pool;

>         list_descs = pool->list_descs;

>

>         for (list_idx = 0; list_idx < pool->next_list_idx; list_idx++) {

> diff --git a/platform/linux-generic/odp_timer_wheel.c

> b/platform/linux-generic/odp_timer_wheel.c

> index bcab01b..21be3ef 100644

> --- a/platform/linux-generic/odp_timer_wheel.c

> +++ b/platform/linux-generic/odp_timer_wheel.c

> @@ -748,7 +748,7 @@ _odp_timer_wheel_t _odp_timer_wheel_create(uint32_t

> max_concurrent_timers,

>         free_list_add(timer_wheels, max_concurrent_timers / 4);

>         timer_wheels->min_free_list_size  = timer_wheels->free_list_size;

>         timer_wheels->peak_free_list_size = timer_wheels->free_list_size;

> -       return (_odp_timer_wheel_t)timer_wheels;

> +       return (_odp_timer_wheel_t)(uintptr_t)timer_wheels;

>  }

>

>  uint32_t _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel,

> @@ -759,7 +759,7 @@ uint32_t

> _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel,

>         uint32_t        desc_idx;

>         int             rc;

>

> -       timer_wheels      = (timer_wheels_t *)timer_wheel;

> +       timer_wheels      = (timer_wheels_t *)(uintptr_t)timer_wheel;

>         new_current_ticks = current_time >> CYCLES_TO_TICKS_SHIFT;

>         elapsed_ticks     = new_current_ticks -

> timer_wheels->current_ticks;

>         if (elapsed_ticks == 0)

> @@ -787,13 +787,13 @@ int _odp_timer_wheel_insert(_odp_timer_wheel_t

> timer_wheel,

>         uint64_t        user_data, wakeup_ticks;

>         int             rc;

>

> -       user_data = (uint64_t)user_ptr;

> +       user_data = (uint64_t)(uintptr_t)user_ptr;

>         if (user_data == 0)

>                 return -4;  /* user_data cannot be 0! */

>         else if ((user_data & 0x3) != 0)

>                 return -5;  /* user_data ptr must be at least 4-byte

> aligned. */

>

> -       timer_wheels = (timer_wheels_t *)timer_wheel;

> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>         wakeup_ticks = (wakeup_time >> CYCLES_TO_TICKS_SHIFT) + 1;

>         if (wakeup_time <= timer_wheels->current_ticks)

>                 return -6;

> @@ -828,21 +828,21 @@ void

> *_odp_timer_wheel_next_expired(_odp_timer_wheel_t timer_wheel)

>         int             rc;

>

>         /* Remove the head of the timer wheel. */

> -       timer_wheels = (timer_wheels_t *)timer_wheel;

> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>         rc = expired_timers_remove(timer_wheels, &user_data);

>         if (rc <= 0)

>                 return NULL;

>

>         user_data &= ~0x3;

>         timer_wheels->total_timer_removes++;

> -       return (void *)user_data;

> +       return (void *)(uintptr_t)user_data;

>  }

>

>  uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t timer_wheel)

>  {

>         timer_wheels_t *timer_wheels;

>

> -       timer_wheels = (timer_wheels_t *)timer_wheel;

> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>         return timer_wheels->total_timer_inserts -

>                 timer_wheels->total_timer_removes;

>  }

> @@ -862,7 +862,7 @@ void _odp_timer_wheel_stats_print(_odp_timer_wheel_t

> timer_wheel)

>         expired_ring_t *expired_ring;

>         uint32_t        wheel_idx;

>

> -       timer_wheels = (timer_wheels_t *)timer_wheel;

> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>         expired_ring = timer_wheels->expired_timers_ring;

>

>         ODP_DBG("_odp_int_timer_wheel_stats current_ticks=%lu\n",

> @@ -894,7 +894,7 @@ void _odp_timer_wheel_destroy(_odp_timer_wheel_t

> timer_wheel)

>         timer_wheels_t *timer_wheels;

>         expired_ring_t *expired_ring;

>

> -       timer_wheels = (timer_wheels_t *)timer_wheel;

> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>         expired_ring = timer_wheels->expired_timers_ring;

>

>         /* First free all of the block_of_timer_blks @TODO */

> diff --git a/platform/linux-generic/odp_traffic_mngr.c

> b/platform/linux-generic/odp_traffic_mngr.c

> index 88e0ada..6179568 100644

> --- a/platform/linux-generic/odp_traffic_mngr.c

> +++ b/platform/linux-generic/odp_traffic_mngr.c

> @@ -658,7 +658,7 @@ static int tm_delay_pkt(tm_system_t *tm_system,

> tm_shaper_obj_t *shaper_obj,

>         timer_context = (((uint64_t)tm_queue_obj->timer_seq) << 32) |

>                 (((uint64_t)tm_queue_obj->queue_num) << 4);

>         _odp_timer_wheel_insert(tm_system->_odp_int_timer_wheel,

> -                               wakeup_time, (void *)timer_context);

> +                               wakeup_time, (void

> *)(uintptr_t)timer_context);

>

>         tm_queue_obj->timer_reason = UNDELAY_PKT;

>         tm_queue_obj->timer_shaper = shaper_obj;

> @@ -1680,7 +1680,7 @@ static int tm_process_expired_timers(tm_system_t

> *tm_system,

>                 if (!ptr)

>                         return work_done;

>

> -               timer_context = (uint64_t)ptr;

> +               timer_context = (uint64_t)(uintptr_t)ptr;

>                 queue_num = (timer_context & 0xFFFFFFFF) >> 4;

>                 timer_seq = timer_context >> 32;

>                 tm_queue_obj = tm_system->queue_num_tbl[queue_num];

> --

> 2.1.4

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
Maxim Uvarov Nov. 30, 2015, 7:47 p.m. UTC | #2
On 11/30/2015 21:45, Bill Fischofer wrote:
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>   .../include/odp_traffic_mngr_internal.h            | 15 +++---
>   platform/linux-generic/odp_name_table.c            | 58 ++++++++++++----------
>   platform/linux-generic/odp_pkt_queue.c             | 12 ++---
>   platform/linux-generic/odp_sorted_list.c           | 16 +++---
>   platform/linux-generic/odp_timer_wheel.c           | 18 +++----
>   platform/linux-generic/odp_traffic_mngr.c          |  4 +-
>   6 files changed, 67 insertions(+), 56 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_traffic_mngr_internal.h b/platform/linux-generic/include/odp_traffic_mngr_internal.h
> index c2d5cf4..e48e213 100644
> --- a/platform/linux-generic/include/odp_traffic_mngr_internal.h
> +++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h
> @@ -48,8 +48,8 @@ typedef struct stat  file_stat_t;
>   
>   /* Macros to convert handles to internal pointers and vice versa. */
>   
> -#define MAKE_ODP_TM_HANDLE(tm_system)  ((odp_tm_t)tm_system)
> -#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t *)odp_tm)
> +#define MAKE_ODP_TM_HANDLE(tm_system)  ((odp_tm_t)(uintptr_t)tm_system)
> +#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t *)(uintptr_t)odp_tm)
>   
>   #define MAKE_PROFILE_HANDLE(profile_kind, tbl_idx) \
>   	(((profile_kind & 0xF) << 28) | ((tbl_idx + 1) & 0xFFFFFFF))
> @@ -59,11 +59,14 @@ typedef struct stat  file_stat_t;
>   
>   #define GET_TBL_IDX(profile_handle)  ((profile_handle & 0xFFFFFFF) - 1)
>   
> -#define MAKE_ODP_TM_NODE(tm_node_obj)  ((odp_tm_node_t)(tm_node_obj))
> -#define GET_TM_NODE_OBJ(odp_tm_node)   ((tm_node_obj_t *)(odp_tm_node))
> +#define MAKE_ODP_TM_NODE(tm_node_obj) ((odp_tm_node_t)(uintptr_t)(tm_node_obj))
> +#define GET_TM_NODE_OBJ(odp_tm_node) \
> +	((tm_node_obj_t *)(uintptr_t)(odp_tm_node))
>   
> -#define MAKE_ODP_TM_QUEUE(tm_queue_obj)  ((odp_tm_queue_t)(tm_queue_obj))
> -#define GET_TM_QUEUE_OBJ(odp_tm_queue)   ((tm_queue_obj_t *)(odp_tm_queue))
> +#define MAKE_ODP_TM_QUEUE(tm_queue_obj) \
> +	((odp_tm_queue_t)(uintptr_t)(tm_queue_obj))
> +#define GET_TM_QUEUE_OBJ(odp_tm_queue) \
> +	((tm_queue_obj_t *)(uintptr_t)(odp_tm_queue))
>   
>   typedef uint64_t tm_handle_t;
>   
> diff --git a/platform/linux-generic/odp_name_table.c b/platform/linux-generic/odp_name_table.c
> index 10ce099..10a760e 100644
> --- a/platform/linux-generic/odp_name_table.c
> +++ b/platform/linux-generic/odp_name_table.c
> @@ -567,7 +567,7 @@ static hash_tbl_entry_t make_hash_tbl_entry(name_tbl_entry_t *name_tbl_entry,
>   	uint32_t         new_entry_cnt;
>   
>   	new_entry_cnt   = MIN(entry_cnt + 1, 0x3F);
> -	hash_tbl_entry  = (hash_tbl_entry_t)name_tbl_entry;
> +	hash_tbl_entry  = (hash_tbl_entry_t)(uintptr_t)name_tbl_entry;
>   	hash_tbl_entry &= ~0x3F;
>   	hash_tbl_entry |= new_entry_cnt;
>   	return hash_tbl_entry;
> @@ -584,18 +584,18 @@ static name_tbl_entry_t *name_hash_tbl_lookup(uint32_t hash_value)
>   	if (hash_tbl_entry == 0)
>   		return NULL;
>   	else if ((hash_tbl_entry & 0x3F) != 0)
> -		return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>   
>          /* This hash_tbl_entry references a secondary hash table, so get
>   	* some more hash_value bits and index that table.
>   	*/
>   	hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE - 1);
> -	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
> +	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
>   	hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
>   	if (hash_tbl_entry == 0)
>   		return NULL;
>   	else if ((hash_tbl_entry & 0x3F) != 0)
> -		return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>   
>          /* Yet again, this hash_tbl_entry references a secondary hash table,
>   	* so get some more hash_value bits and index that table.  We only
> @@ -604,12 +604,12 @@ static name_tbl_entry_t *name_hash_tbl_lookup(uint32_t hash_value)
>   	* returning NULL.
>   	*/
>   	hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE - 1);
> -	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
> +	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
>   	hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
>   	if (hash_tbl_entry == 0)
>   		return NULL;
>   	else if ((hash_tbl_entry & 0x3F) != 0)
> -		return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>   
>   	return NULL;
>   }
> @@ -655,7 +655,8 @@ static hash_tbl_entry_t secondary_hash_add(name_tbl_entry_t *name_tbl_entry,
>   
>   		hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
>   		entry_cnt      = hash_tbl_entry & 0x3F;
> -		first_entry    = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		first_entry    =
> +			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);

maybe to put it to separate inline then copy paste everywhere? Like

static inline name_tbl_entry_t * hash_to_name_tbl_entry(name_tbk_entry_t 
*name){
     return  (name_tbl_entry_t *)(uintptr_t)name;
}

?

Or even to move it to #define

Maxim.

>   
>   		name_tbl_entry->next_entry = first_entry;
>   		new_hash_tbl_entry =
> @@ -666,7 +667,7 @@ static hash_tbl_entry_t secondary_hash_add(name_tbl_entry_t *name_tbl_entry,
>   	}
>   
>   	/* secondary_hash_dump(secondary_hash); */
> -	return (hash_tbl_entry_t)secondary_hash;
> +	return (hash_tbl_entry_t)(uintptr_t)secondary_hash;
>   }
>   
>   static hash_tbl_entry_t hash_tbl_remove(secondary_hash_tbl_t *hash_tbl,
> @@ -693,11 +694,11 @@ static hash_tbl_entry_t hash_tbl_remove(secondary_hash_tbl_t *hash_tbl,
>   				 * new entry onto the front of it.
>   				 */
>   				head_entry = (name_tbl_entry_t *)
> -					(hash_tbl_entry & ~0x3F);
> +					(uintptr_t)(hash_tbl_entry & ~0x3F);
>   				tail_entry = head_entry;
>   			} else {
>   				secondary_hash = (secondary_hash_tbl_t *)
> -					hash_tbl_entry;
> +					(uintptr_t)hash_tbl_entry;
>   				check_secondary_hash(secondary_hash);
>   				if (level == 1)
>   					break;
> @@ -758,7 +759,8 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>   		/* This primary hash table entry points to a name_tbl_entry_t
>   		 * linked list, so add this new entry onto the front of it.
>   		 */
> -		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		name_tbl_entry =
> +			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>   		entry_to_add->next_entry = name_tbl_entry;
>   		hash_tbl_entry = make_hash_tbl_entry(entry_to_add, entry_cnt);
>   		name_hash_tbl.hash_entries[primary_hash_idx] = hash_tbl_entry;
> @@ -783,7 +785,7 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>   	* some more hash_value bits and index that table.
>   	*/
>   	hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE - 1);
> -	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
> +	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
>   	check_secondary_hash(secondary_hash);
>   	hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
>   	entry_cnt      = hash_tbl_entry & 0x3F;
> @@ -799,7 +801,8 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>   		 * name_tbl_entry_t linked list, so add this new entry onto
>   		 * the front of it.
>   		 */
> -		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		name_tbl_entry =
> +			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>   		entry_to_add->next_entry = name_tbl_entry;
>   		hash_tbl_entry = make_hash_tbl_entry(entry_to_add, entry_cnt);
>   		secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;
> @@ -827,7 +830,7 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>   	* signal failure by returning -1.
>   	*/
>   	hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE - 1);
> -	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
> +	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
>   	check_secondary_hash(secondary_hash);
>   	hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
>   	entry_cnt      = hash_tbl_entry & 0x3F;
> @@ -846,7 +849,8 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>   		 * linked list, we never add another hash table, so we don't
>   		 * need to update any secondary table counts.
>   		 */
> -		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		name_tbl_entry =
> +			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>   		entry_to_add->next_entry = name_tbl_entry;
>   		hash_tbl_entry = make_hash_tbl_entry(entry_to_add, entry_cnt);
>   		secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;
> @@ -875,7 +879,8 @@ static int name_tbl_entry_list_remove(hash_tbl_entry_t *hash_entry_ptr,
>   			 * deleted.
>   			 */
>   			if (!prev_entry) {
> -				hash_tbl_entry  = (hash_tbl_entry_t)next_entry;
> +				hash_tbl_entry  =
> +					(hash_tbl_entry_t)(uintptr_t)next_entry;
>   				hash_tbl_entry &= ~0x3F;
>   				hash_tbl_entry |= entry_cnt;
>   				*hash_entry_ptr = hash_tbl_entry;
> @@ -922,7 +927,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>   		/* This primary hash table entry points to a name_tbl_entry_t
>   		 * linked list, so remove entry from this linked list.
>   		 */
> -		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		name_tbl_entry =
> +			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>   		rc = name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry,
>   						entry_to_delete, entry_cnt);
>   		tbn = (*hash_entry_ptr) & ~0x3F;
> @@ -940,7 +946,7 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>   	* some more hash_value bits and index that table.
>   	*/
>   	hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE - 1);
> -	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
> +	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
>   	check_secondary_hash(secondary_hash);
>   	hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];
>   	hash_tbl_entry = *hash_entry_ptr;
> @@ -955,7 +961,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>   		 * name_tbl_entry_t linked list, so try to remove
>   		 * entry_to_delete from this linked list.
>   		 */
> -		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		name_tbl_entry =
> +			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>   		rc = name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry,
>   						entry_to_delete, entry_cnt);
>   		tbn = (*hash_entry_ptr) & ~0x3F;
> @@ -988,7 +995,7 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>   	* signal failure by returning -1.
>   	*/
>   	hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE - 1);
> -	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
> +	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
>   	check_secondary_hash(secondary_hash);
>   	hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];
>   	hash_tbl_entry = *hash_entry_ptr;
> @@ -1003,7 +1010,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>   		 * name_tbl_entry_t linked list, so try to remove
>   		 * entry_to_delete from this linked list.
>   		 */
> -		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
> +		name_tbl_entry =
> +			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>   		rc = name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry,
>   						entry_to_delete, entry_cnt);
>   		tbn = (*hash_entry_ptr) & ~0x3F;
> @@ -1172,7 +1180,7 @@ static uint32_t level2_hash_histo(secondary_hash_tbl_t *hash_tbl,
>   			collisions = 0;
>   		} else {
>   			name_tbl_entry = (name_tbl_entry_t *)
> -				(hash_tbl_entry & ~0x3F);
> +				(uintptr_t)(hash_tbl_entry & ~0x3F);
>   			collisions     = linked_list_len(name_tbl_entry);
>   		}
>   
> @@ -1199,11 +1207,11 @@ static uint32_t level1_hash_histo(secondary_hash_tbl_t *hash_tbl,
>   			collisions = 0;
>   		} else if ((hash_tbl_entry & 0x3F) != 0) {
>   			name_tbl_entry = (name_tbl_entry_t *)
> -				(hash_tbl_entry & ~0x3F);
> +				(uintptr_t)(hash_tbl_entry & ~0x3F);
>   			collisions     = linked_list_len(name_tbl_entry);
>   		} else {
>   			secondary_hash = (secondary_hash_tbl_t *)
> -				hash_tbl_entry;
> +				(uintptr_t)hash_tbl_entry;
>   			collisions     = level2_hash_histo(secondary_hash,
>   							   level2_histo);
>   		}
> @@ -1232,7 +1240,7 @@ static void secondary_hash_histo_print(void)
>   			 * hash table
>   			 */
>   			secondary_hash = (secondary_hash_tbl_t *)
> -				hash_tbl_entry;
> +				(uintptr_t)hash_tbl_entry;
>   			level1_hash_histo(secondary_hash, level1_histo,
>   					  level2_histo);
>   		}
> diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c
> index 45508eb..88520b1 100644
> --- a/platform/linux-generic/odp_pkt_queue.c
> +++ b/platform/linux-generic/odp_pkt_queue.c
> @@ -215,7 +215,7 @@ _odp_int_queue_pool_t _odp_queue_pool_create(uint32_t max_num_queues,
>   
>   	pool->min_free_list_size = pool->free_list_size;
>   	pool->peak_free_list_size = pool->free_list_size;
> -	return (_odp_int_queue_pool_t)pool;
> +	return (_odp_int_queue_pool_t)(uintptr_t)pool;
>   }
>   
>   _odp_int_pkt_queue_t _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool)
> @@ -223,7 +223,7 @@ _odp_int_pkt_queue_t _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool)
>   	queue_pool_t *pool;
>   	uint32_t queue_num;
>   
> -	pool = (queue_pool_t *)queue_pool;
> +	pool = (queue_pool_t *)(uintptr_t)queue_pool;
>   	queue_num = pool->next_queue_num++;
>   	if (pool->max_queue_num < queue_num)
>   		return _ODP_INT_PKT_QUEUE_INVALID;
> @@ -239,7 +239,7 @@ int _odp_pkt_queue_append(_odp_int_queue_pool_t queue_pool,
>   	uint32_t queue_num, first_blk_idx, tail_blk_idx, new_tail_blk_idx;
>   	uint32_t idx;
>   
> -	pool = (queue_pool_t *)queue_pool;
> +	pool = (queue_pool_t *)(uintptr_t)queue_pool;
>   	queue_num = (uint32_t)pkt_queue;
>   	if ((queue_num == 0) || (pool->max_queue_num < queue_num))
>   		return -2;
> @@ -296,7 +296,7 @@ int _odp_pkt_queue_remove(_odp_int_queue_pool_t queue_pool,
>   	queue_blk_t *first_blk, *second_blk;
>   	uint32_t queue_num, first_blk_idx, next_blk_idx, idx;
>   
> -	pool = (queue_pool_t *)queue_pool;
> +	pool = (queue_pool_t *)(uintptr_t)queue_pool;
>   	queue_num = (uint32_t)pkt_queue;
>   	if ((queue_num == 0) || (pool->max_queue_num < queue_num))
>   		return -2;
> @@ -347,7 +347,7 @@ void _odp_pkt_queue_stats_print(_odp_int_queue_pool_t queue_pool)
>   {
>   	queue_pool_t *pool;
>   
> -	pool = (queue_pool_t *)queue_pool;
> +	pool = (queue_pool_t *)(uintptr_t)queue_pool;
>   	ODP_DBG("pkt_queue_stats - queue_pool=0x%lX\n", queue_pool);
>   	ODP_DBG("  max_queue_num=%u max_queued_pkts=%u next_queue_num=%u\n",
>   		pool->max_queue_num, pool->max_queued_pkts,
> @@ -367,7 +367,7 @@ void _odp_queue_pool_destroy(_odp_int_queue_pool_t queue_pool)
>   	queue_pool_t *pool;
>   	uint32_t idx;
>   
> -	pool = (queue_pool_t *)queue_pool;
> +	pool = (queue_pool_t *)(uintptr_t)queue_pool;
>   	for (idx = 0; idx < 16; idx++) {
>   		queue_region_desc = &pool->queue_region_descs[idx];
>   		if (queue_region_desc->queue_blks)
> diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c
> index 221754d..5811266 100644
> --- a/platform/linux-generic/odp_sorted_list.c
> +++ b/platform/linux-generic/odp_sorted_list.c
> @@ -56,7 +56,7 @@ _odp_int_sorted_pool_t _odp_sorted_pool_create(uint32_t max_sorted_lists)
>   	list_descs = malloc(malloc_len);
>   	memset(list_descs, 0, malloc_len);
>   	pool->list_descs = list_descs;
> -	return (_odp_int_sorted_pool_t)pool;
> +	return (_odp_int_sorted_pool_t)(uintptr_t)pool;
>   }
>   
>   _odp_int_sorted_list_t
> @@ -66,7 +66,7 @@ _odp_sorted_list_create(_odp_int_sorted_pool_t sorted_pool,
>   	sorted_pool_t *pool;
>   	uint32_t       list_idx;
>   
> -	pool     = (sorted_pool_t *)sorted_pool;
> +	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>   	list_idx = pool->next_list_idx++;
>   	return (_odp_int_sorted_list_t)list_idx;
>   }
> @@ -81,7 +81,7 @@ int _odp_sorted_list_insert(_odp_int_sorted_pool_t sorted_pool,
>   	sorted_pool_t      *pool;
>   	uint32_t            list_idx;
>   
> -	pool     = (sorted_pool_t *)sorted_pool;
> +	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>   	list_idx = (uint32_t)sorted_list;
>   	if ((pool->next_list_idx    <= list_idx) ||
>   	    (pool->max_sorted_lists <= list_idx))
> @@ -125,7 +125,7 @@ int _odp_sorted_list_find(_odp_int_sorted_pool_t sorted_pool,
>   	sorted_pool_t      *pool;
>   	uint32_t            list_idx;
>   
> -	pool     = (sorted_pool_t *)sorted_pool;
> +	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>   	list_idx = (uint32_t)sorted_list;
>   	if ((pool->next_list_idx    <= list_idx) ||
>   	    (pool->max_sorted_lists <= list_idx))
> @@ -161,7 +161,7 @@ int _odp_sorted_list_delete(_odp_int_sorted_pool_t sorted_pool,
>   	sorted_pool_t      *pool;
>   	uint32_t            list_idx;
>   
> -	pool     = (sorted_pool_t *)sorted_pool;
> +	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>   	list_idx = (uint32_t)sorted_list;
>   	if ((pool->next_list_idx    <= list_idx) ||
>   	    (pool->max_sorted_lists <= list_idx))
> @@ -207,7 +207,7 @@ int _odp_sorted_list_remove(_odp_int_sorted_pool_t sorted_pool,
>   	sorted_pool_t      *pool;
>   	uint32_t            list_idx;
>   
> -	pool     = (sorted_pool_t *)sorted_pool;
> +	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>   	list_idx = (uint32_t)sorted_list;
>   	if ((pool->next_list_idx    <= list_idx) ||
>   	    (pool->max_sorted_lists <= list_idx))
> @@ -237,7 +237,7 @@ void _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool)
>   {
>   	sorted_pool_t *pool;
>   
> -	pool = (sorted_pool_t *)sorted_pool;
> +	pool = (sorted_pool_t *)(uintptr_t)sorted_pool;
>   	ODP_DBG("sorted_pool=0x%lX\n", sorted_pool);
>   	ODP_DBG("  max_sorted_lists=%u next_list_idx=%u\n",
>   		pool->max_sorted_lists, pool->next_list_idx);
> @@ -253,7 +253,7 @@ void _odp_sorted_pool_destroy(_odp_int_sorted_pool_t sorted_pool)
>   	sorted_pool_t       *pool;
>   	uint32_t             list_idx;
>   
> -	pool       = (sorted_pool_t *)sorted_pool;
> +	pool       = (sorted_pool_t *)(uintptr_t)sorted_pool;
>   	list_descs = pool->list_descs;
>   
>   	for (list_idx = 0; list_idx < pool->next_list_idx; list_idx++) {
> diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c
> index bcab01b..21be3ef 100644
> --- a/platform/linux-generic/odp_timer_wheel.c
> +++ b/platform/linux-generic/odp_timer_wheel.c
> @@ -748,7 +748,7 @@ _odp_timer_wheel_t _odp_timer_wheel_create(uint32_t max_concurrent_timers,
>   	free_list_add(timer_wheels, max_concurrent_timers / 4);
>   	timer_wheels->min_free_list_size  = timer_wheels->free_list_size;
>   	timer_wheels->peak_free_list_size = timer_wheels->free_list_size;
> -	return (_odp_timer_wheel_t)timer_wheels;
> +	return (_odp_timer_wheel_t)(uintptr_t)timer_wheels;
>   }
>   
>   uint32_t _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel,
> @@ -759,7 +759,7 @@ uint32_t _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel,
>   	uint32_t        desc_idx;
>   	int             rc;
>   
> -	timer_wheels      = (timer_wheels_t *)timer_wheel;
> +	timer_wheels      = (timer_wheels_t *)(uintptr_t)timer_wheel;
>   	new_current_ticks = current_time >> CYCLES_TO_TICKS_SHIFT;
>   	elapsed_ticks     = new_current_ticks - timer_wheels->current_ticks;
>   	if (elapsed_ticks == 0)
> @@ -787,13 +787,13 @@ int _odp_timer_wheel_insert(_odp_timer_wheel_t timer_wheel,
>   	uint64_t        user_data, wakeup_ticks;
>   	int             rc;
>   
> -	user_data = (uint64_t)user_ptr;
> +	user_data = (uint64_t)(uintptr_t)user_ptr;
>   	if (user_data == 0)
>   		return -4;  /* user_data cannot be 0! */
>   	else if ((user_data & 0x3) != 0)
>   		return -5;  /* user_data ptr must be at least 4-byte aligned. */
>   
> -	timer_wheels = (timer_wheels_t *)timer_wheel;
> +	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>   	wakeup_ticks = (wakeup_time >> CYCLES_TO_TICKS_SHIFT) + 1;
>   	if (wakeup_time <= timer_wheels->current_ticks)
>   		return -6;
> @@ -828,21 +828,21 @@ void *_odp_timer_wheel_next_expired(_odp_timer_wheel_t timer_wheel)
>   	int             rc;
>   
>   	/* Remove the head of the timer wheel. */
> -	timer_wheels = (timer_wheels_t *)timer_wheel;
> +	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>   	rc = expired_timers_remove(timer_wheels, &user_data);
>   	if (rc <= 0)
>   		return NULL;
>   
>   	user_data &= ~0x3;
>   	timer_wheels->total_timer_removes++;
> -	return (void *)user_data;
> +	return (void *)(uintptr_t)user_data;
>   }
>   
>   uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t timer_wheel)
>   {
>   	timer_wheels_t *timer_wheels;
>   
> -	timer_wheels = (timer_wheels_t *)timer_wheel;
> +	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>   	return timer_wheels->total_timer_inserts -
>   		timer_wheels->total_timer_removes;
>   }
> @@ -862,7 +862,7 @@ void _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel)
>   	expired_ring_t *expired_ring;
>   	uint32_t        wheel_idx;
>   
> -	timer_wheels = (timer_wheels_t *)timer_wheel;
> +	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>   	expired_ring = timer_wheels->expired_timers_ring;
>   
>   	ODP_DBG("_odp_int_timer_wheel_stats current_ticks=%lu\n",
> @@ -894,7 +894,7 @@ void _odp_timer_wheel_destroy(_odp_timer_wheel_t timer_wheel)
>   	timer_wheels_t *timer_wheels;
>   	expired_ring_t *expired_ring;
>   
> -	timer_wheels = (timer_wheels_t *)timer_wheel;
> +	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>   	expired_ring = timer_wheels->expired_timers_ring;
>   
>   	/* First free all of the block_of_timer_blks @TODO */
> diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c
> index 88e0ada..6179568 100644
> --- a/platform/linux-generic/odp_traffic_mngr.c
> +++ b/platform/linux-generic/odp_traffic_mngr.c
> @@ -658,7 +658,7 @@ static int tm_delay_pkt(tm_system_t *tm_system, tm_shaper_obj_t *shaper_obj,
>   	timer_context = (((uint64_t)tm_queue_obj->timer_seq) << 32) |
>   		(((uint64_t)tm_queue_obj->queue_num) << 4);
>   	_odp_timer_wheel_insert(tm_system->_odp_int_timer_wheel,
> -				wakeup_time, (void *)timer_context);
> +				wakeup_time, (void *)(uintptr_t)timer_context);
>   
>   	tm_queue_obj->timer_reason = UNDELAY_PKT;
>   	tm_queue_obj->timer_shaper = shaper_obj;
> @@ -1680,7 +1680,7 @@ static int tm_process_expired_timers(tm_system_t *tm_system,
>   		if (!ptr)
>   			return work_done;
>   
> -		timer_context = (uint64_t)ptr;
> +		timer_context = (uint64_t)(uintptr_t)ptr;
>   		queue_num = (timer_context & 0xFFFFFFFF) >> 4;
>   		timer_seq = timer_context >> 32;
>   		tm_queue_obj = tm_system->queue_num_tbl[queue_num];
Bill Fischofer Nov. 30, 2015, 9:41 p.m. UTC | #3
Macros would probably be a good idea, however I wanted to get this fix in
now and let Alex and/or Barry recommend further code restructure based on
their more thorough analysis.

This isn't the first time M32_ON_64 issues have been flagged.  I've added
testing with this to my own checklist and it should probably be added to
the CONTRIBUTING file and/or the Implementer's Guide.

On Mon, Nov 30, 2015 at 1:47 PM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> On 11/30/2015 21:45, Bill Fischofer wrote:

>

>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

>> ---

>>   .../include/odp_traffic_mngr_internal.h            | 15 +++---

>>   platform/linux-generic/odp_name_table.c            | 58

>> ++++++++++++----------

>>   platform/linux-generic/odp_pkt_queue.c             | 12 ++---

>>   platform/linux-generic/odp_sorted_list.c           | 16 +++---

>>   platform/linux-generic/odp_timer_wheel.c           | 18 +++----

>>   platform/linux-generic/odp_traffic_mngr.c          |  4 +-

>>   6 files changed, 67 insertions(+), 56 deletions(-)

>>

>> diff --git a/platform/linux-generic/include/odp_traffic_mngr_internal.h

>> b/platform/linux-generic/include/odp_traffic_mngr_internal.h

>> index c2d5cf4..e48e213 100644

>> --- a/platform/linux-generic/include/odp_traffic_mngr_internal.h

>> +++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h

>> @@ -48,8 +48,8 @@ typedef struct stat  file_stat_t;

>>     /* Macros to convert handles to internal pointers and vice versa. */

>>   -#define MAKE_ODP_TM_HANDLE(tm_system)  ((odp_tm_t)tm_system)

>> -#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t *)odp_tm)

>> +#define MAKE_ODP_TM_HANDLE(tm_system)  ((odp_tm_t)(uintptr_t)tm_system)

>> +#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t *)(uintptr_t)odp_tm)

>>     #define MAKE_PROFILE_HANDLE(profile_kind, tbl_idx) \

>>         (((profile_kind & 0xF) << 28) | ((tbl_idx + 1) & 0xFFFFFFF))

>> @@ -59,11 +59,14 @@ typedef struct stat  file_stat_t;

>>     #define GET_TBL_IDX(profile_handle)  ((profile_handle & 0xFFFFFFF) -

>> 1)

>>   -#define MAKE_ODP_TM_NODE(tm_node_obj)  ((odp_tm_node_t)(tm_node_obj))

>> -#define GET_TM_NODE_OBJ(odp_tm_node)   ((tm_node_obj_t *)(odp_tm_node))

>> +#define MAKE_ODP_TM_NODE(tm_node_obj)

>> ((odp_tm_node_t)(uintptr_t)(tm_node_obj))

>> +#define GET_TM_NODE_OBJ(odp_tm_node) \

>> +       ((tm_node_obj_t *)(uintptr_t)(odp_tm_node))

>>   -#define MAKE_ODP_TM_QUEUE(tm_queue_obj)

>> ((odp_tm_queue_t)(tm_queue_obj))

>> -#define GET_TM_QUEUE_OBJ(odp_tm_queue)   ((tm_queue_obj_t

>> *)(odp_tm_queue))

>> +#define MAKE_ODP_TM_QUEUE(tm_queue_obj) \

>> +       ((odp_tm_queue_t)(uintptr_t)(tm_queue_obj))

>> +#define GET_TM_QUEUE_OBJ(odp_tm_queue) \

>> +       ((tm_queue_obj_t *)(uintptr_t)(odp_tm_queue))

>>     typedef uint64_t tm_handle_t;

>>   diff --git a/platform/linux-generic/odp_name_table.c

>> b/platform/linux-generic/odp_name_table.c

>> index 10ce099..10a760e 100644

>> --- a/platform/linux-generic/odp_name_table.c

>> +++ b/platform/linux-generic/odp_name_table.c

>> @@ -567,7 +567,7 @@ static hash_tbl_entry_t

>> make_hash_tbl_entry(name_tbl_entry_t *name_tbl_entry,

>>         uint32_t         new_entry_cnt;

>>         new_entry_cnt   = MIN(entry_cnt + 1, 0x3F);

>> -       hash_tbl_entry  = (hash_tbl_entry_t)name_tbl_entry;

>> +       hash_tbl_entry  = (hash_tbl_entry_t)(uintptr_t)name_tbl_entry;

>>         hash_tbl_entry &= ~0x3F;

>>         hash_tbl_entry |= new_entry_cnt;

>>         return hash_tbl_entry;

>> @@ -584,18 +584,18 @@ static name_tbl_entry_t

>> *name_hash_tbl_lookup(uint32_t hash_value)

>>         if (hash_tbl_entry == 0)

>>                 return NULL;

>>         else if ((hash_tbl_entry & 0x3F) != 0)

>> -               return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);

>> +               return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>            /* This hash_tbl_entry references a secondary hash table, so

>> get

>>         * some more hash_value bits and index that table.

>>         */

>>         hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE -

>> 1);

>> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

>> +       secondary_hash = (secondary_hash_tbl_t

>> *)(uintptr_t)hash_tbl_entry;

>>         hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>>         if (hash_tbl_entry == 0)

>>                 return NULL;

>>         else if ((hash_tbl_entry & 0x3F) != 0)

>> -               return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);

>> +               return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>            /* Yet again, this hash_tbl_entry references a secondary hash

>> table,

>>         * so get some more hash_value bits and index that table.  We only

>> @@ -604,12 +604,12 @@ static name_tbl_entry_t

>> *name_hash_tbl_lookup(uint32_t hash_value)

>>         * returning NULL.

>>         */

>>         hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE -

>> 1);

>> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

>> +       secondary_hash = (secondary_hash_tbl_t

>> *)(uintptr_t)hash_tbl_entry;

>>         hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>>         if (hash_tbl_entry == 0)

>>                 return NULL;

>>         else if ((hash_tbl_entry & 0x3F) != 0)

>> -               return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);

>> +               return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>         return NULL;

>>   }

>> @@ -655,7 +655,8 @@ static hash_tbl_entry_t

>> secondary_hash_add(name_tbl_entry_t *name_tbl_entry,

>>                 hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>>                 entry_cnt      = hash_tbl_entry & 0x3F;

>> -               first_entry    = (name_tbl_entry_t *)(hash_tbl_entry &

>> ~0x3F);

>> +               first_entry    =

>> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>

>

> maybe to put it to separate inline then copy paste everywhere? Like

>

> static inline name_tbl_entry_t * hash_to_name_tbl_entry(name_tbk_entry_t

> *name){

>     return  (name_tbl_entry_t *)(uintptr_t)name;

> }

>

> ?

>

> Or even to move it to #define

>

> Maxim.

>

>

>                 name_tbl_entry->next_entry = first_entry;

>>                 new_hash_tbl_entry =

>> @@ -666,7 +667,7 @@ static hash_tbl_entry_t

>> secondary_hash_add(name_tbl_entry_t *name_tbl_entry,

>>         }

>>         /* secondary_hash_dump(secondary_hash); */

>> -       return (hash_tbl_entry_t)secondary_hash;

>> +       return (hash_tbl_entry_t)(uintptr_t)secondary_hash;

>>   }

>>     static hash_tbl_entry_t hash_tbl_remove(secondary_hash_tbl_t

>> *hash_tbl,

>> @@ -693,11 +694,11 @@ static hash_tbl_entry_t

>> hash_tbl_remove(secondary_hash_tbl_t *hash_tbl,

>>                                  * new entry onto the front of it.

>>                                  */

>>                                 head_entry = (name_tbl_entry_t *)

>> -                                       (hash_tbl_entry & ~0x3F);

>> +                                       (uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>                                 tail_entry = head_entry;

>>                         } else {

>>                                 secondary_hash = (secondary_hash_tbl_t *)

>> -                                       hash_tbl_entry;

>> +                                       (uintptr_t)hash_tbl_entry;

>>                                 check_secondary_hash(secondary_hash);

>>                                 if (level == 1)

>>                                         break;

>> @@ -758,7 +759,8 @@ static int name_hash_tbl_add(name_tbl_entry_t

>> *entry_to_add,

>>                 /* This primary hash table entry points to a

>> name_tbl_entry_t

>>                  * linked list, so add this new entry onto the front of

>> it.

>>                  */

>> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

>> ~0x3F);

>> +               name_tbl_entry =

>> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>                 entry_to_add->next_entry = name_tbl_entry;

>>                 hash_tbl_entry = make_hash_tbl_entry(entry_to_add,

>> entry_cnt);

>>                 name_hash_tbl.hash_entries[primary_hash_idx] =

>> hash_tbl_entry;

>> @@ -783,7 +785,7 @@ static int name_hash_tbl_add(name_tbl_entry_t

>> *entry_to_add,

>>         * some more hash_value bits and index that table.

>>         */

>>         hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE -

>> 1);

>> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

>> +       secondary_hash = (secondary_hash_tbl_t

>> *)(uintptr_t)hash_tbl_entry;

>>         check_secondary_hash(secondary_hash);

>>         hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>>         entry_cnt      = hash_tbl_entry & 0x3F;

>> @@ -799,7 +801,8 @@ static int name_hash_tbl_add(name_tbl_entry_t

>> *entry_to_add,

>>                  * name_tbl_entry_t linked list, so add this new entry

>> onto

>>                  * the front of it.

>>                  */

>> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

>> ~0x3F);

>> +               name_tbl_entry =

>> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>                 entry_to_add->next_entry = name_tbl_entry;

>>                 hash_tbl_entry = make_hash_tbl_entry(entry_to_add,

>> entry_cnt);

>>                 secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;

>> @@ -827,7 +830,7 @@ static int name_hash_tbl_add(name_tbl_entry_t

>> *entry_to_add,

>>         * signal failure by returning -1.

>>         */

>>         hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE -

>> 1);

>> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

>> +       secondary_hash = (secondary_hash_tbl_t

>> *)(uintptr_t)hash_tbl_entry;

>>         check_secondary_hash(secondary_hash);

>>         hash_tbl_entry = secondary_hash->hash_entries[hash_idx];

>>         entry_cnt      = hash_tbl_entry & 0x3F;

>> @@ -846,7 +849,8 @@ static int name_hash_tbl_add(name_tbl_entry_t

>> *entry_to_add,

>>                  * linked list, we never add another hash table, so we

>> don't

>>                  * need to update any secondary table counts.

>>                  */

>> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

>> ~0x3F);

>> +               name_tbl_entry =

>> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>                 entry_to_add->next_entry = name_tbl_entry;

>>                 hash_tbl_entry = make_hash_tbl_entry(entry_to_add,

>> entry_cnt);

>>                 secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;

>> @@ -875,7 +879,8 @@ static int

>> name_tbl_entry_list_remove(hash_tbl_entry_t *hash_entry_ptr,

>>                          * deleted.

>>                          */

>>                         if (!prev_entry) {

>> -                               hash_tbl_entry  =

>> (hash_tbl_entry_t)next_entry;

>> +                               hash_tbl_entry  =

>> +

>>  (hash_tbl_entry_t)(uintptr_t)next_entry;

>>                                 hash_tbl_entry &= ~0x3F;

>>                                 hash_tbl_entry |= entry_cnt;

>>                                 *hash_entry_ptr = hash_tbl_entry;

>> @@ -922,7 +927,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t

>> *entry_to_delete,

>>                 /* This primary hash table entry points to a

>> name_tbl_entry_t

>>                  * linked list, so remove entry from this linked list.

>>                  */

>> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

>> ~0x3F);

>> +               name_tbl_entry =

>> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>                 rc = name_tbl_entry_list_remove(hash_entry_ptr,

>> name_tbl_entry,

>>                                                 entry_to_delete,

>> entry_cnt);

>>                 tbn = (*hash_entry_ptr) & ~0x3F;

>> @@ -940,7 +946,7 @@ static int name_hash_tbl_delete(name_tbl_entry_t

>> *entry_to_delete,

>>         * some more hash_value bits and index that table.

>>         */

>>         hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE -

>> 1);

>> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

>> +       secondary_hash = (secondary_hash_tbl_t

>> *)(uintptr_t)hash_tbl_entry;

>>         check_secondary_hash(secondary_hash);

>>         hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];

>>         hash_tbl_entry = *hash_entry_ptr;

>> @@ -955,7 +961,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t

>> *entry_to_delete,

>>                  * name_tbl_entry_t linked list, so try to remove

>>                  * entry_to_delete from this linked list.

>>                  */

>> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

>> ~0x3F);

>> +               name_tbl_entry =

>> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>                 rc = name_tbl_entry_list_remove(hash_entry_ptr,

>> name_tbl_entry,

>>                                                 entry_to_delete,

>> entry_cnt);

>>                 tbn = (*hash_entry_ptr) & ~0x3F;

>> @@ -988,7 +995,7 @@ static int name_hash_tbl_delete(name_tbl_entry_t

>> *entry_to_delete,

>>         * signal failure by returning -1.

>>         */

>>         hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE -

>> 1);

>> -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;

>> +       secondary_hash = (secondary_hash_tbl_t

>> *)(uintptr_t)hash_tbl_entry;

>>         check_secondary_hash(secondary_hash);

>>         hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];

>>         hash_tbl_entry = *hash_entry_ptr;

>> @@ -1003,7 +1010,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t

>> *entry_to_delete,

>>                  * name_tbl_entry_t linked list, so try to remove

>>                  * entry_to_delete from this linked list.

>>                  */

>> -               name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry &

>> ~0x3F);

>> +               name_tbl_entry =

>> +                       (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry &

>> ~0x3F);

>>                 rc = name_tbl_entry_list_remove(hash_entry_ptr,

>> name_tbl_entry,

>>                                                 entry_to_delete,

>> entry_cnt);

>>                 tbn = (*hash_entry_ptr) & ~0x3F;

>> @@ -1172,7 +1180,7 @@ static uint32_t

>> level2_hash_histo(secondary_hash_tbl_t *hash_tbl,

>>                         collisions = 0;

>>                 } else {

>>                         name_tbl_entry = (name_tbl_entry_t *)

>> -                               (hash_tbl_entry & ~0x3F);

>> +                               (uintptr_t)(hash_tbl_entry & ~0x3F);

>>                         collisions     = linked_list_len(name_tbl_entry);

>>                 }

>>   @@ -1199,11 +1207,11 @@ static uint32_t

>> level1_hash_histo(secondary_hash_tbl_t *hash_tbl,

>>                         collisions = 0;

>>                 } else if ((hash_tbl_entry & 0x3F) != 0) {

>>                         name_tbl_entry = (name_tbl_entry_t *)

>> -                               (hash_tbl_entry & ~0x3F);

>> +                               (uintptr_t)(hash_tbl_entry & ~0x3F);

>>                         collisions     = linked_list_len(name_tbl_entry);

>>                 } else {

>>                         secondary_hash = (secondary_hash_tbl_t *)

>> -                               hash_tbl_entry;

>> +                               (uintptr_t)hash_tbl_entry;

>>                         collisions     = level2_hash_histo(secondary_hash,

>>                                                            level2_histo);

>>                 }

>> @@ -1232,7 +1240,7 @@ static void secondary_hash_histo_print(void)

>>                          * hash table

>>                          */

>>                         secondary_hash = (secondary_hash_tbl_t *)

>> -                               hash_tbl_entry;

>> +                               (uintptr_t)hash_tbl_entry;

>>                         level1_hash_histo(secondary_hash, level1_histo,

>>                                           level2_histo);

>>                 }

>> diff --git a/platform/linux-generic/odp_pkt_queue.c

>> b/platform/linux-generic/odp_pkt_queue.c

>> index 45508eb..88520b1 100644

>> --- a/platform/linux-generic/odp_pkt_queue.c

>> +++ b/platform/linux-generic/odp_pkt_queue.c

>> @@ -215,7 +215,7 @@ _odp_int_queue_pool_t _odp_queue_pool_create(uint32_t

>> max_num_queues,

>>         pool->min_free_list_size = pool->free_list_size;

>>         pool->peak_free_list_size = pool->free_list_size;

>> -       return (_odp_int_queue_pool_t)pool;

>> +       return (_odp_int_queue_pool_t)(uintptr_t)pool;

>>   }

>>     _odp_int_pkt_queue_t _odp_pkt_queue_create(_odp_int_queue_pool_t

>> queue_pool)

>> @@ -223,7 +223,7 @@ _odp_int_pkt_queue_t

>> _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool)

>>         queue_pool_t *pool;

>>         uint32_t queue_num;

>>   -     pool = (queue_pool_t *)queue_pool;

>> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>>         queue_num = pool->next_queue_num++;

>>         if (pool->max_queue_num < queue_num)

>>                 return _ODP_INT_PKT_QUEUE_INVALID;

>> @@ -239,7 +239,7 @@ int _odp_pkt_queue_append(_odp_int_queue_pool_t

>> queue_pool,

>>         uint32_t queue_num, first_blk_idx, tail_blk_idx, new_tail_blk_idx;

>>         uint32_t idx;

>>   -     pool = (queue_pool_t *)queue_pool;

>> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>>         queue_num = (uint32_t)pkt_queue;

>>         if ((queue_num == 0) || (pool->max_queue_num < queue_num))

>>                 return -2;

>> @@ -296,7 +296,7 @@ int _odp_pkt_queue_remove(_odp_int_queue_pool_t

>> queue_pool,

>>         queue_blk_t *first_blk, *second_blk;

>>         uint32_t queue_num, first_blk_idx, next_blk_idx, idx;

>>   -     pool = (queue_pool_t *)queue_pool;

>> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>>         queue_num = (uint32_t)pkt_queue;

>>         if ((queue_num == 0) || (pool->max_queue_num < queue_num))

>>                 return -2;

>> @@ -347,7 +347,7 @@ void _odp_pkt_queue_stats_print(_odp_int_queue_pool_t

>> queue_pool)

>>   {

>>         queue_pool_t *pool;

>>   -     pool = (queue_pool_t *)queue_pool;

>> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>>         ODP_DBG("pkt_queue_stats - queue_pool=0x%lX\n", queue_pool);

>>         ODP_DBG("  max_queue_num=%u max_queued_pkts=%u

>> next_queue_num=%u\n",

>>                 pool->max_queue_num, pool->max_queued_pkts,

>> @@ -367,7 +367,7 @@ void _odp_queue_pool_destroy(_odp_int_queue_pool_t

>> queue_pool)

>>         queue_pool_t *pool;

>>         uint32_t idx;

>>   -     pool = (queue_pool_t *)queue_pool;

>> +       pool = (queue_pool_t *)(uintptr_t)queue_pool;

>>         for (idx = 0; idx < 16; idx++) {

>>                 queue_region_desc = &pool->queue_region_descs[idx];

>>                 if (queue_region_desc->queue_blks)

>> diff --git a/platform/linux-generic/odp_sorted_list.c

>> b/platform/linux-generic/odp_sorted_list.c

>> index 221754d..5811266 100644

>> --- a/platform/linux-generic/odp_sorted_list.c

>> +++ b/platform/linux-generic/odp_sorted_list.c

>> @@ -56,7 +56,7 @@ _odp_int_sorted_pool_t _odp_sorted_pool_create(uint32_t

>> max_sorted_lists)

>>         list_descs = malloc(malloc_len);

>>         memset(list_descs, 0, malloc_len);

>>         pool->list_descs = list_descs;

>> -       return (_odp_int_sorted_pool_t)pool;

>> +       return (_odp_int_sorted_pool_t)(uintptr_t)pool;

>>   }

>>     _odp_int_sorted_list_t

>> @@ -66,7 +66,7 @@ _odp_sorted_list_create(_odp_int_sorted_pool_t

>> sorted_pool,

>>         sorted_pool_t *pool;

>>         uint32_t       list_idx;

>>   -     pool     = (sorted_pool_t *)sorted_pool;

>> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>>         list_idx = pool->next_list_idx++;

>>         return (_odp_int_sorted_list_t)list_idx;

>>   }

>> @@ -81,7 +81,7 @@ int _odp_sorted_list_insert(_odp_int_sorted_pool_t

>> sorted_pool,

>>         sorted_pool_t      *pool;

>>         uint32_t            list_idx;

>>   -     pool     = (sorted_pool_t *)sorted_pool;

>> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>>         list_idx = (uint32_t)sorted_list;

>>         if ((pool->next_list_idx    <= list_idx) ||

>>             (pool->max_sorted_lists <= list_idx))

>> @@ -125,7 +125,7 @@ int _odp_sorted_list_find(_odp_int_sorted_pool_t

>> sorted_pool,

>>         sorted_pool_t      *pool;

>>         uint32_t            list_idx;

>>   -     pool     = (sorted_pool_t *)sorted_pool;

>> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>>         list_idx = (uint32_t)sorted_list;

>>         if ((pool->next_list_idx    <= list_idx) ||

>>             (pool->max_sorted_lists <= list_idx))

>> @@ -161,7 +161,7 @@ int _odp_sorted_list_delete(_odp_int_sorted_pool_t

>> sorted_pool,

>>         sorted_pool_t      *pool;

>>         uint32_t            list_idx;

>>   -     pool     = (sorted_pool_t *)sorted_pool;

>> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>>         list_idx = (uint32_t)sorted_list;

>>         if ((pool->next_list_idx    <= list_idx) ||

>>             (pool->max_sorted_lists <= list_idx))

>> @@ -207,7 +207,7 @@ int _odp_sorted_list_remove(_odp_int_sorted_pool_t

>> sorted_pool,

>>         sorted_pool_t      *pool;

>>         uint32_t            list_idx;

>>   -     pool     = (sorted_pool_t *)sorted_pool;

>> +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;

>>         list_idx = (uint32_t)sorted_list;

>>         if ((pool->next_list_idx    <= list_idx) ||

>>             (pool->max_sorted_lists <= list_idx))

>> @@ -237,7 +237,7 @@ void

>> _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool)

>>   {

>>         sorted_pool_t *pool;

>>   -     pool = (sorted_pool_t *)sorted_pool;

>> +       pool = (sorted_pool_t *)(uintptr_t)sorted_pool;

>>         ODP_DBG("sorted_pool=0x%lX\n", sorted_pool);

>>         ODP_DBG("  max_sorted_lists=%u next_list_idx=%u\n",

>>                 pool->max_sorted_lists, pool->next_list_idx);

>> @@ -253,7 +253,7 @@ void _odp_sorted_pool_destroy(_odp_int_sorted_pool_t

>> sorted_pool)

>>         sorted_pool_t       *pool;

>>         uint32_t             list_idx;

>>   -     pool       = (sorted_pool_t *)sorted_pool;

>> +       pool       = (sorted_pool_t *)(uintptr_t)sorted_pool;

>>         list_descs = pool->list_descs;

>>         for (list_idx = 0; list_idx < pool->next_list_idx; list_idx++) {

>> diff --git a/platform/linux-generic/odp_timer_wheel.c

>> b/platform/linux-generic/odp_timer_wheel.c

>> index bcab01b..21be3ef 100644

>> --- a/platform/linux-generic/odp_timer_wheel.c

>> +++ b/platform/linux-generic/odp_timer_wheel.c

>> @@ -748,7 +748,7 @@ _odp_timer_wheel_t _odp_timer_wheel_create(uint32_t

>> max_concurrent_timers,

>>         free_list_add(timer_wheels, max_concurrent_timers / 4);

>>         timer_wheels->min_free_list_size  = timer_wheels->free_list_size;

>>         timer_wheels->peak_free_list_size = timer_wheels->free_list_size;

>> -       return (_odp_timer_wheel_t)timer_wheels;

>> +       return (_odp_timer_wheel_t)(uintptr_t)timer_wheels;

>>   }

>>     uint32_t _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t

>> timer_wheel,

>> @@ -759,7 +759,7 @@ uint32_t

>> _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel,

>>         uint32_t        desc_idx;

>>         int             rc;

>>   -     timer_wheels      = (timer_wheels_t *)timer_wheel;

>> +       timer_wheels      = (timer_wheels_t *)(uintptr_t)timer_wheel;

>>         new_current_ticks = current_time >> CYCLES_TO_TICKS_SHIFT;

>>         elapsed_ticks     = new_current_ticks -

>> timer_wheels->current_ticks;

>>         if (elapsed_ticks == 0)

>> @@ -787,13 +787,13 @@ int _odp_timer_wheel_insert(_odp_timer_wheel_t

>> timer_wheel,

>>         uint64_t        user_data, wakeup_ticks;

>>         int             rc;

>>   -     user_data = (uint64_t)user_ptr;

>> +       user_data = (uint64_t)(uintptr_t)user_ptr;

>>         if (user_data == 0)

>>                 return -4;  /* user_data cannot be 0! */

>>         else if ((user_data & 0x3) != 0)

>>                 return -5;  /* user_data ptr must be at least 4-byte

>> aligned. */

>>   -     timer_wheels = (timer_wheels_t *)timer_wheel;

>> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>>         wakeup_ticks = (wakeup_time >> CYCLES_TO_TICKS_SHIFT) + 1;

>>         if (wakeup_time <= timer_wheels->current_ticks)

>>                 return -6;

>> @@ -828,21 +828,21 @@ void

>> *_odp_timer_wheel_next_expired(_odp_timer_wheel_t timer_wheel)

>>         int             rc;

>>         /* Remove the head of the timer wheel. */

>> -       timer_wheels = (timer_wheels_t *)timer_wheel;

>> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>>         rc = expired_timers_remove(timer_wheels, &user_data);

>>         if (rc <= 0)

>>                 return NULL;

>>         user_data &= ~0x3;

>>         timer_wheels->total_timer_removes++;

>> -       return (void *)user_data;

>> +       return (void *)(uintptr_t)user_data;

>>   }

>>     uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t timer_wheel)

>>   {

>>         timer_wheels_t *timer_wheels;

>>   -     timer_wheels = (timer_wheels_t *)timer_wheel;

>> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>>         return timer_wheels->total_timer_inserts -

>>                 timer_wheels->total_timer_removes;

>>   }

>> @@ -862,7 +862,7 @@ void _odp_timer_wheel_stats_print(_odp_timer_wheel_t

>> timer_wheel)

>>         expired_ring_t *expired_ring;

>>         uint32_t        wheel_idx;

>>   -     timer_wheels = (timer_wheels_t *)timer_wheel;

>> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>>         expired_ring = timer_wheels->expired_timers_ring;

>>         ODP_DBG("_odp_int_timer_wheel_stats current_ticks=%lu\n",

>> @@ -894,7 +894,7 @@ void _odp_timer_wheel_destroy(_odp_timer_wheel_t

>> timer_wheel)

>>         timer_wheels_t *timer_wheels;

>>         expired_ring_t *expired_ring;

>>   -     timer_wheels = (timer_wheels_t *)timer_wheel;

>> +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;

>>         expired_ring = timer_wheels->expired_timers_ring;

>>         /* First free all of the block_of_timer_blks @TODO */

>> diff --git a/platform/linux-generic/odp_traffic_mngr.c

>> b/platform/linux-generic/odp_traffic_mngr.c

>> index 88e0ada..6179568 100644

>> --- a/platform/linux-generic/odp_traffic_mngr.c

>> +++ b/platform/linux-generic/odp_traffic_mngr.c

>> @@ -658,7 +658,7 @@ static int tm_delay_pkt(tm_system_t *tm_system,

>> tm_shaper_obj_t *shaper_obj,

>>         timer_context = (((uint64_t)tm_queue_obj->timer_seq) << 32) |

>>                 (((uint64_t)tm_queue_obj->queue_num) << 4);

>>         _odp_timer_wheel_insert(tm_system->_odp_int_timer_wheel,

>> -                               wakeup_time, (void *)timer_context);

>> +                               wakeup_time, (void

>> *)(uintptr_t)timer_context);

>>         tm_queue_obj->timer_reason = UNDELAY_PKT;

>>         tm_queue_obj->timer_shaper = shaper_obj;

>> @@ -1680,7 +1680,7 @@ static int tm_process_expired_timers(tm_system_t

>> *tm_system,

>>                 if (!ptr)

>>                         return work_done;

>>   -             timer_context = (uint64_t)ptr;

>> +               timer_context = (uint64_t)(uintptr_t)ptr;

>>                 queue_num = (timer_context & 0xFFFFFFFF) >> 4;

>>                 timer_seq = timer_context >> 32;

>>                 tm_queue_obj = tm_system->queue_num_tbl[queue_num];

>>

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
Maxim Uvarov Dec. 1, 2015, 2:56 p.m. UTC | #4
Merged,
Maxim.

On 12/01/2015 00:41, Bill Fischofer wrote:
> Macros would probably be a good idea, however I wanted to get this fix 
> in now and let Alex and/or Barry recommend further code restructure 
> based on their more thorough analysis.
>
> This isn't the first time M32_ON_64 issues have been flagged.  I've 
> added testing with this to my own checklist and it should probably be 
> added to the CONTRIBUTING file and/or the Implementer's Guide.
>
> On Mon, Nov 30, 2015 at 1:47 PM, Maxim Uvarov <maxim.uvarov@linaro.org 
> <mailto:maxim.uvarov@linaro.org>> wrote:
>
>     On 11/30/2015 21:45, Bill Fischofer wrote:
>
>         Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org
>         <mailto:bill.fischofer@linaro.org>>
>         ---
>           .../include/odp_traffic_mngr_internal.h            | 15 +++---
>           platform/linux-generic/odp_name_table.c            | 58
>         ++++++++++++----------
>           platform/linux-generic/odp_pkt_queue.c             | 12 ++---
>           platform/linux-generic/odp_sorted_list.c           | 16 +++---
>           platform/linux-generic/odp_timer_wheel.c           | 18 +++----
>           platform/linux-generic/odp_traffic_mngr.c |  4 +-
>           6 files changed, 67 insertions(+), 56 deletions(-)
>
>         diff --git
>         a/platform/linux-generic/include/odp_traffic_mngr_internal.h
>         b/platform/linux-generic/include/odp_traffic_mngr_internal.h
>         index c2d5cf4..e48e213 100644
>         --- a/platform/linux-generic/include/odp_traffic_mngr_internal.h
>         +++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h
>         @@ -48,8 +48,8 @@ typedef struct stat  file_stat_t;
>             /* Macros to convert handles to internal pointers and vice
>         versa. */
>           -#define MAKE_ODP_TM_HANDLE(tm_system) ((odp_tm_t)tm_system)
>         -#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t *)odp_tm)
>         +#define MAKE_ODP_TM_HANDLE(tm_system)
>         ((odp_tm_t)(uintptr_t)tm_system)
>         +#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t
>         *)(uintptr_t)odp_tm)
>             #define MAKE_PROFILE_HANDLE(profile_kind, tbl_idx) \
>                 (((profile_kind & 0xF) << 28) | ((tbl_idx + 1) &
>         0xFFFFFFF))
>         @@ -59,11 +59,14 @@ typedef struct stat  file_stat_t;
>             #define GET_TBL_IDX(profile_handle) ((profile_handle &
>         0xFFFFFFF) - 1)
>           -#define MAKE_ODP_TM_NODE(tm_node_obj)
>         ((odp_tm_node_t)(tm_node_obj))
>         -#define GET_TM_NODE_OBJ(odp_tm_node)  ((tm_node_obj_t
>         *)(odp_tm_node))
>         +#define MAKE_ODP_TM_NODE(tm_node_obj)
>         ((odp_tm_node_t)(uintptr_t)(tm_node_obj))
>         +#define GET_TM_NODE_OBJ(odp_tm_node) \
>         +       ((tm_node_obj_t *)(uintptr_t)(odp_tm_node))
>           -#define MAKE_ODP_TM_QUEUE(tm_queue_obj)
>         ((odp_tm_queue_t)(tm_queue_obj))
>         -#define GET_TM_QUEUE_OBJ(odp_tm_queue)  ((tm_queue_obj_t
>         *)(odp_tm_queue))
>         +#define MAKE_ODP_TM_QUEUE(tm_queue_obj) \
>         +       ((odp_tm_queue_t)(uintptr_t)(tm_queue_obj))
>         +#define GET_TM_QUEUE_OBJ(odp_tm_queue) \
>         +       ((tm_queue_obj_t *)(uintptr_t)(odp_tm_queue))
>             typedef uint64_t tm_handle_t;
>           diff --git a/platform/linux-generic/odp_name_table.c
>         b/platform/linux-generic/odp_name_table.c
>         index 10ce099..10a760e 100644
>         --- a/platform/linux-generic/odp_name_table.c
>         +++ b/platform/linux-generic/odp_name_table.c
>         @@ -567,7 +567,7 @@ static hash_tbl_entry_t
>         make_hash_tbl_entry(name_tbl_entry_t *name_tbl_entry,
>                 uint32_t         new_entry_cnt;
>                 new_entry_cnt   = MIN(entry_cnt + 1, 0x3F);
>         -       hash_tbl_entry  = (hash_tbl_entry_t)name_tbl_entry;
>         +       hash_tbl_entry  =
>         (hash_tbl_entry_t)(uintptr_t)name_tbl_entry;
>                 hash_tbl_entry &= ~0x3F;
>                 hash_tbl_entry |= new_entry_cnt;
>                 return hash_tbl_entry;
>         @@ -584,18 +584,18 @@ static name_tbl_entry_t
>         *name_hash_tbl_lookup(uint32_t hash_value)
>                 if (hash_tbl_entry == 0)
>                         return NULL;
>                 else if ((hash_tbl_entry & 0x3F) != 0)
>         -               return (name_tbl_entry_t *)(hash_tbl_entry &
>         ~0x3F);
>         +               return (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>                    /* This hash_tbl_entry references a secondary hash
>         table, so get
>                 * some more hash_value bits and index that table.
>                 */
>                 hash_idx       = (hash_value >> 16) &
>         (SECONDARY_HASH_TBL_SIZE - 1);
>         -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
>         +       secondary_hash = (secondary_hash_tbl_t
>         *)(uintptr_t)hash_tbl_entry;
>                 hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
>                 if (hash_tbl_entry == 0)
>                         return NULL;
>                 else if ((hash_tbl_entry & 0x3F) != 0)
>         -               return (name_tbl_entry_t *)(hash_tbl_entry &
>         ~0x3F);
>         +               return (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>                    /* Yet again, this hash_tbl_entry references a
>         secondary hash table,
>                 * so get some more hash_value bits and index that
>         table.  We only
>         @@ -604,12 +604,12 @@ static name_tbl_entry_t
>         *name_hash_tbl_lookup(uint32_t hash_value)
>                 * returning NULL.
>                 */
>                 hash_idx       = (hash_value >> 24) &
>         (SECONDARY_HASH_TBL_SIZE - 1);
>         -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
>         +       secondary_hash = (secondary_hash_tbl_t
>         *)(uintptr_t)hash_tbl_entry;
>                 hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
>                 if (hash_tbl_entry == 0)
>                         return NULL;
>                 else if ((hash_tbl_entry & 0x3F) != 0)
>         -               return (name_tbl_entry_t *)(hash_tbl_entry &
>         ~0x3F);
>         +               return (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>                 return NULL;
>           }
>         @@ -655,7 +655,8 @@ static hash_tbl_entry_t
>         secondary_hash_add(name_tbl_entry_t *name_tbl_entry,
>                         hash_tbl_entry =
>         secondary_hash->hash_entries[hash_idx];
>                         entry_cnt      = hash_tbl_entry & 0x3F;
>         -               first_entry    = (name_tbl_entry_t
>         *)(hash_tbl_entry & ~0x3F);
>         +               first_entry    =
>         +                       (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>
>
>     maybe to put it to separate inline then copy paste everywhere? Like
>
>     static inline name_tbl_entry_t *
>     hash_to_name_tbl_entry(name_tbk_entry_t *name){
>         return  (name_tbl_entry_t *)(uintptr_t)name;
>     }
>
>     ?
>
>     Or even to move it to #define
>
>     Maxim.
>
>
>                         name_tbl_entry->next_entry = first_entry;
>                         new_hash_tbl_entry =
>         @@ -666,7 +667,7 @@ static hash_tbl_entry_t
>         secondary_hash_add(name_tbl_entry_t *name_tbl_entry,
>                 }
>                 /* secondary_hash_dump(secondary_hash); */
>         -       return (hash_tbl_entry_t)secondary_hash;
>         +       return (hash_tbl_entry_t)(uintptr_t)secondary_hash;
>           }
>             static hash_tbl_entry_t
>         hash_tbl_remove(secondary_hash_tbl_t *hash_tbl,
>         @@ -693,11 +694,11 @@ static hash_tbl_entry_t
>         hash_tbl_remove(secondary_hash_tbl_t *hash_tbl,
>                                          * new entry onto the front of it.
>                                          */
>                                         head_entry = (name_tbl_entry_t *)
>         -  (hash_tbl_entry & ~0x3F);
>         +  (uintptr_t)(hash_tbl_entry & ~0x3F);
>                                         tail_entry = head_entry;
>                                 } else {
>                                         secondary_hash =
>         (secondary_hash_tbl_t *)
>         -  hash_tbl_entry;
>         +  (uintptr_t)hash_tbl_entry;
>         check_secondary_hash(secondary_hash);
>                                         if (level == 1)
>                                                 break;
>         @@ -758,7 +759,8 @@ static int
>         name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>                         /* This primary hash table entry points to a
>         name_tbl_entry_t
>                          * linked list, so add this new entry onto the
>         front of it.
>                          */
>         -               name_tbl_entry = (name_tbl_entry_t
>         *)(hash_tbl_entry & ~0x3F);
>         +               name_tbl_entry =
>         +                       (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>                         entry_to_add->next_entry = name_tbl_entry;
>                         hash_tbl_entry =
>         make_hash_tbl_entry(entry_to_add, entry_cnt);
>         name_hash_tbl.hash_entries[primary_hash_idx] = hash_tbl_entry;
>         @@ -783,7 +785,7 @@ static int
>         name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>                 * some more hash_value bits and index that table.
>                 */
>                 hash_idx       = (hash_value >> 16) &
>         (SECONDARY_HASH_TBL_SIZE - 1);
>         -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
>         +       secondary_hash = (secondary_hash_tbl_t
>         *)(uintptr_t)hash_tbl_entry;
>                 check_secondary_hash(secondary_hash);
>                 hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
>                 entry_cnt      = hash_tbl_entry & 0x3F;
>         @@ -799,7 +801,8 @@ static int
>         name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>                          * name_tbl_entry_t linked list, so add this
>         new entry onto
>                          * the front of it.
>                          */
>         -               name_tbl_entry = (name_tbl_entry_t
>         *)(hash_tbl_entry & ~0x3F);
>         +               name_tbl_entry =
>         +                       (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>                         entry_to_add->next_entry = name_tbl_entry;
>                         hash_tbl_entry =
>         make_hash_tbl_entry(entry_to_add, entry_cnt);
>         secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;
>         @@ -827,7 +830,7 @@ static int
>         name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>                 * signal failure by returning -1.
>                 */
>                 hash_idx       = (hash_value >> 24) &
>         (SECONDARY_HASH_TBL_SIZE - 1);
>         -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
>         +       secondary_hash = (secondary_hash_tbl_t
>         *)(uintptr_t)hash_tbl_entry;
>                 check_secondary_hash(secondary_hash);
>                 hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
>                 entry_cnt      = hash_tbl_entry & 0x3F;
>         @@ -846,7 +849,8 @@ static int
>         name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
>                          * linked list, we never add another hash
>         table, so we don't
>                          * need to update any secondary table counts.
>                          */
>         -               name_tbl_entry = (name_tbl_entry_t
>         *)(hash_tbl_entry & ~0x3F);
>         +               name_tbl_entry =
>         +                       (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>                         entry_to_add->next_entry = name_tbl_entry;
>                         hash_tbl_entry =
>         make_hash_tbl_entry(entry_to_add, entry_cnt);
>         secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;
>         @@ -875,7 +879,8 @@ static int
>         name_tbl_entry_list_remove(hash_tbl_entry_t *hash_entry_ptr,
>                                  * deleted.
>                                  */
>                                 if (!prev_entry) {
>         -                               hash_tbl_entry  =
>         (hash_tbl_entry_t)next_entry;
>         +                               hash_tbl_entry  =
>         +  (hash_tbl_entry_t)(uintptr_t)next_entry;
>                                         hash_tbl_entry &= ~0x3F;
>                                         hash_tbl_entry |= entry_cnt;
>                                         *hash_entry_ptr = hash_tbl_entry;
>         @@ -922,7 +927,8 @@ static int
>         name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>                         /* This primary hash table entry points to a
>         name_tbl_entry_t
>                          * linked list, so remove entry from this
>         linked list.
>                          */
>         -               name_tbl_entry = (name_tbl_entry_t
>         *)(hash_tbl_entry & ~0x3F);
>         +               name_tbl_entry =
>         +                       (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>                         rc =
>         name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry,
>         entry_to_delete, entry_cnt);
>                         tbn = (*hash_entry_ptr) & ~0x3F;
>         @@ -940,7 +946,7 @@ static int
>         name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>                 * some more hash_value bits and index that table.
>                 */
>                 hash_idx       = (hash_value >> 16) &
>         (SECONDARY_HASH_TBL_SIZE - 1);
>         -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
>         +       secondary_hash = (secondary_hash_tbl_t
>         *)(uintptr_t)hash_tbl_entry;
>                 check_secondary_hash(secondary_hash);
>                 hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];
>                 hash_tbl_entry = *hash_entry_ptr;
>         @@ -955,7 +961,8 @@ static int
>         name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>                          * name_tbl_entry_t linked list, so try to remove
>                          * entry_to_delete from this linked list.
>                          */
>         -               name_tbl_entry = (name_tbl_entry_t
>         *)(hash_tbl_entry & ~0x3F);
>         +               name_tbl_entry =
>         +                       (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>                         rc =
>         name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry,
>         entry_to_delete, entry_cnt);
>                         tbn = (*hash_entry_ptr) & ~0x3F;
>         @@ -988,7 +995,7 @@ static int
>         name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>                 * signal failure by returning -1.
>                 */
>                 hash_idx       = (hash_value >> 24) &
>         (SECONDARY_HASH_TBL_SIZE - 1);
>         -       secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
>         +       secondary_hash = (secondary_hash_tbl_t
>         *)(uintptr_t)hash_tbl_entry;
>                 check_secondary_hash(secondary_hash);
>                 hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];
>                 hash_tbl_entry = *hash_entry_ptr;
>         @@ -1003,7 +1010,8 @@ static int
>         name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
>                          * name_tbl_entry_t linked list, so try to remove
>                          * entry_to_delete from this linked list.
>                          */
>         -               name_tbl_entry = (name_tbl_entry_t
>         *)(hash_tbl_entry & ~0x3F);
>         +               name_tbl_entry =
>         +                       (name_tbl_entry_t
>         *)(uintptr_t)(hash_tbl_entry & ~0x3F);
>                         rc =
>         name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry,
>         entry_to_delete, entry_cnt);
>                         tbn = (*hash_entry_ptr) & ~0x3F;
>         @@ -1172,7 +1180,7 @@ static uint32_t
>         level2_hash_histo(secondary_hash_tbl_t *hash_tbl,
>                                 collisions = 0;
>                         } else {
>                                 name_tbl_entry = (name_tbl_entry_t *)
>         -                               (hash_tbl_entry & ~0x3F);
>         +  (uintptr_t)(hash_tbl_entry & ~0x3F);
>                                 collisions     =
>         linked_list_len(name_tbl_entry);
>                         }
>           @@ -1199,11 +1207,11 @@ static uint32_t
>         level1_hash_histo(secondary_hash_tbl_t *hash_tbl,
>                                 collisions = 0;
>                         } else if ((hash_tbl_entry & 0x3F) != 0) {
>                                 name_tbl_entry = (name_tbl_entry_t *)
>         -                               (hash_tbl_entry & ~0x3F);
>         +  (uintptr_t)(hash_tbl_entry & ~0x3F);
>                                 collisions     =
>         linked_list_len(name_tbl_entry);
>                         } else {
>                                 secondary_hash = (secondary_hash_tbl_t *)
>         -                               hash_tbl_entry;
>         +  (uintptr_t)hash_tbl_entry;
>                                 collisions     =
>         level2_hash_histo(secondary_hash,
>              level2_histo);
>                         }
>         @@ -1232,7 +1240,7 @@ static void secondary_hash_histo_print(void)
>                                  * hash table
>                                  */
>                                 secondary_hash = (secondary_hash_tbl_t *)
>         -                               hash_tbl_entry;
>         +  (uintptr_t)hash_tbl_entry;
>         level1_hash_histo(secondary_hash, level1_histo,
>         level2_histo);
>                         }
>         diff --git a/platform/linux-generic/odp_pkt_queue.c
>         b/platform/linux-generic/odp_pkt_queue.c
>         index 45508eb..88520b1 100644
>         --- a/platform/linux-generic/odp_pkt_queue.c
>         +++ b/platform/linux-generic/odp_pkt_queue.c
>         @@ -215,7 +215,7 @@ _odp_int_queue_pool_t
>         _odp_queue_pool_create(uint32_t max_num_queues,
>                 pool->min_free_list_size = pool->free_list_size;
>                 pool->peak_free_list_size = pool->free_list_size;
>         -       return (_odp_int_queue_pool_t)pool;
>         +       return (_odp_int_queue_pool_t)(uintptr_t)pool;
>           }
>             _odp_int_pkt_queue_t
>         _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool)
>         @@ -223,7 +223,7 @@ _odp_int_pkt_queue_t
>         _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool)
>                 queue_pool_t *pool;
>                 uint32_t queue_num;
>           -     pool = (queue_pool_t *)queue_pool;
>         +       pool = (queue_pool_t *)(uintptr_t)queue_pool;
>                 queue_num = pool->next_queue_num++;
>                 if (pool->max_queue_num < queue_num)
>                         return _ODP_INT_PKT_QUEUE_INVALID;
>         @@ -239,7 +239,7 @@ int
>         _odp_pkt_queue_append(_odp_int_queue_pool_t queue_pool,
>                 uint32_t queue_num, first_blk_idx, tail_blk_idx,
>         new_tail_blk_idx;
>                 uint32_t idx;
>           -     pool = (queue_pool_t *)queue_pool;
>         +       pool = (queue_pool_t *)(uintptr_t)queue_pool;
>                 queue_num = (uint32_t)pkt_queue;
>                 if ((queue_num == 0) || (pool->max_queue_num < queue_num))
>                         return -2;
>         @@ -296,7 +296,7 @@ int
>         _odp_pkt_queue_remove(_odp_int_queue_pool_t queue_pool,
>                 queue_blk_t *first_blk, *second_blk;
>                 uint32_t queue_num, first_blk_idx, next_blk_idx, idx;
>           -     pool = (queue_pool_t *)queue_pool;
>         +       pool = (queue_pool_t *)(uintptr_t)queue_pool;
>                 queue_num = (uint32_t)pkt_queue;
>                 if ((queue_num == 0) || (pool->max_queue_num < queue_num))
>                         return -2;
>         @@ -347,7 +347,7 @@ void
>         _odp_pkt_queue_stats_print(_odp_int_queue_pool_t queue_pool)
>           {
>                 queue_pool_t *pool;
>           -     pool = (queue_pool_t *)queue_pool;
>         +       pool = (queue_pool_t *)(uintptr_t)queue_pool;
>                 ODP_DBG("pkt_queue_stats - queue_pool=0x%lX\n",
>         queue_pool);
>                 ODP_DBG("  max_queue_num=%u max_queued_pkts=%u
>         next_queue_num=%u\n",
>                         pool->max_queue_num, pool->max_queued_pkts,
>         @@ -367,7 +367,7 @@ void
>         _odp_queue_pool_destroy(_odp_int_queue_pool_t queue_pool)
>                 queue_pool_t *pool;
>                 uint32_t idx;
>           -     pool = (queue_pool_t *)queue_pool;
>         +       pool = (queue_pool_t *)(uintptr_t)queue_pool;
>                 for (idx = 0; idx < 16; idx++) {
>                         queue_region_desc =
>         &pool->queue_region_descs[idx];
>                         if (queue_region_desc->queue_blks)
>         diff --git a/platform/linux-generic/odp_sorted_list.c
>         b/platform/linux-generic/odp_sorted_list.c
>         index 221754d..5811266 100644
>         --- a/platform/linux-generic/odp_sorted_list.c
>         +++ b/platform/linux-generic/odp_sorted_list.c
>         @@ -56,7 +56,7 @@ _odp_int_sorted_pool_t
>         _odp_sorted_pool_create(uint32_t max_sorted_lists)
>                 list_descs = malloc(malloc_len);
>                 memset(list_descs, 0, malloc_len);
>                 pool->list_descs = list_descs;
>         -       return (_odp_int_sorted_pool_t)pool;
>         +       return (_odp_int_sorted_pool_t)(uintptr_t)pool;
>           }
>             _odp_int_sorted_list_t
>         @@ -66,7 +66,7 @@
>         _odp_sorted_list_create(_odp_int_sorted_pool_t sorted_pool,
>                 sorted_pool_t *pool;
>                 uint32_t       list_idx;
>           -     pool     = (sorted_pool_t *)sorted_pool;
>         +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>                 list_idx = pool->next_list_idx++;
>                 return (_odp_int_sorted_list_t)list_idx;
>           }
>         @@ -81,7 +81,7 @@ int
>         _odp_sorted_list_insert(_odp_int_sorted_pool_t sorted_pool,
>                 sorted_pool_t      *pool;
>                 uint32_t            list_idx;
>           -     pool     = (sorted_pool_t *)sorted_pool;
>         +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>                 list_idx = (uint32_t)sorted_list;
>                 if ((pool->next_list_idx    <= list_idx) ||
>                     (pool->max_sorted_lists <= list_idx))
>         @@ -125,7 +125,7 @@ int
>         _odp_sorted_list_find(_odp_int_sorted_pool_t sorted_pool,
>                 sorted_pool_t      *pool;
>                 uint32_t            list_idx;
>           -     pool     = (sorted_pool_t *)sorted_pool;
>         +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>                 list_idx = (uint32_t)sorted_list;
>                 if ((pool->next_list_idx    <= list_idx) ||
>                     (pool->max_sorted_lists <= list_idx))
>         @@ -161,7 +161,7 @@ int
>         _odp_sorted_list_delete(_odp_int_sorted_pool_t sorted_pool,
>                 sorted_pool_t      *pool;
>                 uint32_t            list_idx;
>           -     pool     = (sorted_pool_t *)sorted_pool;
>         +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>                 list_idx = (uint32_t)sorted_list;
>                 if ((pool->next_list_idx    <= list_idx) ||
>                     (pool->max_sorted_lists <= list_idx))
>         @@ -207,7 +207,7 @@ int
>         _odp_sorted_list_remove(_odp_int_sorted_pool_t sorted_pool,
>                 sorted_pool_t      *pool;
>                 uint32_t            list_idx;
>           -     pool     = (sorted_pool_t *)sorted_pool;
>         +       pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
>                 list_idx = (uint32_t)sorted_list;
>                 if ((pool->next_list_idx    <= list_idx) ||
>                     (pool->max_sorted_lists <= list_idx))
>         @@ -237,7 +237,7 @@ void
>         _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool)
>           {
>                 sorted_pool_t *pool;
>           -     pool = (sorted_pool_t *)sorted_pool;
>         +       pool = (sorted_pool_t *)(uintptr_t)sorted_pool;
>                 ODP_DBG("sorted_pool=0x%lX\n", sorted_pool);
>                 ODP_DBG("  max_sorted_lists=%u next_list_idx=%u\n",
>                         pool->max_sorted_lists, pool->next_list_idx);
>         @@ -253,7 +253,7 @@ void
>         _odp_sorted_pool_destroy(_odp_int_sorted_pool_t sorted_pool)
>                 sorted_pool_t       *pool;
>                 uint32_t             list_idx;
>           -     pool       = (sorted_pool_t *)sorted_pool;
>         +       pool       = (sorted_pool_t *)(uintptr_t)sorted_pool;
>                 list_descs = pool->list_descs;
>                 for (list_idx = 0; list_idx < pool->next_list_idx;
>         list_idx++) {
>         diff --git a/platform/linux-generic/odp_timer_wheel.c
>         b/platform/linux-generic/odp_timer_wheel.c
>         index bcab01b..21be3ef 100644
>         --- a/platform/linux-generic/odp_timer_wheel.c
>         +++ b/platform/linux-generic/odp_timer_wheel.c
>         @@ -748,7 +748,7 @@ _odp_timer_wheel_t
>         _odp_timer_wheel_create(uint32_t max_concurrent_timers,
>                 free_list_add(timer_wheels, max_concurrent_timers / 4);
>                 timer_wheels->min_free_list_size  =
>         timer_wheels->free_list_size;
>                 timer_wheels->peak_free_list_size =
>         timer_wheels->free_list_size;
>         -       return (_odp_timer_wheel_t)timer_wheels;
>         +       return (_odp_timer_wheel_t)(uintptr_t)timer_wheels;
>           }
>             uint32_t
>         _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel,
>         @@ -759,7 +759,7 @@ uint32_t
>         _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel,
>                 uint32_t        desc_idx;
>                 int             rc;
>           -     timer_wheels      = (timer_wheels_t *)timer_wheel;
>         +       timer_wheels      = (timer_wheels_t
>         *)(uintptr_t)timer_wheel;
>                 new_current_ticks = current_time >> CYCLES_TO_TICKS_SHIFT;
>                 elapsed_ticks     = new_current_ticks -
>         timer_wheels->current_ticks;
>                 if (elapsed_ticks == 0)
>         @@ -787,13 +787,13 @@ int
>         _odp_timer_wheel_insert(_odp_timer_wheel_t timer_wheel,
>                 uint64_t        user_data, wakeup_ticks;
>                 int             rc;
>           -     user_data = (uint64_t)user_ptr;
>         +       user_data = (uint64_t)(uintptr_t)user_ptr;
>                 if (user_data == 0)
>                         return -4;  /* user_data cannot be 0! */
>                 else if ((user_data & 0x3) != 0)
>                         return -5;  /* user_data ptr must be at least
>         4-byte aligned. */
>           -     timer_wheels = (timer_wheels_t *)timer_wheel;
>         +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>                 wakeup_ticks = (wakeup_time >> CYCLES_TO_TICKS_SHIFT) + 1;
>                 if (wakeup_time <= timer_wheels->current_ticks)
>                         return -6;
>         @@ -828,21 +828,21 @@ void
>         *_odp_timer_wheel_next_expired(_odp_timer_wheel_t timer_wheel)
>                 int             rc;
>                 /* Remove the head of the timer wheel. */
>         -       timer_wheels = (timer_wheels_t *)timer_wheel;
>         +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>                 rc = expired_timers_remove(timer_wheels, &user_data);
>                 if (rc <= 0)
>                         return NULL;
>                 user_data &= ~0x3;
>                 timer_wheels->total_timer_removes++;
>         -       return (void *)user_data;
>         +       return (void *)(uintptr_t)user_data;
>           }
>             uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t
>         timer_wheel)
>           {
>                 timer_wheels_t *timer_wheels;
>           -     timer_wheels = (timer_wheels_t *)timer_wheel;
>         +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>                 return timer_wheels->total_timer_inserts -
>                         timer_wheels->total_timer_removes;
>           }
>         @@ -862,7 +862,7 @@ void
>         _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel)
>                 expired_ring_t *expired_ring;
>                 uint32_t        wheel_idx;
>           -     timer_wheels = (timer_wheels_t *)timer_wheel;
>         +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>                 expired_ring = timer_wheels->expired_timers_ring;
>                 ODP_DBG("_odp_int_timer_wheel_stats current_ticks=%lu\n",
>         @@ -894,7 +894,7 @@ void
>         _odp_timer_wheel_destroy(_odp_timer_wheel_t timer_wheel)
>                 timer_wheels_t *timer_wheels;
>                 expired_ring_t *expired_ring;
>           -     timer_wheels = (timer_wheels_t *)timer_wheel;
>         +       timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
>                 expired_ring = timer_wheels->expired_timers_ring;
>                 /* First free all of the block_of_timer_blks @TODO */
>         diff --git a/platform/linux-generic/odp_traffic_mngr.c
>         b/platform/linux-generic/odp_traffic_mngr.c
>         index 88e0ada..6179568 100644
>         --- a/platform/linux-generic/odp_traffic_mngr.c
>         +++ b/platform/linux-generic/odp_traffic_mngr.c
>         @@ -658,7 +658,7 @@ static int tm_delay_pkt(tm_system_t
>         *tm_system, tm_shaper_obj_t *shaper_obj,
>                 timer_context = (((uint64_t)tm_queue_obj->timer_seq)
>         << 32) |
>         (((uint64_t)tm_queue_obj->queue_num) << 4);
>         _odp_timer_wheel_insert(tm_system->_odp_int_timer_wheel,
>         -                               wakeup_time, (void
>         *)timer_context);
>         +                               wakeup_time, (void
>         *)(uintptr_t)timer_context);
>                 tm_queue_obj->timer_reason = UNDELAY_PKT;
>                 tm_queue_obj->timer_shaper = shaper_obj;
>         @@ -1680,7 +1680,7 @@ static int
>         tm_process_expired_timers(tm_system_t *tm_system,
>                         if (!ptr)
>                                 return work_done;
>           -             timer_context = (uint64_t)ptr;
>         +               timer_context = (uint64_t)(uintptr_t)ptr;
>                         queue_num = (timer_context & 0xFFFFFFFF) >> 4;
>                         timer_seq = timer_context >> 32;
>                         tm_queue_obj =
>         tm_system->queue_num_tbl[queue_num];
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_traffic_mngr_internal.h b/platform/linux-generic/include/odp_traffic_mngr_internal.h
index c2d5cf4..e48e213 100644
--- a/platform/linux-generic/include/odp_traffic_mngr_internal.h
+++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h
@@ -48,8 +48,8 @@  typedef struct stat  file_stat_t;
 
 /* Macros to convert handles to internal pointers and vice versa. */
 
-#define MAKE_ODP_TM_HANDLE(tm_system)  ((odp_tm_t)tm_system)
-#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t *)odp_tm)
+#define MAKE_ODP_TM_HANDLE(tm_system)  ((odp_tm_t)(uintptr_t)tm_system)
+#define GET_TM_SYSTEM(odp_tm)          ((tm_system_t *)(uintptr_t)odp_tm)
 
 #define MAKE_PROFILE_HANDLE(profile_kind, tbl_idx) \
 	(((profile_kind & 0xF) << 28) | ((tbl_idx + 1) & 0xFFFFFFF))
@@ -59,11 +59,14 @@  typedef struct stat  file_stat_t;
 
 #define GET_TBL_IDX(profile_handle)  ((profile_handle & 0xFFFFFFF) - 1)
 
-#define MAKE_ODP_TM_NODE(tm_node_obj)  ((odp_tm_node_t)(tm_node_obj))
-#define GET_TM_NODE_OBJ(odp_tm_node)   ((tm_node_obj_t *)(odp_tm_node))
+#define MAKE_ODP_TM_NODE(tm_node_obj) ((odp_tm_node_t)(uintptr_t)(tm_node_obj))
+#define GET_TM_NODE_OBJ(odp_tm_node) \
+	((tm_node_obj_t *)(uintptr_t)(odp_tm_node))
 
-#define MAKE_ODP_TM_QUEUE(tm_queue_obj)  ((odp_tm_queue_t)(tm_queue_obj))
-#define GET_TM_QUEUE_OBJ(odp_tm_queue)   ((tm_queue_obj_t *)(odp_tm_queue))
+#define MAKE_ODP_TM_QUEUE(tm_queue_obj) \
+	((odp_tm_queue_t)(uintptr_t)(tm_queue_obj))
+#define GET_TM_QUEUE_OBJ(odp_tm_queue) \
+	((tm_queue_obj_t *)(uintptr_t)(odp_tm_queue))
 
 typedef uint64_t tm_handle_t;
 
diff --git a/platform/linux-generic/odp_name_table.c b/platform/linux-generic/odp_name_table.c
index 10ce099..10a760e 100644
--- a/platform/linux-generic/odp_name_table.c
+++ b/platform/linux-generic/odp_name_table.c
@@ -567,7 +567,7 @@  static hash_tbl_entry_t make_hash_tbl_entry(name_tbl_entry_t *name_tbl_entry,
 	uint32_t         new_entry_cnt;
 
 	new_entry_cnt   = MIN(entry_cnt + 1, 0x3F);
-	hash_tbl_entry  = (hash_tbl_entry_t)name_tbl_entry;
+	hash_tbl_entry  = (hash_tbl_entry_t)(uintptr_t)name_tbl_entry;
 	hash_tbl_entry &= ~0x3F;
 	hash_tbl_entry |= new_entry_cnt;
 	return hash_tbl_entry;
@@ -584,18 +584,18 @@  static name_tbl_entry_t *name_hash_tbl_lookup(uint32_t hash_value)
 	if (hash_tbl_entry == 0)
 		return NULL;
 	else if ((hash_tbl_entry & 0x3F) != 0)
-		return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 
        /* This hash_tbl_entry references a secondary hash table, so get
 	* some more hash_value bits and index that table.
 	*/
 	hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE - 1);
-	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
+	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
 	hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
 	if (hash_tbl_entry == 0)
 		return NULL;
 	else if ((hash_tbl_entry & 0x3F) != 0)
-		return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 
        /* Yet again, this hash_tbl_entry references a secondary hash table,
 	* so get some more hash_value bits and index that table.  We only
@@ -604,12 +604,12 @@  static name_tbl_entry_t *name_hash_tbl_lookup(uint32_t hash_value)
 	* returning NULL.
 	*/
 	hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE - 1);
-	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
+	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
 	hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
 	if (hash_tbl_entry == 0)
 		return NULL;
 	else if ((hash_tbl_entry & 0x3F) != 0)
-		return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 
 	return NULL;
 }
@@ -655,7 +655,8 @@  static hash_tbl_entry_t secondary_hash_add(name_tbl_entry_t *name_tbl_entry,
 
 		hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
 		entry_cnt      = hash_tbl_entry & 0x3F;
-		first_entry    = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		first_entry    =
+			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 
 		name_tbl_entry->next_entry = first_entry;
 		new_hash_tbl_entry =
@@ -666,7 +667,7 @@  static hash_tbl_entry_t secondary_hash_add(name_tbl_entry_t *name_tbl_entry,
 	}
 
 	/* secondary_hash_dump(secondary_hash); */
-	return (hash_tbl_entry_t)secondary_hash;
+	return (hash_tbl_entry_t)(uintptr_t)secondary_hash;
 }
 
 static hash_tbl_entry_t hash_tbl_remove(secondary_hash_tbl_t *hash_tbl,
@@ -693,11 +694,11 @@  static hash_tbl_entry_t hash_tbl_remove(secondary_hash_tbl_t *hash_tbl,
 				 * new entry onto the front of it.
 				 */
 				head_entry = (name_tbl_entry_t *)
-					(hash_tbl_entry & ~0x3F);
+					(uintptr_t)(hash_tbl_entry & ~0x3F);
 				tail_entry = head_entry;
 			} else {
 				secondary_hash = (secondary_hash_tbl_t *)
-					hash_tbl_entry;
+					(uintptr_t)hash_tbl_entry;
 				check_secondary_hash(secondary_hash);
 				if (level == 1)
 					break;
@@ -758,7 +759,8 @@  static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
 		/* This primary hash table entry points to a name_tbl_entry_t
 		 * linked list, so add this new entry onto the front of it.
 		 */
-		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		name_tbl_entry =
+			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 		entry_to_add->next_entry = name_tbl_entry;
 		hash_tbl_entry = make_hash_tbl_entry(entry_to_add, entry_cnt);
 		name_hash_tbl.hash_entries[primary_hash_idx] = hash_tbl_entry;
@@ -783,7 +785,7 @@  static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
 	* some more hash_value bits and index that table.
 	*/
 	hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE - 1);
-	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
+	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
 	check_secondary_hash(secondary_hash);
 	hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
 	entry_cnt      = hash_tbl_entry & 0x3F;
@@ -799,7 +801,8 @@  static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
 		 * name_tbl_entry_t linked list, so add this new entry onto
 		 * the front of it.
 		 */
-		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		name_tbl_entry =
+			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 		entry_to_add->next_entry = name_tbl_entry;
 		hash_tbl_entry = make_hash_tbl_entry(entry_to_add, entry_cnt);
 		secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;
@@ -827,7 +830,7 @@  static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
 	* signal failure by returning -1.
 	*/
 	hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE - 1);
-	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
+	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
 	check_secondary_hash(secondary_hash);
 	hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
 	entry_cnt      = hash_tbl_entry & 0x3F;
@@ -846,7 +849,8 @@  static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add,
 		 * linked list, we never add another hash table, so we don't
 		 * need to update any secondary table counts.
 		 */
-		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		name_tbl_entry =
+			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 		entry_to_add->next_entry = name_tbl_entry;
 		hash_tbl_entry = make_hash_tbl_entry(entry_to_add, entry_cnt);
 		secondary_hash->hash_entries[hash_idx] = hash_tbl_entry;
@@ -875,7 +879,8 @@  static int name_tbl_entry_list_remove(hash_tbl_entry_t *hash_entry_ptr,
 			 * deleted.
 			 */
 			if (!prev_entry) {
-				hash_tbl_entry  = (hash_tbl_entry_t)next_entry;
+				hash_tbl_entry  =
+					(hash_tbl_entry_t)(uintptr_t)next_entry;
 				hash_tbl_entry &= ~0x3F;
 				hash_tbl_entry |= entry_cnt;
 				*hash_entry_ptr = hash_tbl_entry;
@@ -922,7 +927,8 @@  static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
 		/* This primary hash table entry points to a name_tbl_entry_t
 		 * linked list, so remove entry from this linked list.
 		 */
-		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		name_tbl_entry =
+			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 		rc = name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry,
 						entry_to_delete, entry_cnt);
 		tbn = (*hash_entry_ptr) & ~0x3F;
@@ -940,7 +946,7 @@  static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
 	* some more hash_value bits and index that table.
 	*/
 	hash_idx       = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE - 1);
-	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
+	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
 	check_secondary_hash(secondary_hash);
 	hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];
 	hash_tbl_entry = *hash_entry_ptr;
@@ -955,7 +961,8 @@  static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
 		 * name_tbl_entry_t linked list, so try to remove
 		 * entry_to_delete from this linked list.
 		 */
-		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		name_tbl_entry =
+			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 		rc = name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry,
 						entry_to_delete, entry_cnt);
 		tbn = (*hash_entry_ptr) & ~0x3F;
@@ -988,7 +995,7 @@  static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
 	* signal failure by returning -1.
 	*/
 	hash_idx       = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE - 1);
-	secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
+	secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry;
 	check_secondary_hash(secondary_hash);
 	hash_entry_ptr = &secondary_hash->hash_entries[hash_idx];
 	hash_tbl_entry = *hash_entry_ptr;
@@ -1003,7 +1010,8 @@  static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete,
 		 * name_tbl_entry_t linked list, so try to remove
 		 * entry_to_delete from this linked list.
 		 */
-		name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F);
+		name_tbl_entry =
+			(name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F);
 		rc = name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry,
 						entry_to_delete, entry_cnt);
 		tbn = (*hash_entry_ptr) & ~0x3F;
@@ -1172,7 +1180,7 @@  static uint32_t level2_hash_histo(secondary_hash_tbl_t *hash_tbl,
 			collisions = 0;
 		} else {
 			name_tbl_entry = (name_tbl_entry_t *)
-				(hash_tbl_entry & ~0x3F);
+				(uintptr_t)(hash_tbl_entry & ~0x3F);
 			collisions     = linked_list_len(name_tbl_entry);
 		}
 
@@ -1199,11 +1207,11 @@  static uint32_t level1_hash_histo(secondary_hash_tbl_t *hash_tbl,
 			collisions = 0;
 		} else if ((hash_tbl_entry & 0x3F) != 0) {
 			name_tbl_entry = (name_tbl_entry_t *)
-				(hash_tbl_entry & ~0x3F);
+				(uintptr_t)(hash_tbl_entry & ~0x3F);
 			collisions     = linked_list_len(name_tbl_entry);
 		} else {
 			secondary_hash = (secondary_hash_tbl_t *)
-				hash_tbl_entry;
+				(uintptr_t)hash_tbl_entry;
 			collisions     = level2_hash_histo(secondary_hash,
 							   level2_histo);
 		}
@@ -1232,7 +1240,7 @@  static void secondary_hash_histo_print(void)
 			 * hash table
 			 */
 			secondary_hash = (secondary_hash_tbl_t *)
-				hash_tbl_entry;
+				(uintptr_t)hash_tbl_entry;
 			level1_hash_histo(secondary_hash, level1_histo,
 					  level2_histo);
 		}
diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c
index 45508eb..88520b1 100644
--- a/platform/linux-generic/odp_pkt_queue.c
+++ b/platform/linux-generic/odp_pkt_queue.c
@@ -215,7 +215,7 @@  _odp_int_queue_pool_t _odp_queue_pool_create(uint32_t max_num_queues,
 
 	pool->min_free_list_size = pool->free_list_size;
 	pool->peak_free_list_size = pool->free_list_size;
-	return (_odp_int_queue_pool_t)pool;
+	return (_odp_int_queue_pool_t)(uintptr_t)pool;
 }
 
 _odp_int_pkt_queue_t _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool)
@@ -223,7 +223,7 @@  _odp_int_pkt_queue_t _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool)
 	queue_pool_t *pool;
 	uint32_t queue_num;
 
-	pool = (queue_pool_t *)queue_pool;
+	pool = (queue_pool_t *)(uintptr_t)queue_pool;
 	queue_num = pool->next_queue_num++;
 	if (pool->max_queue_num < queue_num)
 		return _ODP_INT_PKT_QUEUE_INVALID;
@@ -239,7 +239,7 @@  int _odp_pkt_queue_append(_odp_int_queue_pool_t queue_pool,
 	uint32_t queue_num, first_blk_idx, tail_blk_idx, new_tail_blk_idx;
 	uint32_t idx;
 
-	pool = (queue_pool_t *)queue_pool;
+	pool = (queue_pool_t *)(uintptr_t)queue_pool;
 	queue_num = (uint32_t)pkt_queue;
 	if ((queue_num == 0) || (pool->max_queue_num < queue_num))
 		return -2;
@@ -296,7 +296,7 @@  int _odp_pkt_queue_remove(_odp_int_queue_pool_t queue_pool,
 	queue_blk_t *first_blk, *second_blk;
 	uint32_t queue_num, first_blk_idx, next_blk_idx, idx;
 
-	pool = (queue_pool_t *)queue_pool;
+	pool = (queue_pool_t *)(uintptr_t)queue_pool;
 	queue_num = (uint32_t)pkt_queue;
 	if ((queue_num == 0) || (pool->max_queue_num < queue_num))
 		return -2;
@@ -347,7 +347,7 @@  void _odp_pkt_queue_stats_print(_odp_int_queue_pool_t queue_pool)
 {
 	queue_pool_t *pool;
 
-	pool = (queue_pool_t *)queue_pool;
+	pool = (queue_pool_t *)(uintptr_t)queue_pool;
 	ODP_DBG("pkt_queue_stats - queue_pool=0x%lX\n", queue_pool);
 	ODP_DBG("  max_queue_num=%u max_queued_pkts=%u next_queue_num=%u\n",
 		pool->max_queue_num, pool->max_queued_pkts,
@@ -367,7 +367,7 @@  void _odp_queue_pool_destroy(_odp_int_queue_pool_t queue_pool)
 	queue_pool_t *pool;
 	uint32_t idx;
 
-	pool = (queue_pool_t *)queue_pool;
+	pool = (queue_pool_t *)(uintptr_t)queue_pool;
 	for (idx = 0; idx < 16; idx++) {
 		queue_region_desc = &pool->queue_region_descs[idx];
 		if (queue_region_desc->queue_blks)
diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c
index 221754d..5811266 100644
--- a/platform/linux-generic/odp_sorted_list.c
+++ b/platform/linux-generic/odp_sorted_list.c
@@ -56,7 +56,7 @@  _odp_int_sorted_pool_t _odp_sorted_pool_create(uint32_t max_sorted_lists)
 	list_descs = malloc(malloc_len);
 	memset(list_descs, 0, malloc_len);
 	pool->list_descs = list_descs;
-	return (_odp_int_sorted_pool_t)pool;
+	return (_odp_int_sorted_pool_t)(uintptr_t)pool;
 }
 
 _odp_int_sorted_list_t
@@ -66,7 +66,7 @@  _odp_sorted_list_create(_odp_int_sorted_pool_t sorted_pool,
 	sorted_pool_t *pool;
 	uint32_t       list_idx;
 
-	pool     = (sorted_pool_t *)sorted_pool;
+	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
 	list_idx = pool->next_list_idx++;
 	return (_odp_int_sorted_list_t)list_idx;
 }
@@ -81,7 +81,7 @@  int _odp_sorted_list_insert(_odp_int_sorted_pool_t sorted_pool,
 	sorted_pool_t      *pool;
 	uint32_t            list_idx;
 
-	pool     = (sorted_pool_t *)sorted_pool;
+	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
 	list_idx = (uint32_t)sorted_list;
 	if ((pool->next_list_idx    <= list_idx) ||
 	    (pool->max_sorted_lists <= list_idx))
@@ -125,7 +125,7 @@  int _odp_sorted_list_find(_odp_int_sorted_pool_t sorted_pool,
 	sorted_pool_t      *pool;
 	uint32_t            list_idx;
 
-	pool     = (sorted_pool_t *)sorted_pool;
+	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
 	list_idx = (uint32_t)sorted_list;
 	if ((pool->next_list_idx    <= list_idx) ||
 	    (pool->max_sorted_lists <= list_idx))
@@ -161,7 +161,7 @@  int _odp_sorted_list_delete(_odp_int_sorted_pool_t sorted_pool,
 	sorted_pool_t      *pool;
 	uint32_t            list_idx;
 
-	pool     = (sorted_pool_t *)sorted_pool;
+	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
 	list_idx = (uint32_t)sorted_list;
 	if ((pool->next_list_idx    <= list_idx) ||
 	    (pool->max_sorted_lists <= list_idx))
@@ -207,7 +207,7 @@  int _odp_sorted_list_remove(_odp_int_sorted_pool_t sorted_pool,
 	sorted_pool_t      *pool;
 	uint32_t            list_idx;
 
-	pool     = (sorted_pool_t *)sorted_pool;
+	pool     = (sorted_pool_t *)(uintptr_t)sorted_pool;
 	list_idx = (uint32_t)sorted_list;
 	if ((pool->next_list_idx    <= list_idx) ||
 	    (pool->max_sorted_lists <= list_idx))
@@ -237,7 +237,7 @@  void _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool)
 {
 	sorted_pool_t *pool;
 
-	pool = (sorted_pool_t *)sorted_pool;
+	pool = (sorted_pool_t *)(uintptr_t)sorted_pool;
 	ODP_DBG("sorted_pool=0x%lX\n", sorted_pool);
 	ODP_DBG("  max_sorted_lists=%u next_list_idx=%u\n",
 		pool->max_sorted_lists, pool->next_list_idx);
@@ -253,7 +253,7 @@  void _odp_sorted_pool_destroy(_odp_int_sorted_pool_t sorted_pool)
 	sorted_pool_t       *pool;
 	uint32_t             list_idx;
 
-	pool       = (sorted_pool_t *)sorted_pool;
+	pool       = (sorted_pool_t *)(uintptr_t)sorted_pool;
 	list_descs = pool->list_descs;
 
 	for (list_idx = 0; list_idx < pool->next_list_idx; list_idx++) {
diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c
index bcab01b..21be3ef 100644
--- a/platform/linux-generic/odp_timer_wheel.c
+++ b/platform/linux-generic/odp_timer_wheel.c
@@ -748,7 +748,7 @@  _odp_timer_wheel_t _odp_timer_wheel_create(uint32_t max_concurrent_timers,
 	free_list_add(timer_wheels, max_concurrent_timers / 4);
 	timer_wheels->min_free_list_size  = timer_wheels->free_list_size;
 	timer_wheels->peak_free_list_size = timer_wheels->free_list_size;
-	return (_odp_timer_wheel_t)timer_wheels;
+	return (_odp_timer_wheel_t)(uintptr_t)timer_wheels;
 }
 
 uint32_t _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel,
@@ -759,7 +759,7 @@  uint32_t _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel,
 	uint32_t        desc_idx;
 	int             rc;
 
-	timer_wheels      = (timer_wheels_t *)timer_wheel;
+	timer_wheels      = (timer_wheels_t *)(uintptr_t)timer_wheel;
 	new_current_ticks = current_time >> CYCLES_TO_TICKS_SHIFT;
 	elapsed_ticks     = new_current_ticks - timer_wheels->current_ticks;
 	if (elapsed_ticks == 0)
@@ -787,13 +787,13 @@  int _odp_timer_wheel_insert(_odp_timer_wheel_t timer_wheel,
 	uint64_t        user_data, wakeup_ticks;
 	int             rc;
 
-	user_data = (uint64_t)user_ptr;
+	user_data = (uint64_t)(uintptr_t)user_ptr;
 	if (user_data == 0)
 		return -4;  /* user_data cannot be 0! */
 	else if ((user_data & 0x3) != 0)
 		return -5;  /* user_data ptr must be at least 4-byte aligned. */
 
-	timer_wheels = (timer_wheels_t *)timer_wheel;
+	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
 	wakeup_ticks = (wakeup_time >> CYCLES_TO_TICKS_SHIFT) + 1;
 	if (wakeup_time <= timer_wheels->current_ticks)
 		return -6;
@@ -828,21 +828,21 @@  void *_odp_timer_wheel_next_expired(_odp_timer_wheel_t timer_wheel)
 	int             rc;
 
 	/* Remove the head of the timer wheel. */
-	timer_wheels = (timer_wheels_t *)timer_wheel;
+	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
 	rc = expired_timers_remove(timer_wheels, &user_data);
 	if (rc <= 0)
 		return NULL;
 
 	user_data &= ~0x3;
 	timer_wheels->total_timer_removes++;
-	return (void *)user_data;
+	return (void *)(uintptr_t)user_data;
 }
 
 uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t timer_wheel)
 {
 	timer_wheels_t *timer_wheels;
 
-	timer_wheels = (timer_wheels_t *)timer_wheel;
+	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
 	return timer_wheels->total_timer_inserts -
 		timer_wheels->total_timer_removes;
 }
@@ -862,7 +862,7 @@  void _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel)
 	expired_ring_t *expired_ring;
 	uint32_t        wheel_idx;
 
-	timer_wheels = (timer_wheels_t *)timer_wheel;
+	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
 	expired_ring = timer_wheels->expired_timers_ring;
 
 	ODP_DBG("_odp_int_timer_wheel_stats current_ticks=%lu\n",
@@ -894,7 +894,7 @@  void _odp_timer_wheel_destroy(_odp_timer_wheel_t timer_wheel)
 	timer_wheels_t *timer_wheels;
 	expired_ring_t *expired_ring;
 
-	timer_wheels = (timer_wheels_t *)timer_wheel;
+	timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel;
 	expired_ring = timer_wheels->expired_timers_ring;
 
 	/* First free all of the block_of_timer_blks @TODO */
diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c
index 88e0ada..6179568 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -658,7 +658,7 @@  static int tm_delay_pkt(tm_system_t *tm_system, tm_shaper_obj_t *shaper_obj,
 	timer_context = (((uint64_t)tm_queue_obj->timer_seq) << 32) |
 		(((uint64_t)tm_queue_obj->queue_num) << 4);
 	_odp_timer_wheel_insert(tm_system->_odp_int_timer_wheel,
-				wakeup_time, (void *)timer_context);
+				wakeup_time, (void *)(uintptr_t)timer_context);
 
 	tm_queue_obj->timer_reason = UNDELAY_PKT;
 	tm_queue_obj->timer_shaper = shaper_obj;
@@ -1680,7 +1680,7 @@  static int tm_process_expired_timers(tm_system_t *tm_system,
 		if (!ptr)
 			return work_done;
 
-		timer_context = (uint64_t)ptr;
+		timer_context = (uint64_t)(uintptr_t)ptr;
 		queue_num = (timer_context & 0xFFFFFFFF) >> 4;
 		timer_seq = timer_context >> 32;
 		tm_queue_obj = tm_system->queue_num_tbl[queue_num];