[PATCH v2 3/4] riscv: alternatives: Drop the underscores from the assembly macro names

Andrew Jones ajones at ventanamicro.com
Wed Nov 30 03:27:44 PST 2022


On Wed, Nov 30, 2022 at 11:06:27AM +0100, Heiko Stübner wrote:
> Am Dienstag, 29. November 2022, 16:00:52 CET schrieb Andrew Jones:
> > The underscores aren't needed because there isn't anything already
> > named without them and the _CFG extension. This is a bit of a cleanup
> > by itself, but the real motivation is for a coming patch which would
> > otherwise need to add two more underscores to these macro names,
> > i.e. ____ALTERNATIVE_CFG, and that'd be gross.
> > 
> > Signed-off-by: Andrew Jones <ajones at ventanamicro.com>
> 
> Hmm, I would assume the "_" are there to mark those as
> "internal / don't use". So with removing the underscores
> you loose that marking.

Yeah, that's usually the case, but here we also have ALT_ENTRY and
ALT_NEW_CONTENT macros which are also internal, but don't have
leading-underscore names.

> 
> It works though, so
> Tested-by: Heiko Stuebner <heiko.stuebner at vrull.eu>

Thanks,
drew

> 
> But I'll leave the judgement on its viability to others.
> 
> Heiko
> 
> > ---
> >  arch/riscv/include/asm/alternative-macros.h | 20 ++++++++++----------
> >  1 file changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/arch/riscv/include/asm/alternative-macros.h b/arch/riscv/include/asm/alternative-macros.h
> > index 7cc2b587c5c4..9ea95331a280 100644
> > --- a/arch/riscv/include/asm/alternative-macros.h
> > +++ b/arch/riscv/include/asm/alternative-macros.h
> > @@ -33,7 +33,7 @@
> >  	.endif
> >  .endm
> >  
> > -.macro __ALTERNATIVE_CFG old_c, new_c, vendor_id, errata_id, enable
> > +.macro ALTERNATIVE_CFG old_c, new_c, vendor_id, errata_id, enable
> >  886 :
> >  	.option push
> >  	.option norvc
> > @@ -45,11 +45,11 @@
> >  .endm
> >  
> >  #define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \
> > -	__ALTERNATIVE_CFG old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k)
> > +	ALTERNATIVE_CFG old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k)
> >  
> > -.macro __ALTERNATIVE_CFG_2 old_c, new_c_1, vendor_id_1, errata_id_1, enable_1, \
> > -				  new_c_2, vendor_id_2, errata_id_2, enable_2
> > -	__ALTERNATIVE_CFG \old_c, \new_c_1, \vendor_id_1, \errata_id_1, \enable_1
> > +.macro ALTERNATIVE_CFG_2 old_c, new_c_1, vendor_id_1, errata_id_1, enable_1,	\
> > +				new_c_2, vendor_id_2, errata_id_2, enable_2
> > +	ALTERNATIVE_CFG \old_c, \new_c_1, \vendor_id_1, \errata_id_1, \enable_1
> >  	ALT_NEW_CONTENT \vendor_id_2, \errata_id_2, \enable_2, \new_c_2
> >  .endm
> >  
> > @@ -57,9 +57,9 @@
> >  					CONFIG_k_1,			\
> >  				  new_c_2, vendor_id_2, errata_id_2,	\
> >  					CONFIG_k_2)			\
> > -	__ALTERNATIVE_CFG_2 old_c, new_c_1, vendor_id_1, errata_id_1,	\
> > +	ALTERNATIVE_CFG_2 old_c, new_c_1, vendor_id_1, errata_id_1,	\
> >  					IS_ENABLED(CONFIG_k_1),		\
> > -				   new_c_2, vendor_id_2, errata_id_2,	\
> > +				 new_c_2, vendor_id_2, errata_id_2,	\
> >  					IS_ENABLED(CONFIG_k_2)
> >  
> >  #else /* !__ASSEMBLY__ */
> > @@ -126,15 +126,15 @@
> >  #else /* CONFIG_RISCV_ALTERNATIVE */
> >  #ifdef __ASSEMBLY__
> >  
> > -.macro __ALTERNATIVE_CFG old_c
> > +.macro ALTERNATIVE_CFG old_c
> >  	\old_c
> >  .endm
> >  
> >  #define _ALTERNATIVE_CFG(old_c, ...)	\
> > -	__ALTERNATIVE_CFG old_c
> > +	ALTERNATIVE_CFG old_c
> >  
> >  #define _ALTERNATIVE_CFG_2(old_c, ...)	\
> > -	__ALTERNATIVE_CFG old_c
> > +	ALTERNATIVE_CFG old_c
> >  
> >  #else /* !__ASSEMBLY__ */
> >  
> > 
> 
> 
> 
> 



More information about the linux-riscv mailing list