bus/dpaa: fix build

Message ID 20180620140930.31002-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series bus/dpaa: fix build |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Thomas Monjalon June 20, 2018, 2:09 p.m. UTC
  The DPAA bus driver is defining some macros without prefix.
So it can conflict with other libraries like libbsd:

	drivers/bus/dpaa/include/compat.h:53:
		error: "__packed" redefined
	/usr/include/bsd/sys/cdefs.h:120:
		note: this is the location of the previous definition

Fixes: 39f373cf015a ("bus/dpaa: add compatibility and helper macros")
Cc: stable@dpdk.org
Cc: geoff.thorpe@nxp.com
Cc: hemant.agrawal@nxp.com
Cc: shreyansh.jain@nxp.com

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/bus/dpaa/include/compat.h | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Shreyansh Jain June 21, 2018, 7:58 a.m. UTC | #1
On Wednesday 20 June 2018 07:39 PM, Thomas Monjalon wrote:
> The DPAA bus driver is defining some macros without prefix.
> So it can conflict with other libraries like libbsd:
> 
> 	drivers/bus/dpaa/include/compat.h:53:
> 		error: "__packed" redefined
> 	/usr/include/bsd/sys/cdefs.h:120:
> 		note: this is the location of the previous definition
> 
> Fixes: 39f373cf015a ("bus/dpaa: add compatibility and helper macros")
> Cc: stable@dpdk.org
> Cc: geoff.thorpe@nxp.com
> Cc: hemant.agrawal@nxp.com
> Cc: shreyansh.jain@nxp.com
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>   drivers/bus/dpaa/include/compat.h | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h
> index e4b570214..92241d231 100644
> --- a/drivers/bus/dpaa/include/compat.h
> +++ b/drivers/bus/dpaa/include/compat.h
> @@ -48,9 +48,15 @@
>    */
>   
>   /* Required compiler attributes */
> +#ifndef __maybe_unused
>   #define __maybe_unused	__rte_unused
> +#endif
> +#ifndef __always_unused
>   #define __always_unused	__rte_unused
> +#endif
> +#ifndef __packed
>   #define __packed	__rte_packed
> +#endif
>   #define noinline	__attribute__((noinline))
>   
>   #define L1_CACHE_BYTES 64
> 

A similar patch was also issued by Jerin a few weeks back:
http://patches.dpdk.org/patch/40597/

There may be conflict while merging.

Whether you take that, or this (preferred):

Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
  
Thomas Monjalon June 21, 2018, 8:28 a.m. UTC | #2
21/06/2018 09:58, Shreyansh Jain:
> On Wednesday 20 June 2018 07:39 PM, Thomas Monjalon wrote:
> > The DPAA bus driver is defining some macros without prefix.
> > So it can conflict with other libraries like libbsd:
> > 
> > 	drivers/bus/dpaa/include/compat.h:53:
> > 		error: "__packed" redefined
> > 	/usr/include/bsd/sys/cdefs.h:120:
> > 		note: this is the location of the previous definition
> > 
> > Fixes: 39f373cf015a ("bus/dpaa: add compatibility and helper macros")
> > Cc: stable@dpdk.org
> > Cc: geoff.thorpe@nxp.com
> > Cc: hemant.agrawal@nxp.com
> > Cc: shreyansh.jain@nxp.com
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> >   drivers/bus/dpaa/include/compat.h | 6 ++++++
> >   1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h
> > index e4b570214..92241d231 100644
> > --- a/drivers/bus/dpaa/include/compat.h
> > +++ b/drivers/bus/dpaa/include/compat.h
> > @@ -48,9 +48,15 @@
> >    */
> >   
> >   /* Required compiler attributes */
> > +#ifndef __maybe_unused
> >   #define __maybe_unused	__rte_unused
> > +#endif
> > +#ifndef __always_unused
> >   #define __always_unused	__rte_unused
> > +#endif
> > +#ifndef __packed
> >   #define __packed	__rte_packed
> > +#endif
> >   #define noinline	__attribute__((noinline))
> >   
> >   #define L1_CACHE_BYTES 64
> > 
> 
> A similar patch was also issued by Jerin a few weeks back:
> http://patches.dpdk.org/patch/40597/

I missed it.

> There may be conflict while merging.
> 
> Whether you take that, or this (preferred):
> 
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>

This one is more complete.
Applied
  

Patch

diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h
index e4b570214..92241d231 100644
--- a/drivers/bus/dpaa/include/compat.h
+++ b/drivers/bus/dpaa/include/compat.h
@@ -48,9 +48,15 @@ 
  */
 
 /* Required compiler attributes */
+#ifndef __maybe_unused
 #define __maybe_unused	__rte_unused
+#endif
+#ifndef __always_unused
 #define __always_unused	__rte_unused
+#endif
+#ifndef __packed
 #define __packed	__rte_packed
+#endif
 #define noinline	__attribute__((noinline))
 
 #define L1_CACHE_BYTES 64