On Mon, Feb 27, 2017 at 9:57 AM, Petri Savolainen < petri.savolai...@linaro.org> wrote:
> Use conversion function instead of casting. > > Signed-off-by: Petri Savolainen <petri.savolai...@linaro.org> > --- > platform/linux-generic/include/odp_packet_internal.h | 6 ++++++ > platform/linux-generic/odp_packet.c | 5 ----- > platform/linux-generic/pktio/ipc.c | 2 +- > 3 files changed, 7 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..7a394dd 100644 > --- a/platform/linux-generic/include/odp_packet_internal.h > +++ b/platform/linux-generic/include/odp_packet_internal.h > @@ -163,6 +163,12 @@ static inline odp_packet_hdr_t > *odp_packet_hdr(odp_packet_t pkt) > return (odp_packet_hdr_t *)(uintptr_t)pkt; > } > > +/* Only one using this outside of packet.c is ipc.c */ > I'd delete this comment but otherwise this series looks good. Who else is using this function is potentially anyone who includes packet_internal.h and that will change over time. > +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 > >