[PATCH 1/4] common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

Wolfgang Denk wd at denx.de
Mon Sep 12 11:22:53 CEST 2022


Dear Ovidiu,

In message <20220911161052.2986264-1-ovpanait at gmail.com> you wrote:
> The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
> commented out, so there are no users for this macro:
>   #if 1
>     #define DECLARE_GLOBAL_DATA_PTR   register volatile gd_t *gd asm ("r2")
>   #else
>     #define XTRN_DECLARE_GLOBAL_DATA_PTR   extern
>     #define DECLARE_GLOBAL_DATA_PTR     XTRN_DECLARE_GLOBAL_DATA_PTR \
>                                         gd_t *gd
>   #endif
>
> Remove all references.

Actually the commented out code contained some information, and I
feel it would be a pity if that got lost:

> -#if 1
>  #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
> -#else /* We could use plain global data, but the resulting code is bigger */
> -#define XTRN_DECLARE_GLOBAL_DATA_PTR	extern
> -#define DECLARE_GLOBAL_DATA_PTR     XTRN_DECLARE_GLOBAL_DATA_PTR \
> -				    gd_t *gd
> -#endif

Maybe we can keep the information that using global data for the GD
pointer would be possible too (and simpler, as it does not require
the reservation of a specific register for it), but that the
implementation uses a register nevertheless because this results in
smaller code?

Maybe add such a comment instead ?

Thanks!

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich,  Office: Kirchenstr. 5, 82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All repairs tend to destroy the structure, to  increase  the  entropy
and  disorder  of the system. Less and less effort is spent on fixing
original design flaws; more and more is spent on fixing flaws  intro-
duced by earlier fixes.       - Fred Brooks, "The Mythical Man Month"


More information about the U-Boot mailing list