summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-06-06 18:41:00 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-25 14:31:04 -0700
commitf8ba3647f30ab22daeb5110453e2dad8a2c1d841 (patch)
tree90c9c50be4dd5a6fc1426af05cfdea1171bf6e62
parent4ef03d328769eddbfeca1f1c958fdb181a69c341 (diff)
downloadlinux-f8ba3647f30ab22daeb5110453e2dad8a2c1d841.tar.gz
linux-f8ba3647f30ab22daeb5110453e2dad8a2c1d841.tar.bz2
linux-f8ba3647f30ab22daeb5110453e2dad8a2c1d841.zip
earlycon: mark earlycon code as __used iif the caller is built-in
Keep earlycon related symbols only when CONFIG_SERIAL_EARLYCON is enabled and the driver is built-in. This will be helpful to clean up ifdefs surrounding earlycon code in serial drivers. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--include/linux/serial_core.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index a3d7c0d4a03e..2f44e2013654 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -352,9 +352,15 @@ struct earlycon_id {
extern const struct earlycon_id __earlycon_table[];
extern const struct earlycon_id __earlycon_table_end[];
+#if defined(CONFIG_SERIAL_EARLYCON) && !defined(MODULE)
+#define EARLYCON_USED_OR_UNUSED __used
+#else
+#define EARLYCON_USED_OR_UNUSED __maybe_unused
+#endif
+
#define OF_EARLYCON_DECLARE(_name, compat, fn) \
static const struct earlycon_id __UNIQUE_ID(__earlycon_##_name) \
- __used __section(__earlycon_table) \
+ EARLYCON_USED_OR_UNUSED __section(__earlycon_table) \
= { .name = __stringify(_name), \
.compatible = compat, \
.setup = fn }