linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups
@ 2016-06-06  9:40 Masahiro Yamada
  2016-06-06  9:41 ` [PATCH 1/4] earlycon: mark earlycon code as __used iif the caller is built-in Masahiro Yamada
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Masahiro Yamada @ 2016-06-06  9:40 UTC (permalink / raw)
  To: linux-serial
  Cc: Arnd Bergmann, Peter Hurley, Rob Herring, Paul Burton,
	Greg Kroah-Hartman, Matthias Brugger, Masahiro Yamada,
	Matt Redfearn, Mathieu OTHACEHE, Jiri Slaby, Paul Gortmaker,
	linux-kernel, Anton Wuerfel, Andy Shevchenko, Martin Sperl,
	linux-mediatek, Ricardo Ribalda Delgado, Heikki Krogerus,
	Mans Rullgard, linux-arm-kernel, Scott Wood


1/4: keep earlycon symbols only when CONFIG_SERIAL_EARLYCON is defined
     and the driver is built-in.

2/4 thru 4/4: driver clean-ups.
              (partially reverts build fixes by Arnd Bergmann)



Masahiro Yamada (4):
  earlycon: mark earlycon code as __used iif the caller is built-in
  serial: 8250_uniphier: drop !defined(MODULE) conditional
  serial: 8250_mtk: drop !defined(MODULE) conditional
  serial: 8250_ingenic: drop #if conditional surrounding earlycon code

 drivers/tty/serial/8250/8250_ingenic.c  | 2 --
 drivers/tty/serial/8250/8250_mtk.c      | 2 +-
 drivers/tty/serial/8250/8250_uniphier.c | 2 +-
 drivers/tty/serial/8250/Kconfig         | 2 +-
 include/linux/serial_core.h             | 8 +++++++-
 5 files changed, 10 insertions(+), 6 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] earlycon: mark earlycon code as __used iif the caller is built-in
  2016-06-06  9:40 [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups Masahiro Yamada
@ 2016-06-06  9:41 ` Masahiro Yamada
  2016-06-06  9:41 ` [PATCH 2/4] serial: 8250_uniphier: drop !defined(MODULE) conditional Masahiro Yamada
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2016-06-06  9:41 UTC (permalink / raw)
  To: linux-serial
  Cc: Arnd Bergmann, Peter Hurley, Rob Herring, Paul Burton,
	Greg Kroah-Hartman, Matthias Brugger, Masahiro Yamada,
	linux-kernel, Jiri Slaby

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

 include/linux/serial_core.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index a3d7c0d..2f44e20 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  }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] serial: 8250_uniphier: drop !defined(MODULE) conditional
  2016-06-06  9:40 [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups Masahiro Yamada
  2016-06-06  9:41 ` [PATCH 1/4] earlycon: mark earlycon code as __used iif the caller is built-in Masahiro Yamada
@ 2016-06-06  9:41 ` Masahiro Yamada
  2016-06-06  9:41 ` [PATCH 3/4] serial: 8250_mtk: " Masahiro Yamada
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2016-06-06  9:41 UTC (permalink / raw)
  To: linux-serial
  Cc: Arnd Bergmann, Peter Hurley, Rob Herring, Paul Burton,
	Greg Kroah-Hartman, Matthias Brugger, Masahiro Yamada,
	Jiri Slaby, linux-kernel, linux-arm-kernel

The !defined(MODULE) conditional has been added to the
OF_EARLYCON_DECLARE() define.

Now we can revert commit a2d3ea2f2399 ("serial: 8250/uniphier:
fix modular build").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/tty/serial/8250/8250_uniphier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c
index efd1f9c..b8d9c8c 100644
--- a/drivers/tty/serial/8250/8250_uniphier.c
+++ b/drivers/tty/serial/8250/8250_uniphier.c
@@ -35,7 +35,7 @@ struct uniphier8250_priv {
 	spinlock_t atomic_write_lock;
 };
 
-#if defined(CONFIG_SERIAL_8250_CONSOLE) && !defined(MODULE)
+#ifdef CONFIG_SERIAL_8250_CONSOLE
 static int __init uniphier_early_console_setup(struct earlycon_device *device,
 					       const char *options)
 {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] serial: 8250_mtk: drop !defined(MODULE) conditional
  2016-06-06  9:40 [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups Masahiro Yamada
  2016-06-06  9:41 ` [PATCH 1/4] earlycon: mark earlycon code as __used iif the caller is built-in Masahiro Yamada
  2016-06-06  9:41 ` [PATCH 2/4] serial: 8250_uniphier: drop !defined(MODULE) conditional Masahiro Yamada
@ 2016-06-06  9:41 ` Masahiro Yamada
  2016-06-06 10:27   ` Matthias Brugger
  2016-06-06  9:41 ` [PATCH 4/4] serial: 8250_ingenic: drop #if conditional surrounding earlycon code Masahiro Yamada
  2016-06-06 10:25 ` [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups Arnd Bergmann
  4 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2016-06-06  9:41 UTC (permalink / raw)
  To: linux-serial
  Cc: Arnd Bergmann, Peter Hurley, Rob Herring, Paul Burton,
	Greg Kroah-Hartman, Matthias Brugger, Masahiro Yamada,
	Jiri Slaby, Paul Gortmaker, linux-kernel, Andy Shevchenko,
	linux-mediatek, linux-arm-kernel

The !defined(MODULE) conditional has been added to the
OF_EARLYCON_DECLARE() define.

This commit partially reverts commit 3f5921a60f74 ("serial:
8250/mediatek: fix building with SERIAL_8250=m").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/tty/serial/8250/8250_mtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index 3489fbc..3611ec9 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -301,7 +301,7 @@ static struct platform_driver mtk8250_platform_driver = {
 };
 module_platform_driver(mtk8250_platform_driver);
 
-#if defined(CONFIG_SERIAL_8250_CONSOLE) && !defined(MODULE)
+#ifdef CONFIG_SERIAL_8250_CONSOLE
 static int __init early_mtk8250_setup(struct earlycon_device *device,
 					const char *options)
 {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] serial: 8250_ingenic: drop #if conditional surrounding earlycon code
  2016-06-06  9:40 [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups Masahiro Yamada
                   ` (2 preceding siblings ...)
  2016-06-06  9:41 ` [PATCH 3/4] serial: 8250_mtk: " Masahiro Yamada
@ 2016-06-06  9:41 ` Masahiro Yamada
  2016-06-06 10:25 ` [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups Arnd Bergmann
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2016-06-06  9:41 UTC (permalink / raw)
  To: linux-serial
  Cc: Arnd Bergmann, Peter Hurley, Rob Herring, Paul Burton,
	Greg Kroah-Hartman, Matthias Brugger, Masahiro Yamada,
	Matt Redfearn, Jiri Slaby, linux-kernel, Paul Gortmaker,
	Anton Wuerfel, Scott Wood, Andy Shevchenko, Martin Sperl,
	Heikki Krogerus, Mathieu OTHACEHE, Ricardo Ribalda Delgado,
	Mans Rullgard

The #if defined(CONFIG_SERIAL_EARLYCON) && !defined(MODULE)
conditional has been added to the OF_EARLYCON_DECLARE() define.

The same conditional can be dropped from 8250_ingenic.c because
the unused symbols will be marked as __maybe_unsed.
Also, the Kconfig dependency can become much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/tty/serial/8250/8250_ingenic.c | 2 --
 drivers/tty/serial/8250/Kconfig        | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c
index b0677f6..4d9dc10 100644
--- a/drivers/tty/serial/8250/8250_ingenic.c
+++ b/drivers/tty/serial/8250/8250_ingenic.c
@@ -48,7 +48,6 @@ static const struct of_device_id of_match[];
 #define UART_MCR_MDCE	BIT(7)
 #define UART_MCR_FCM	BIT(6)
 
-#if defined(CONFIG_SERIAL_EARLYCON) && !defined(MODULE)
 static struct earlycon_device *early_device;
 
 static uint8_t __init early_in(struct uart_port *port, int offset)
@@ -141,7 +140,6 @@ OF_EARLYCON_DECLARE(jz4775_uart, "ingenic,jz4775-uart",
 EARLYCON_DECLARE(jz4780_uart, ingenic_early_console_setup);
 OF_EARLYCON_DECLARE(jz4780_uart, "ingenic,jz4780-uart",
 		    ingenic_early_console_setup);
-#endif /* CONFIG_SERIAL_EARLYCON */
 
 static void ingenic_uart_serial_out(struct uart_port *p, int offset, int value)
 {
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index b5a0f2e..7c6f7af 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -396,7 +396,7 @@ config SERIAL_8250_UNIPHIER
 config SERIAL_8250_INGENIC
 	tristate "Support for Ingenic SoC serial ports"
 	depends on SERIAL_8250
-	depends on (OF_FLATTREE && SERIAL_8250_CONSOLE) || !SERIAL_EARLYCON
+	depends on OF_FLATTREE
 	depends on MIPS || COMPILE_TEST
 	help
 	  If you have a system using an Ingenic SoC and wish to make use of
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups
  2016-06-06  9:40 [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups Masahiro Yamada
                   ` (3 preceding siblings ...)
  2016-06-06  9:41 ` [PATCH 4/4] serial: 8250_ingenic: drop #if conditional surrounding earlycon code Masahiro Yamada
@ 2016-06-06 10:25 ` Arnd Bergmann
  4 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2016-06-06 10:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Masahiro Yamada, linux-serial, Andy Shevchenko, Peter Hurley,
	Paul Burton, Paul Gortmaker, Greg Kroah-Hartman,
	Mathieu OTHACEHE, linux-mediatek, linux-kernel, Anton Wuerfel,
	Scott Wood, Ricardo Ribalda Delgado, Heikki Krogerus, Jiri Slaby,
	Matthias Brugger, Martin Sperl, Matt Redfearn, Mans Rullgard

On Monday, June 6, 2016 6:40:59 PM CEST Masahiro Yamada wrote:
> 1/4: keep earlycon symbols only when CONFIG_SERIAL_EARLYCON is defined
>      and the driver is built-in.
> 
> 2/4 thru 4/4: driver clean-ups.
>               (partially reverts build fixes by Arnd Bergmann)
> 
> 
> 


Looks good to me,

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/4] serial: 8250_mtk: drop !defined(MODULE) conditional
  2016-06-06  9:41 ` [PATCH 3/4] serial: 8250_mtk: " Masahiro Yamada
@ 2016-06-06 10:27   ` Matthias Brugger
  0 siblings, 0 replies; 7+ messages in thread
From: Matthias Brugger @ 2016-06-06 10:27 UTC (permalink / raw)
  To: Masahiro Yamada, linux-serial
  Cc: Arnd Bergmann, Peter Hurley, Rob Herring, Paul Burton,
	Greg Kroah-Hartman, Jiri Slaby, Paul Gortmaker, linux-kernel,
	Andy Shevchenko, linux-mediatek, linux-arm-kernel



On 06/06/16 11:41, Masahiro Yamada wrote:
> The !defined(MODULE) conditional has been added to the
> OF_EARLYCON_DECLARE() define.
>
> This commit partially reverts commit 3f5921a60f74 ("serial:
> 8250/mediatek: fix building with SERIAL_8250=m").
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>

>
>   drivers/tty/serial/8250/8250_mtk.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index 3489fbc..3611ec9 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -301,7 +301,7 @@ static struct platform_driver mtk8250_platform_driver = {
>   };
>   module_platform_driver(mtk8250_platform_driver);
>
> -#if defined(CONFIG_SERIAL_8250_CONSOLE) && !defined(MODULE)
> +#ifdef CONFIG_SERIAL_8250_CONSOLE
>   static int __init early_mtk8250_setup(struct earlycon_device *device,
>   					const char *options)
>   {
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-06 10:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06  9:40 [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups Masahiro Yamada
2016-06-06  9:41 ` [PATCH 1/4] earlycon: mark earlycon code as __used iif the caller is built-in Masahiro Yamada
2016-06-06  9:41 ` [PATCH 2/4] serial: 8250_uniphier: drop !defined(MODULE) conditional Masahiro Yamada
2016-06-06  9:41 ` [PATCH 3/4] serial: 8250_mtk: " Masahiro Yamada
2016-06-06 10:27   ` Matthias Brugger
2016-06-06  9:41 ` [PATCH 4/4] serial: 8250_ingenic: drop #if conditional surrounding earlycon code Masahiro Yamada
2016-06-06 10:25 ` [PATCH 0/4] serial: earlycon: keep earlycon symbols for non-module and driver clean-ups 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).