Skip to content

Commit 7329322

Browse files
fancertsbogend
authored andcommitted
mips: cm: Convert __mips_cm_phys_base() to weak function
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>
1 parent 8bc8db2 commit 7329322

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

arch/mips/include/asm/mips-cm.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ extern void __iomem *mips_gcr_base;
2222
extern void __iomem *mips_cm_l2sync_base;
2323

2424
/**
25-
* __mips_cm_phys_base - retrieve the physical base address of the CM
25+
* mips_cm_phys_base - retrieve the physical base address of the CM
2626
*
2727
* This function returns the physical base address of the Coherence Manager
2828
* global control block, or 0 if no Coherence Manager is present. It provides
2929
* a default implementation which reads the CMGCRBase register where available,
3030
* and may be overridden by platforms which determine this address in a
31-
* different way by defining a function with the same prototype except for the
32-
* name mips_cm_phys_base (without underscores).
31+
* different way by defining a function with the same prototype.
3332
*/
34-
extern phys_addr_t __mips_cm_phys_base(void);
33+
extern phys_addr_t mips_cm_phys_base(void);
3534

3635
/**
3736
* mips_cm_l2sync_phys_base - retrieve the physical base address of the CM

arch/mips/kernel/mips-cm.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static char *cm3_causes[32] = {
179179
static DEFINE_PER_CPU_ALIGNED(spinlock_t, cm_core_lock);
180180
static DEFINE_PER_CPU_ALIGNED(unsigned long, cm_core_lock_flags);
181181

182-
phys_addr_t __mips_cm_phys_base(void)
182+
phys_addr_t __weak mips_cm_phys_base(void)
183183
{
184184
unsigned long cmgcr;
185185

@@ -198,9 +198,6 @@ phys_addr_t __mips_cm_phys_base(void)
198198
return (cmgcr & MIPS_CMGCRF_BASE) << (36 - 32);
199199
}
200200

201-
phys_addr_t mips_cm_phys_base(void)
202-
__attribute__((weak, alias("__mips_cm_phys_base")));
203-
204201
phys_addr_t __weak mips_cm_l2sync_phys_base(void)
205202
{
206203
u32 base_reg;

0 commit comments

Comments
 (0)