diff mbox series

[v2,1/2] linux-gen: ipc: use hdr to handle conversion function

Message ID 1488360469-25958-1-git-send-email-petri.savolainen@linaro.org
State Accepted
Commit a09bc35bf1159478195484e11eccb52cb33ae554
Headers show
Series [v2,1/2] linux-gen: ipc: use hdr to handle conversion function | expand

Commit Message

Petri Savolainen March 1, 2017, 9:27 a.m. UTC
Use conversion function instead of casting.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
 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(-)

-- 
2.8.1

Comments

Balasubramanian Manoharan March 1, 2017, 11:29 a.m. UTC | #1
For the series: Reviewed-by: Balasubramanian Manoharan
<bala.manoharan@linaro.org>

On 1 March 2017 at 14:57, Petri Savolainen <petri.savolainen@linaro.org> wrote:
> Use conversion function instead of casting.

>

> Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

> ---

>  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

>
diff mbox series

Patch

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);
 		}
 	}