diff mbox

of: drop symbols declared by _OF_DECLARE() from modules

Message ID 1452745987-22146-1-git-send-email-yamada.masahiro@socionext.com
State New
Headers show

Commit Message

Masahiro Yamada Jan. 14, 2016, 4:33 a.m. UTC
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(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Arnd Bergmann Jan. 14, 2016, 10:14 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann Jan. 14, 2016, 10:23 a.m. UTC | #2
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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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)			\