Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1308988 > unrolled thread
| Started by | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| First post | 2016-01-14 05:40 +0100 |
| Last post | 2016-01-14 11:30 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] of: drop symbols declared by _OF_DECLARE() from modules Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-01-14 05:40 +0100
Re: [PATCH] of: drop symbols declared by _OF_DECLARE() from modules Arnd Bergmann <arnd@arndb.de> - 2016-01-14 11:20 +0100
Re: [PATCH] of: drop symbols declared by _OF_DECLARE() from modules Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-01-14 11:30 +0100
Re: [PATCH] of: drop symbols declared by _OF_DECLARE() from modules Arnd Bergmann <arnd@arndb.de> - 2016-01-14 11:30 +0100
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2016-01-14 05:40 +0100 |
| Subject | [PATCH] of: drop symbols declared by _OF_DECLARE() from modules |
| Message-ID | <qQHRv-1IE-1@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-01-14 11:20 +0100 |
| Message-ID | <qQNax-5z6-13@gated-at.bofh.it> |
| In reply to | #1308988 |
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
[toc] | [prev] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2016-01-14 11:30 +0100 |
| Message-ID | <qQNkd-5Dw-1@gated-at.bofh.it> |
| In reply to | #1309151 |
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
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-01-14 11:30 +0100 |
| Message-ID | <qQNke-5Dw-25@gated-at.bofh.it> |
| In reply to | #1309154 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web