x86/amd_nb: unexport amd_cache_northbridges()
Subsystems (4)
PATCH 1/1 x86/amd_nb: unexport amd_cache_northbridges()
From: Muralidhara M K <[email protected]>
amd_cache_northbridges() is called from init_amd_nbs(), during fs_initcall() and need not be called explicitly. Kernel components can directly call amd_nb_num() to get the initialized number of north bridges.
unexport amd_cache_northbridges(), update dependent modules to call amd_nb_num() instead. While at it, simplify the while checks in amd_cache_northbridges().
--- arch/x86/include/asm/amd_nb.h | 1 - arch/x86/kernel/amd_nb.c | 7 +++---- drivers/char/agp/amd64-agp.c | 2 +- drivers/edac/amd64_edac.c | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-)
arch/x86/include/asm/amd_nb.h +0 -1
@@ -16,7 +16,6 @@ extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[];extern bool early_is_amd_nb (u32 value);extern struct resource *amd_get_mmconfig_range (struct resource *res); -extern int amd_cache_northbridges (void );extern void amd_flush_garts (void );extern int amd_numa_init (void );extern int amd_get_subcaches (int );
arch/x86/kernel/amd_nb.c +3 -4
@@ -188,7 +188,7 @@ int amd_smn_write(u16 node, u32 address, u32 value)EXPORT_SYMBOL_GPL (amd_smn_write); -int amd_cache_northbridges (void ) +static int amd_cache_northbridges (void ) {const struct pci_device_id *misc_ids = amd_nb_misc_ids;const struct pci_device_id *link_ids = amd_nb_link_ids;
@@ -210,14 +210,14 @@ int amd_cache_northbridges(void) } misc =NULL ; -while ((misc =next_northbridge (misc, misc_ids)) !=NULL ) +while ((misc =next_northbridge (misc, misc_ids))) misc_count++;if (!misc_count)return -ENODEV ; root =NULL ; -while ((root =next_northbridge (root, root_ids)) !=NULL ) +while ((root =next_northbridge (root, root_ids))) root_count++;if (root_count) {
@@ -290,7 +290,6 @@ int amd_cache_northbridges(void)return 0 ; } -EXPORT_SYMBOL_GPL (amd_cache_northbridges);/* * Ignores subdevice/subvendor but as far as I can figure out
drivers/char/agp/amd64-agp.c +1 -1
@@ -327,7 +327,7 @@ static int cache_nbs(struct pci_dev *pdev, u32 cap_ptr) {int i; -if (amd_cache_northbridges () <0 ) +if (!amd_nb_num ())return -ENODEV ;if (!amd_nb_has_feature (AMD_NB_GART ))
drivers/edac/amd64_edac.c +1 -1
@@ -4269,7 +4269,7 @@ static int __init amd64_edac_init(void)if (!x86_match_cpu (amd64_cpuids))return -ENODEV ; -if (amd_cache_northbridges () <0 ) +if (!amd_nb_num ())return -ENODEV ;opstate_init ();
Signature · 1 line
2.25.1
Borislav Petkov
maintainerQuoted 10 lines · Naveen Krishna Chatradhi
From: Muralidhara M K <[email protected]>
amd_cache_northbridges()is called frominit_amd_nbs(), duringfs_initcall()and need not be called explicitly. Kernel components can directly callamd_nb_num()to get the initialized number of north bridges.unexport
amd_cache_northbridges(), update dependent modules to callamd_nb_num()instead. While at it, simplify the while checks inamd_cache_northbridges().
What I am missing in this commit message is why is it ok to do that?
AFAIR, previously, amd_cache_northbridges() wasn't an initcall so the module or builtin - which came first - was forcing the NB caching through the explicit call to amd_cache_northbridges().
fs_inicall() does that now unconditionally so the question is, why can the module init functions assume that the northbridges have been cached already and can simply get the NB number?
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette:wqHi Boris,
Quoted 13 lines · Borislav Petkov
[CAUTION: External Email]
Quoted 10 lines · Naveen Krishna Chatradhi
From: Muralidhara M K <[email protected]>
amd_cache_northbridges()is called frominit_amd_nbs(), duringfs_initcall()and need not be called explicitly. Kernel components can directly callamd_nb_num()to get the initialized number of north bridges.unexport
amd_cache_northbridges(), update dependent modules to callamd_nb_num()instead. While at it, simplify the while checks inamd_cache_northbridges().
Apologies for the late reply.
Quoted 9 lines
What I am missing in this commit message is why is it ok to do that?
AFAIR, previously,
amd_cache_northbridges()wasn't an initcall so the module or builtin - which came first - was forcing the NB caching through the explicit call toamd_cache_northbridges().
fs_inicall()does that now unconditionally so the question is, why can the module init functions assume that the northbridges have been cached already and can simply get the NB number?
Modules that are using this API comes after the fs_initcall() is called.
This patch is prepared based on a previous discussion
https://lore.kernel.org/lkml/[email protected]/
quoting from the thread
Quoted 4 lines
I'm going to venture a pretty sure guess that the initcall runs first and that
amd_cache_northbridges()call inamd64_edac_init()is probablynot even needed anymore...
and i've confirmed the call flow.
Regards,
Naveenk
Borislav Petkov
maintainerQuoted 1 line · Naveen Krishna
Modules that are using this API comes after the
fs_initcall()is called.
I don't need you to explain this to me - I need you to:
"What I am missing in this commit message is why is it ok to do that?"
I.e., pls explain in the commit message exactly why it is ok to do that so that people who read it, will know.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 10 lines · Borislav Petkov
[CAUTION: External Email]
Quoted 1 line · Naveen Krishna
Modules that are using this API comes after the
fs_initcall()is called.I don't need you to explain this to me - I need you to:
"What I am missing in this commit message is why is it ok to do that?"
I.e., pls explain in the commit message exactly why it is ok to do that so that people who read it, will know.
Got it, thanks. I will update the commit message.