Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1336505 > unrolled thread

[PATCH v3 0/5] serial: 8250: fixes for modular build

Started byArnd Bergmann <arnd@arndb.de>
First post2016-02-17 16:10 +0100
Last post2016-02-17 16:10 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/5] serial: 8250: fixes for modular build Arnd Bergmann <arnd@arndb.de> - 2016-02-17 16:10 +0100
    [PATCH v3 1/5] Revert "drivers/tty/serial: make 8250/8250_mtk.c explicitly non-modular" Arnd Bergmann <arnd@arndb.de> - 2016-02-17 16:10 +0100
      Re: [PATCH v3 1/5] Revert "drivers/tty/serial: make 8250/8250_mtk.c  explicitly non-modular" Matthias Brugger <matthias.bgg@gmail.com> - 2016-02-17 18:20 +0100
    [PATCH v3 3/5] serial: 8250/uniphier: fix modular build Arnd Bergmann <arnd@arndb.de> - 2016-02-17 16:10 +0100
    [PATCH v3 2/5] Revert "drivers/tty/serial: make 8250/8250_ingenic.c explicitly non-modular" Arnd Bergmann <arnd@arndb.de> - 2016-02-17 16:10 +0100

#1336505 — [PATCH v3 0/5] serial: 8250: fixes for modular build

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-17 16:10 +0100
Subject[PATCH v3 0/5] serial: 8250: fixes for modular build
Message-ID<r3bTP-87x-3@gated-at.bofh.it>
Hi Greg,

This is a resend of my last week's 8250 series, with a couple of
issues fixed as pointed out by Paul Gortmaker.

Masahiro Yamada had an idea for a nicer solution to the problem of
a modular build, but after some back and forth, the conclusion was
that this does not work any more after the rework done by
Peter Hurley, so we are back to my original approach.

I've done many compile tests over the last week and found another
corner case in the Ingenic driver patch, which is now also fixed,
and I'm no longer getting any invalid symbol references here or
in other drivers.

	Arnd

[toc] | [next] | [standalone]


#1336506 — [PATCH v3 1/5] Revert "drivers/tty/serial: make 8250/8250_mtk.c explicitly non-modular"

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-17 16:10 +0100
Subject[PATCH v3 1/5] Revert "drivers/tty/serial: make 8250/8250_mtk.c explicitly non-modular"
Message-ID<r3bTP-87x-7@gated-at.bofh.it>
In reply to#1336505
This reverts commit d72d391c126e ("drivers/tty/serial: make
8250/8250_mtk.c explicitly non-modular"), which intended to remove dead
code but did not have the desired effect when the main 8250 driver was
a module itself.

This would normally result in a link error, but as the entire
drivers/tty/serial/8250/ directory is only entered when CONFIG_SERIAL_8250
is set, we never notice that the driver does not get built in this
configuration.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/tty/serial/8250/8250_mtk.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index 9038843cadc7..6ecc6e3e82dc 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -16,7 +16,7 @@
  */
 #include <linux/clk.h>
 #include <linux/io.h>
-#include <linux/init.h>
+#include <linux/module.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
@@ -245,6 +245,23 @@ static int mtk8250_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static int mtk8250_remove(struct platform_device *pdev)
+{
+	struct mtk8250_data *data = platform_get_drvdata(pdev);
+
+	pm_runtime_get_sync(&pdev->dev);
+
+	serial8250_unregister_port(data->line);
+
+	pm_runtime_disable(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
+
+	if (!pm_runtime_status_suspended(&pdev->dev))
+		mtk8250_runtime_suspend(&pdev->dev);
+
+	return 0;
+}
+
 static int __maybe_unused mtk8250_suspend(struct device *dev)
 {
 	struct mtk8250_data *data = dev_get_drvdata(dev);
@@ -273,18 +290,18 @@ static const struct of_device_id mtk8250_of_match[] = {
 	{ .compatible = "mediatek,mt6577-uart" },
 	{ /* Sentinel */ }
 };
+MODULE_DEVICE_TABLE(of, mtk8250_of_match);
 
 static struct platform_driver mtk8250_platform_driver = {
 	.driver = {
-		.name			= "mt6577-uart",
-		.pm			= &mtk8250_pm_ops,
-		.of_match_table		= mtk8250_of_match,
-		.suppress_bind_attrs	= true,
-
+		.name		= "mt6577-uart",
+		.pm		= &mtk8250_pm_ops,
+		.of_match_table	= mtk8250_of_match,
 	},
 	.probe			= mtk8250_probe,
+	.remove			= mtk8250_remove,
 };
-builtin_platform_driver(mtk8250_platform_driver);
+module_platform_driver(mtk8250_platform_driver);
 
 #ifdef CONFIG_SERIAL_8250_CONSOLE
 static int __init early_mtk8250_setup(struct earlycon_device *device,
@@ -300,3 +317,7 @@ static int __init early_mtk8250_setup(struct earlycon_device *device,
 
 OF_EARLYCON_DECLARE(mtk8250, "mediatek,mt6577-uart", early_mtk8250_setup);
 #endif
+
+MODULE_AUTHOR("Matthias Brugger");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Mediatek 8250 serial port driver");
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1336590 — Re: [PATCH v3 1/5] Revert "drivers/tty/serial: make 8250/8250_mtk.c explicitly non-modular"

FromMatthias Brugger <matthias.bgg@gmail.com>
Date2016-02-17 18:20 +0100
SubjectRe: [PATCH v3 1/5] Revert "drivers/tty/serial: make 8250/8250_mtk.c explicitly non-modular"
Message-ID<r3dVF-14C-11@gated-at.bofh.it>
In reply to#1336506

On 17/02/16 16:02, Arnd Bergmann wrote:
> This reverts commit d72d391c126e ("drivers/tty/serial: make
> 8250/8250_mtk.c explicitly non-modular"), which intended to remove dead
> code but did not have the desired effect when the main 8250 driver was
> a module itself.
>
> This would normally result in a link error, but as the entire
> drivers/tty/serial/8250/ directory is only entered when CONFIG_SERIAL_8250
> is set, we never notice that the driver does not get built in this
> configuration.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

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

>   drivers/tty/serial/8250/8250_mtk.c | 35 ++++++++++++++++++++++++++++-------
>   1 file changed, 28 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index 9038843cadc7..6ecc6e3e82dc 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -16,7 +16,7 @@
>    */
>   #include <linux/clk.h>
>   #include <linux/io.h>
> -#include <linux/init.h>
> +#include <linux/module.h>
>   #include <linux/of_irq.h>
>   #include <linux/of_platform.h>
>   #include <linux/platform_device.h>
> @@ -245,6 +245,23 @@ static int mtk8250_probe(struct platform_device *pdev)
>   	return 0;
>   }
>
> +static int mtk8250_remove(struct platform_device *pdev)
> +{
> +	struct mtk8250_data *data = platform_get_drvdata(pdev);
> +
> +	pm_runtime_get_sync(&pdev->dev);
> +
> +	serial8250_unregister_port(data->line);
> +
> +	pm_runtime_disable(&pdev->dev);
> +	pm_runtime_put_noidle(&pdev->dev);
> +
> +	if (!pm_runtime_status_suspended(&pdev->dev))
> +		mtk8250_runtime_suspend(&pdev->dev);
> +
> +	return 0;
> +}
> +
>   static int __maybe_unused mtk8250_suspend(struct device *dev)
>   {
>   	struct mtk8250_data *data = dev_get_drvdata(dev);
> @@ -273,18 +290,18 @@ static const struct of_device_id mtk8250_of_match[] = {
>   	{ .compatible = "mediatek,mt6577-uart" },
>   	{ /* Sentinel */ }
>   };
> +MODULE_DEVICE_TABLE(of, mtk8250_of_match);
>
>   static struct platform_driver mtk8250_platform_driver = {
>   	.driver = {
> -		.name			= "mt6577-uart",
> -		.pm			= &mtk8250_pm_ops,
> -		.of_match_table		= mtk8250_of_match,
> -		.suppress_bind_attrs	= true,
> -
> +		.name		= "mt6577-uart",
> +		.pm		= &mtk8250_pm_ops,
> +		.of_match_table	= mtk8250_of_match,
>   	},
>   	.probe			= mtk8250_probe,
> +	.remove			= mtk8250_remove,
>   };
> -builtin_platform_driver(mtk8250_platform_driver);
> +module_platform_driver(mtk8250_platform_driver);
>
>   #ifdef CONFIG_SERIAL_8250_CONSOLE
>   static int __init early_mtk8250_setup(struct earlycon_device *device,
> @@ -300,3 +317,7 @@ static int __init early_mtk8250_setup(struct earlycon_device *device,
>
>   OF_EARLYCON_DECLARE(mtk8250, "mediatek,mt6577-uart", early_mtk8250_setup);
>   #endif
> +
> +MODULE_AUTHOR("Matthias Brugger");
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("Mediatek 8250 serial port driver");
>

[toc] | [prev] | [next] | [standalone]


#1336508 — [PATCH v3 3/5] serial: 8250/uniphier: fix modular build

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-17 16:10 +0100
Subject[PATCH v3 3/5] serial: 8250/uniphier: fix modular build
Message-ID<r3bTQ-87x-19@gated-at.bofh.it>
In reply to#1336505
The newly added uniphier serial port driver fails to build as
a loadable module when the base 8250 driver is built-in and
its console support enabled:

ERROR: "early_serial8250_setup" [drivers/tty/serial/8250/8250_uniphier.ko] undefined!

This changes the driver to only provide the early console support
if it is built-in itself as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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 bab6b3ae2540..1b7bd26555b7 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;
 };
 
-#ifdef CONFIG_SERIAL_8250_CONSOLE
+#if defined(CONFIG_SERIAL_8250_CONSOLE) && !defined(MODULE)
 static int __init uniphier_early_console_setup(struct earlycon_device *device,
 					       const char *options)
 {
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1336511 — [PATCH v3 2/5] Revert "drivers/tty/serial: make 8250/8250_ingenic.c explicitly non-modular"

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-17 16:10 +0100
Subject[PATCH v3 2/5] Revert "drivers/tty/serial: make 8250/8250_ingenic.c explicitly non-modular"
Message-ID<r3bTQ-87x-27@gated-at.bofh.it>
In reply to#1336505
This reverts commit cafe1ac64023  ("drivers/tty: make serial
8250_ingenic.c explicitly non-modular"), which attempted to remove dead
code but did not have the desired effect when the main 8250 driver was
a loadable module itself.

This would normally result in a link error, but as the entire
drivers/tty/serial/8250/ directory is only entered when CONFIG_SERIAL_8250
is set, we never notice that the driver does not get built in this
configuration.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/tty/serial/8250/8250_ingenic.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c
index b4e1d39805b2..97b78558caed 100644
--- a/drivers/tty/serial/8250/8250_ingenic.c
+++ b/drivers/tty/serial/8250/8250_ingenic.c
@@ -4,8 +4,6 @@
  *
  * Ingenic SoC UART support
  *
- * Author: Paul Burton <paul.burton@imgtec.com>
- *
  * This program is free software; you can redistribute	 it and/or modify it
  * under  the terms of	 the GNU General  Public License as published by the
  * Free Software Foundation;  either version 2 of the	License, or (at your
@@ -20,7 +18,7 @@
 #include <linux/console.h>
 #include <linux/io.h>
 #include <linux/libfdt.h>
-#include <linux/init.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 #include <linux/of_device.h>
@@ -303,6 +301,16 @@ out:
 	return err;
 }
 
+static int ingenic_uart_remove(struct platform_device *pdev)
+{
+	struct ingenic_uart_data *data = platform_get_drvdata(pdev);
+
+	serial8250_unregister_port(data->line);
+	clk_disable_unprepare(data->clk_module);
+	clk_disable_unprepare(data->clk_baud);
+	return 0;
+}
+
 static const struct ingenic_uart_config jz4740_uart_config = {
 	.tx_loadsz = 8,
 	.fifosize = 16,
@@ -325,13 +333,19 @@ static const struct of_device_id of_match[] = {
 	{ .compatible = "ingenic,jz4780-uart", .data = &jz4780_uart_config },
 	{ /* sentinel */ }
 };
+MODULE_DEVICE_TABLE(of, of_match);
 
 static struct platform_driver ingenic_uart_platform_driver = {
 	.driver = {
-		.name			= "ingenic-uart",
-		.of_match_table		= of_match,
-		.suppress_bind_attrs	= true,
+		.name		= "ingenic-uart",
+		.of_match_table	= of_match,
 	},
 	.probe			= ingenic_uart_probe,
+	.remove			= ingenic_uart_remove,
 };
-builtin_platform_driver(ingenic_uart_platform_driver);
+
+module_platform_driver(ingenic_uart_platform_driver);
+
+MODULE_AUTHOR("Paul Burton");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Ingenic SoC UART driver");
-- 
2.7.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web