diff mbox series

of: rexport of_find_next_cache_node()

Message ID 20231011131431.2559029-1-arnd@kernel.org
State Changes Requested, archived
Headers show
Series of: rexport of_find_next_cache_node() | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 5 warnings, 7 lines checked
robh/patch-applied fail build log

Commit Message

Arnd Bergmann Oct. 11, 2023, 1:14 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

This function is now called from a cpufreq driver, but that breaks the
build when the caller is in a loadable module, because of a missing
export:

ERROR: modpost: "of_find_next_cache_node" [drivers/cpufreq/qcom-cpufreq-nvmem.ko] undefined!

Export this as a GPL-only symbol, like the other related functions in
this file.

Fixes: 7683a63c08ff5 ("cpufreq: qcom-nvmem: create L2 cache device")
Fixes: a3e31b4588443 ("of: Move definition of of_find_next_cache_node into common code.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/of/base.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Sudeep Holla Oct. 11, 2023, 1:59 p.m. UTC | #1
On Wed, Oct 11, 2023 at 03:14:08PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This function is now called from a cpufreq driver, but that breaks the
> build when the caller is in a loadable module, because of a missing
> export:
> 
> ERROR: modpost: "of_find_next_cache_node" [drivers/cpufreq/qcom-cpufreq-nvmem.ko] undefined!
> 
> Export this as a GPL-only symbol, like the other related functions in
> this file.
> 
> Fixes: 7683a63c08ff5 ("cpufreq: qcom-nvmem: create L2 cache device")
> Fixes: a3e31b4588443 ("of: Move definition of of_find_next_cache_node into common code.")

I am bit confused as I see commit a3e31b4588443 didn't drop the export.
So how is this change fixing that commit ?

--
Regards,
Sudeep
Arnd Bergmann Oct. 11, 2023, 2:05 p.m. UTC | #2
On Wed, Oct 11, 2023, at 15:59, Sudeep Holla wrote:
> On Wed, Oct 11, 2023 at 03:14:08PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> This function is now called from a cpufreq driver, but that breaks the
>> build when the caller is in a loadable module, because of a missing
>> export:
>> 
>> ERROR: modpost: "of_find_next_cache_node" [drivers/cpufreq/qcom-cpufreq-nvmem.ko] undefined!
>> 
>> Export this as a GPL-only symbol, like the other related functions in
>> this file.
>> 
>> Fixes: 7683a63c08ff5 ("cpufreq: qcom-nvmem: create L2 cache device")
>> Fixes: a3e31b4588443 ("of: Move definition of of_find_next_cache_node into common code.")
>
> I am bit confused as I see commit a3e31b4588443 didn't drop the export.
> So how is this change fixing that commit ?

My mistake, I was looking for the commit that initially introduced
the function, but didn't notice that this just moved it from powerpc.

I could have used "Fixes: e523f723d69cd ("powerpc: Add
of_find_next_cache_node()")", but it's probably best to just
leave that line out entirely.

    Arnd
Sudeep Holla Oct. 11, 2023, 2:38 p.m. UTC | #3
On Wed, Oct 11, 2023 at 04:05:47PM +0200, Arnd Bergmann wrote:
> On Wed, Oct 11, 2023, at 15:59, Sudeep Holla wrote:
> > On Wed, Oct 11, 2023 at 03:14:08PM +0200, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >> 
> >> This function is now called from a cpufreq driver, but that breaks the
> >> build when the caller is in a loadable module, because of a missing
> >> export:
> >> 
> >> ERROR: modpost: "of_find_next_cache_node" [drivers/cpufreq/qcom-cpufreq-nvmem.ko] undefined!
> >> 
> >> Export this as a GPL-only symbol, like the other related functions in
> >> this file.
> >> 
> >> Fixes: 7683a63c08ff5 ("cpufreq: qcom-nvmem: create L2 cache device")
> >> Fixes: a3e31b4588443 ("of: Move definition of of_find_next_cache_node into common code.")
> >
> > I am bit confused as I see commit a3e31b4588443 didn't drop the export.
> > So how is this change fixing that commit ?
>
> My mistake, I was looking for the commit that initially introduced
> the function, but didn't notice that this just moved it from powerpc.
>
> I could have used "Fixes: e523f723d69cd ("powerpc: Add
> of_find_next_cache_node()")", but it's probably best to just
> leave that line out entirely.
>

Yes I was thinking to drop it as it is quite old commit(both a3e31b4588443 and
e523f723d69cd) and I don't see any point in merging this to all the concerned
stable trees as they must not have this new user.

That said it is not a complex change, so I am fine either way, just thought
of raising it in case it was not intentional.

--
Regards,
Sudeep
Dmitry Baryshkov Oct. 11, 2023, 6:22 p.m. UTC | #4
On Wed, 11 Oct 2023 at 16:14, Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> This function is now called from a cpufreq driver, but that breaks the
> build when the caller is in a loadable module, because of a missing
> export:
>
> ERROR: modpost: "of_find_next_cache_node" [drivers/cpufreq/qcom-cpufreq-nvmem.ko] undefined!
>
> Export this as a GPL-only symbol, like the other related functions in
> this file.
>
> Fixes: 7683a63c08ff5 ("cpufreq: qcom-nvmem: create L2 cache device")
> Fixes: a3e31b4588443 ("of: Move definition of of_find_next_cache_node into common code.")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks for the patch. I've also sent a similar patch at [1]. Now we
are discussing with Rob if the overall idea of the L2 cache device is
correct or not.

[1] https://lore.kernel.org/linux-arm-msm/CAA8EJppCO-q=swYOH+O2fOdUDbNzd1yz9ZoTEBswV7RmvFJifA@mail.gmail.com/T/#t
diff mbox series

Patch

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 8d93cb6ea9cde..c4cf558e60d92 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1905,6 +1905,7 @@  struct device_node *of_find_next_cache_node(const struct device_node *np)
 
 	return NULL;
 }
+EXPORT_SYMBOL_GPL(of_find_next_cache_node);
 
 /**
  * of_find_last_cache_level - Find the level at which the last cache is