For the series: Reviewed-by: Balasubramanian Manoharan <[email protected]>
On 1 March 2017 at 14:57, Petri Savolainen <[email protected]> wrote: > Use conversion function instead of casting. > > Signed-off-by: Petri Savolainen <[email protected]> > --- > platform/linux-generic/include/odp_packet_internal.h | 5 +++++ > platform/linux-generic/odp_packet.c | 5 ----- > platform/linux-generic/pktio/ipc.c | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/platform/linux-generic/include/odp_packet_internal.h > b/platform/linux-generic/include/odp_packet_internal.h > index 4f844d1..0a9f177 100644 > --- a/platform/linux-generic/include/odp_packet_internal.h > +++ b/platform/linux-generic/include/odp_packet_internal.h > @@ -163,6 +163,11 @@ static inline odp_packet_hdr_t > *odp_packet_hdr(odp_packet_t pkt) > return (odp_packet_hdr_t *)(uintptr_t)pkt; > } > > +static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr) > +{ > + return (odp_packet_t)pkt_hdr; > +} > + > static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr, > odp_packet_hdr_t *dst_hdr) > { > diff --git a/platform/linux-generic/odp_packet.c > b/platform/linux-generic/odp_packet.c > index c21f635..3019418 100644 > --- a/platform/linux-generic/odp_packet.c > +++ b/platform/linux-generic/odp_packet.c > @@ -48,11 +48,6 @@ static inline odp_packet_hdr_t *packet_hdr(odp_packet_t > pkt) > return (odp_packet_hdr_t *)(uintptr_t)pkt; > } > > -static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr) > -{ > - return (odp_packet_t)pkt_hdr; > -} > - > static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr) > { > return pkt_hdr->buf_hdr.handle.handle; > diff --git a/platform/linux-generic/pktio/ipc.c > b/platform/linux-generic/pktio/ipc.c > index 377f20e..06175e5 100644 > --- a/platform/linux-generic/pktio/ipc.c > +++ b/platform/linux-generic/pktio/ipc.c > @@ -409,7 +409,7 @@ static void _ipc_free_ring_packets(pktio_entry_t > *pktio_entry, _ring_t *r) > void *mbase = pktio_entry->s.ipc.pool_mdata_base; > > phdr = (void *)((uint8_t *)mbase + offsets[i]); > - pkt = (odp_packet_t)phdr->buf_hdr.handle.handle; > + pkt = packet_handle(phdr); > odp_packet_free(pkt); > } > } > -- > 2.8.1 >
