mips: cm: Convert __mips_cm_phys_base() to weak function
authorSerge Semin <fancer.lancer@gmail.com>
Mon, 26 Feb 2024 10:54:22 +0000 (13:54 +0300)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Mon, 11 Mar 2024 13:02:15 +0000 (14:02 +0100)
Based on the design pattern utilized in the CM GCR base address getter
implementation, the platform-specific code is capable to re-define the
getter and re-use the weakly defined initial version. But since the
pattern hasn't been used for over 10 years and another similar case (CM
L2-sync only base address getter) has just been fixed, let's unify the
interface and convert it to a more traditional single weakly defined
method: mips_cm_phys_base() (see the link below for the discussion around
this).

Link: https://lore.kernel.org/linux-mips/20240215171740.14550-3-fancer.lancer@gmail.com
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/include/asm/mips-cm.h
arch/mips/kernel/mips-cm.c

index 6d132b537f6d7ae33b6788298466beec44270bb9..c2930a75b7e44b956b3ef63731d71b25be57628c 100644 (file)
@@ -22,16 +22,15 @@ extern void __iomem *mips_gcr_base;
 extern void __iomem *mips_cm_l2sync_base;
 
 /**
- * __mips_cm_phys_base - retrieve the physical base address of the CM
+ * mips_cm_phys_base - retrieve the physical base address of the CM
  *
  * This function returns the physical base address of the Coherence Manager
  * global control block, or 0 if no Coherence Manager is present. It provides
  * a default implementation which reads the CMGCRBase register where available,
  * and may be overridden by platforms which determine this address in a
- * different way by defining a function with the same prototype except for the
- * name mips_cm_phys_base (without underscores).
+ * different way by defining a function with the same prototype.
  */
-extern phys_addr_t __mips_cm_phys_base(void);
+extern phys_addr_t mips_cm_phys_base(void);
 
 /**
  * mips_cm_l2sync_phys_base - retrieve the physical base address of the CM
index 268ac0b811e353b74692fb1f9084d68ed5d65c6c..3a115fab55739c8ff1de3c637da08621923a63d9 100644 (file)
@@ -179,7 +179,7 @@ static char *cm3_causes[32] = {
 static DEFINE_PER_CPU_ALIGNED(spinlock_t, cm_core_lock);
 static DEFINE_PER_CPU_ALIGNED(unsigned long, cm_core_lock_flags);
 
-phys_addr_t __mips_cm_phys_base(void)
+phys_addr_t __weak mips_cm_phys_base(void)
 {
        unsigned long cmgcr;
 
@@ -198,9 +198,6 @@ phys_addr_t __mips_cm_phys_base(void)
        return (cmgcr & MIPS_CMGCRF_BASE) << (36 - 32);
 }
 
-phys_addr_t mips_cm_phys_base(void)
-       __attribute__((weak, alias("__mips_cm_phys_base")));
-
 phys_addr_t __weak mips_cm_l2sync_phys_base(void)
 {
        u32 base_reg;