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

Sinan Akman sinan at writeme.com
Thu Dec 19 17:16:15 CET 2024


On 2024-12-19 07:55, J. Neuschäfer wrote:
> On Wed, Dec 18, 2024 at 02:18:48PM -0500, Sinan Akman wrote:
>> 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]
>
> Right, I should have mentioned it: The problem appears only due to the
> next patch.
>
>> If this is the only place you are seeing the problem, can we not protect
>> that the file is not included multiple times ?
>
> The problem here is the inclusion of initreg.h into multiple .c files,
> rather than multiple times into the same .c file. I don't think there's
> an easy guard pattern against that (the proprocessor won't help here).
>
> I think the benefit of being able to use these constants is big enough
> to justify this change.

we'll go with this for now, thanks.

Reviewed-by: Sinan Akman  <sinan at writeme.com>

>
>
> Thanks for your review,
>   -- jn
>
>
>
>>
>>>
>>> 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 =
> [...]



More information about the U-Boot mailing list