[01/10] bus/fslmc: fix global variable multiple definitions

Message ID 20190905145315.19395-2-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series fix global variable multiple definitions |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-dpdk_compile success Compile Testing PASS
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/iol-dpdk_compile_spdk success Compile Testing PASS
ci/intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance success Performance Testing PASS

Commit Message

Ferruh Yigit Sept. 5, 2019, 2:53 p.m. UTC
  'qman_version' global variable is defined in a header file which was
causing multiple definitions of the variable, fixed it by moving it to
the .c file.

Issue has been detected by '-fno-common' gcc flag.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 2 ++
 drivers/bus/fslmc/qbman/qbman_portal.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
  

Comments

Sachin Saxena Sept. 10, 2019, 4:36 p.m. UTC | #1
Acked-by: Sachin Saxena <sachin.saxena@nxp.com>

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Thursday, September 5, 2019 8:23 PM
> To: Hemant Agrawal <hemant.agrawal@nxp.com>; Sachin Saxena
> <sachin.saxena@nxp.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH 01/10] bus/fslmc: fix global variable multiple definitions
> 
> 'qman_version' global variable is defined in a header file which was causing
> multiple definitions of the variable, fixed it by moving it to the .c file.
> 
> Issue has been detected by '-fno-common' gcc flag.
> 
> Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with
> QBMAN 5.0")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
>  drivers/bus/fslmc/qbman/qbman_portal.c | 2 ++
> drivers/bus/fslmc/qbman/qbman_portal.h | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c
> b/drivers/bus/fslmc/qbman/qbman_portal.c
> index e6066ce35..12a718117 100644
> --- a/drivers/bus/fslmc/qbman/qbman_portal.c
> +++ b/drivers/bus/fslmc/qbman/qbman_portal.c
> @@ -61,6 +61,8 @@ enum qbman_sdqcr_fc {
>  #define MAX_QBMAN_PORTALS  64
>  static struct qbman_swp *portal_idx_map[MAX_QBMAN_PORTALS];
> 
> +uint32_t qman_version;
> +
>  /* Internal Function declaration */
>  static int
>  qbman_swp_enqueue_array_mode_direct(struct qbman_swp *s, diff --git
> a/drivers/bus/fslmc/qbman/qbman_portal.h
> b/drivers/bus/fslmc/qbman/qbman_portal.h
> index e54f2661c..0e9de8a1b 100644
> --- a/drivers/bus/fslmc/qbman/qbman_portal.h
> +++ b/drivers/bus/fslmc/qbman/qbman_portal.h
> @@ -11,7 +11,7 @@
>  #include "qbman_sys.h"
>  #include <fsl_qbman_portal.h>
> 
> -uint32_t qman_version;
> +extern uint32_t qman_version;
>  #define QMAN_REV_4000   0x04000000
>  #define QMAN_REV_4100   0x04010000
>  #define QMAN_REV_4101   0x04010001
> --
> 2.21.0
  

Patch

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index e6066ce35..12a718117 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -61,6 +61,8 @@  enum qbman_sdqcr_fc {
 #define MAX_QBMAN_PORTALS  64
 static struct qbman_swp *portal_idx_map[MAX_QBMAN_PORTALS];
 
+uint32_t qman_version;
+
 /* Internal Function declaration */
 static int
 qbman_swp_enqueue_array_mode_direct(struct qbman_swp *s,
diff --git a/drivers/bus/fslmc/qbman/qbman_portal.h b/drivers/bus/fslmc/qbman/qbman_portal.h
index e54f2661c..0e9de8a1b 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.h
+++ b/drivers/bus/fslmc/qbman/qbman_portal.h
@@ -11,7 +11,7 @@ 
 #include "qbman_sys.h"
 #include <fsl_qbman_portal.h>
 
-uint32_t qman_version;
+extern uint32_t qman_version;
 #define QMAN_REV_4000   0x04000000
 #define QMAN_REV_4100   0x04010000
 #define QMAN_REV_4101   0x04010001