* [PATCH] of: drop symbols declared by _OF_DECLARE() from modules
@ 2016-01-14 4:33 Masahiro Yamada
2016-01-14 10:14 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2016-01-14 4:33 UTC (permalink / raw)
To: devicetree
Cc: Peter Hurley, Arnd Bergmann, linux-arm-kernel, Rob Herring,
Masahiro Yamada, Frank Rowand, Rob Herring, linux-kernel,
Grant Likely
The users of this macro (OF_EARLYCON_DECLARE, CLK_OF_DECLARE,
IRQCHIP_DECLARE, etc.) are only parsed in the early boot stage.
Such symbols contained in modules are never used.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
OF_EARLYCON_DECLARE() is declared in several tristate drivers.
This patch makes each low-level driver be free from
taking care of it.
See this patch
https://patchwork.kernel.org/patch/8028771/
include/linux/of.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/of.h b/include/linux/of.h
index dd10626..dc6e396 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -929,7 +929,7 @@ static inline int of_get_available_child_count(const struct device_node *np)
return num;
}
-#ifdef CONFIG_OF
+#if defined(CONFIG_OF) && !defined(MODULE)
#define _OF_DECLARE(table, name, compat, fn, fn_type) \
static const struct of_device_id __of_table_##name \
__used __section(__##table##_of_table) \
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] of: drop symbols declared by _OF_DECLARE() from modules
2016-01-14 4:33 [PATCH] of: drop symbols declared by _OF_DECLARE() from modules Masahiro Yamada
@ 2016-01-14 10:14 ` Arnd Bergmann
2016-01-14 10:21 ` Masahiro Yamada
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2016-01-14 10:14 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Masahiro Yamada, devicetree, Peter Hurley, linux-kernel,
Rob Herring, Grant Likely, Frank Rowand
On Thursday 14 January 2016 13:33:06 Masahiro Yamada wrote:
>
> -#ifdef CONFIG_OF
> +#if defined(CONFIG_OF) && !defined(MODULE)
> #define _OF_DECLARE(table, name, compat, fn, fn_type) \
> static const struct of_device_id __of_table_##name \
> __used __section(__##table##_of_table) \
> --
>
Doesn't this lead to "unused function" warnings? Maybe we can change the "__used"
into "__unused" when MODULE is set, so the compiler will automatically
drop all code that is only referenced from the entry.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] of: drop symbols declared by _OF_DECLARE() from modules
2016-01-14 10:14 ` Arnd Bergmann
@ 2016-01-14 10:21 ` Masahiro Yamada
2016-01-14 10:23 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2016-01-14 10:21 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-arm-kernel, devicetree, Peter Hurley,
Linux Kernel Mailing List, Rob Herring, Grant Likely,
Frank Rowand
Hi Arnd,
2016-01-14 19:14 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> On Thursday 14 January 2016 13:33:06 Masahiro Yamada wrote:
>>
>> -#ifdef CONFIG_OF
>> +#if defined(CONFIG_OF) && !defined(MODULE)
>> #define _OF_DECLARE(table, name, compat, fn, fn_type) \
>> static const struct of_device_id __of_table_##name \
>> __used __section(__##table##_of_table) \
>> --
>>
>
> Doesn't this lead to "unused function" warnings? Maybe we can change the "__used"
> into "__unused" when MODULE is set,
Yes, this is my intention.
I think this patch does so,
unless I am missing something...
#if defined(CONFIG_OF) && !defined(MODULE)
__used
#else
__unused
#endif
> so the compiler will automatically
> drop all code that is only referenced from the entry.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] of: drop symbols declared by _OF_DECLARE() from modules
2016-01-14 10:21 ` Masahiro Yamada
@ 2016-01-14 10:23 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-01-14 10:23 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-arm-kernel, devicetree, Peter Hurley,
Linux Kernel Mailing List, Rob Herring, Grant Likely,
Frank Rowand
On Thursday 14 January 2016 19:21:21 Masahiro Yamada wrote:
> Yes, this is my intention.
>
> I think this patch does so,
> unless I am missing something...
>
>
> #if defined(CONFIG_OF) && !defined(MODULE)
> __used
> #else
> __unused
> #endif
>
>
Ah, got it. You are right, I just missed that because the #else
part was not in the context that I saw in the patch and I was too lazy
to actually look at the file.
Acked-by: Arnd Bergmann <arnd@arndb.de>
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-14 10:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-14 4:33 [PATCH] of: drop symbols declared by _OF_DECLARE() from modules Masahiro Yamada
2016-01-14 10:14 ` Arnd Bergmann
2016-01-14 10:21 ` Masahiro Yamada
2016-01-14 10:23 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).