[PATCH 2/4] powerpc: mpc83xx: Allow including initreg.h into multiple files

Sinan Akman sinan at writeme.com
Wed Dec 18 20:18:48 CET 2024


Hi

On 2024-12-15 10:18, J. Neuschäfer via B4 Relay wrote:
> From: "J. Neuschäfer"<j.ne at posteo.net>
>
> Globals defined in headers can result in multiple-definition errors
> while linking, if they are visible beyond the current translation unit.

Is this happening anywhere ? It seems you introduced this in your other
patch :
[PATCH 3/4] powerpc: mpc83xx: Use defined constant for SPCR[TBEN]

If this is the only place you are seeing the problem, can we not protect
that the file
is not included multiple times ?

>
> Signed-off-by: J. Neuschäfer<j.ne at posteo.net>
> ---
>   arch/powerpc/cpu/mpc83xx/initreg/initreg.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/cpu/mpc83xx/initreg/initreg.h b/arch/powerpc/cpu/mpc83xx/initreg/initreg.h
> index 63aa5c946696ee0368bb3453b40ff0110f0fbcfd..ea1176e7fe10dbb549125ab6b2706fee05a92734 100644
> --- a/arch/powerpc/cpu/mpc83xx/initreg/initreg.h
> +++ b/arch/powerpc/cpu/mpc83xx/initreg/initreg.h
> @@ -13,7 +13,7 @@
>   #define SPCR_TSECBDP_MASK	0x00000C00
>   #define SPCR_TSECEP_MASK	0x00000300
>
> -	const __be32 spcr_mask =
> +	static const __be32 spcr_mask =
>   #if defined(CONFIG_SPCR_OPT) && !defined(CONFIG_SPCR_OPT_UNSET)
>   		SPCR_OPT_MASK |
>   #endif
> @@ -27,7 +27,7 @@
>   		SPCR_TSEC2EP_MASK |
>   #endif
>   		0;
> -	const __be32 spcr_val =
> +	static const __be32 spcr_val =
>   #if defined(CONFIG_SPCR_OPT) && !defined(CONFIG_SPCR_OPT_UNSET)
>   		CONFIG_SPCR_OPT |
>   #endif
> @@ -42,7 +42,7 @@
>   #endif
>   		0;
>
> -	const __be32 lcrr_mask =
> +	static const __be32 lcrr_mask =
>   #if defined(CONFIG_LCRR_DBYP) && !defined(CONFIG_LCRR_DBYP_UNSET)
>   		LCRR_DBYP |
>   #endif
> @@ -60,7 +60,7 @@
>   #endif
>   		0;
>
> -	const __be32 lcrr_val =
> +	static const __be32 lcrr_val =
>   #if defined(CONFIG_LCRR_DBYP) && !defined(CONFIG_LCRR_DBYP_UNSET)
>   		CONFIG_LCRR_DBYP |
>   #endif
>


More information about the U-Boot mailing list