Skip to content

Commit 8bc8db2

Browse files
fancertsbogend
authored andcommitted
mips: cm: Convert __mips_cm_l2sync_phys_base() to weak function
The __mips_cm_l2sync_phys_base() and mips_cm_l2sync_phys_base() couple was introduced in commit 9f98f3d ("MIPS: Add generic CM probe & access code") where the former method was a weak implementation of the later function. Such design pattern permitted to re-define the original method and to use the weak implementation in the new function. A similar approach was introduced in the framework of another arch-specific programmable interface: mips_cm_phys_base() and __mips_cm_phys_base(). The only difference is that the underscored method of the later couple was declared in the "asm/mips-cm.h" header file, but it wasn't done for the CM L2-sync methods in the subject. Due to the missing global function declaration the "missing prototype" warning was spotted in the framework of the commit 9a20367 ("mips: mark local function static if possible") and fixed just be re-qualifying the weak method as static. Doing that broke what was originally implied by having the weak implementation globally defined. Let's fix the broken CM2 L2-sync arch-interface by dropping the static qualifier and, seeing the implemented pattern hasn't been used for over 10 years but will be required soon (see the link for the discussion around it), converting it to a single weakly defined method: mips_cm_l2sync_phys_base(). Fixes: 9a20367 ("mips: mark local function static if possible") 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 8507786 commit 8bc8db2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ extern void __iomem *mips_cm_l2sync_base;
3333
*/
3434
extern phys_addr_t __mips_cm_phys_base(void);
3535

36+
/**
37+
* mips_cm_l2sync_phys_base - retrieve the physical base address of the CM
38+
* L2-sync region
39+
*
40+
* This function returns the physical base address of the Coherence Manager
41+
* L2-cache only region. It provides a default implementation which reads the
42+
* CMGCRL2OnlySyncBase register where available or returns a 4K region just
43+
* behind the CM GCR base address. It may be overridden by platforms which
44+
* determine this address in a different way by defining a function with the
45+
* same prototype.
46+
*/
47+
extern phys_addr_t mips_cm_l2sync_phys_base(void);
48+
3649
/*
3750
* mips_cm_is64 - determine CM register width
3851
*

arch/mips/kernel/mips-cm.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ phys_addr_t __mips_cm_phys_base(void)
201201
phys_addr_t mips_cm_phys_base(void)
202202
__attribute__((weak, alias("__mips_cm_phys_base")));
203203

204-
static phys_addr_t __mips_cm_l2sync_phys_base(void)
204+
phys_addr_t __weak mips_cm_l2sync_phys_base(void)
205205
{
206206
u32 base_reg;
207207

@@ -217,9 +217,6 @@ static phys_addr_t __mips_cm_l2sync_phys_base(void)
217217
return mips_cm_phys_base() + MIPS_CM_GCR_SIZE;
218218
}
219219

220-
phys_addr_t mips_cm_l2sync_phys_base(void)
221-
__attribute__((weak, alias("__mips_cm_l2sync_phys_base")));
222-
223220
static void mips_cm_probe_l2sync(void)
224221
{
225222
unsigned major_rev;

0 commit comments

Comments
 (0)