Skip to contentSkip to conversation

drivers/tty: make more bool drivers explicitly non-modular

PATCH In review Paul Gortmaker 3 participants 12 messages Oct 18, 2015 – Dec 15, 2015

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover drivers/tty: make more bool drivers explicitly non-modular

This next set of patches to drivers/tty fixes up more drivers that would perhaps appear modular when looking at the code, but are controlled by a bool Kconfig. We make sure they don't look modular and get rid of module related code in the drivers that would never be used.

The one common thread here for all the patches is that we also scrap the .remove functions which would only be used for module unload (impossible) and driver unbind. For the drivers here, there doesn't seem to be a sensible unbind use case (vs. e.g. a multiport PCI ethernet driver where one port is unbound and passed through to a kvm guest or similar). Hence we just explicitly disallow any driver unbind operations to help prevent root from doing something illogical to the machine that they could have done previously.

We've already done this for drivers/tty/serial/mpsc.c previously.

Build tested for allmodconfig on ARM64 and powerpc for tty/tty-testing.

Paul.

---

Cc Andy Gross <[email protected]>
Cc Anton Blanchard <[email protected]>
Cc David Brown <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Matthias Brugger <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-arm-msm at vger.kernel.org
Cc linux-mediatek at lists.infradead.org
Cc linuxppc-dev at lists.ozlabs.org
Cc linux-serial at vger.kernel.org
Cc linux-soc at vger.kernel.org

Paul Gortmaker (5):
drivers/tty: make hvc/hvc_vio.c explicitly non-modular drivers/tty: make ehv_bytechan.c explicitly non-modular drivers/tty/serial: make serial/atmel_serial.c explicitly non-modular drivers/tty/serial: make msm_serial.c explicitly non-modular drivers/tty/serial: make 8250/8250_mtk.c explicitly non-modular

 drivers/tty/ehv_bytechan.c         | 40 +++------------------------------
 drivers/tty/hvc/hvc_vio.c          | 29 ++++--------------------
 drivers/tty/serial/8250/8250_mtk.c | 35 ++++++-----------------------
 drivers/tty/serial/atmel_serial.c  | 45 ++++----------------------------------
 drivers/tty/serial/msm_serial.c    | 30 ++++---------------------
 5 files changed, 22 insertions(+), 157 deletions(-)
Signature · 1 line
2.6.1
#1 lore raw

PATCH 1/5 drivers/tty: make hvc/hvc_vio.c explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/tty/hvc/Kconfig:config HVC_CONSOLE
drivers/tty/hvc/Kconfig: bool "pSeries Hypervisor Virtual Console support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Anton Blanchard <[email protected]>
---
 drivers/tty/hvc/hvc_vio.c | 29 ++++-------------------------
 1 file changed, 4 insertions(+), 25 deletions(-)
drivers/tty/hvc/hvc_vio.c +4 -25
index f575a9b5ede7..b05dc5086627 100644
@@ -41,7 +41,6 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/console.h>
-#include <linux/module.h>
 
 #include <asm/hvconsole.h>
 #include <asm/vio.h>
@@ -61,7 +60,6 @@ static struct vio_device_id hvc_driver_table[] = {
 #endif
 	{ "", "" }
 };
-MODULE_DEVICE_TABLE(vio, hvc_driver_table);
 
 typedef enum hv_protocol {
 	HV_PROTOCOL_RAW,
@@ -363,26 +361,13 @@ static int hvc_vio_probe(struct vio_dev *vdev,
 	return 0;
 }
 
-static int hvc_vio_remove(struct vio_dev *vdev)
-{
-	struct hvc_struct *hp = dev_get_drvdata(&vdev->dev);
-	int rc, termno;
-
-	termno = hp->vtermno;
-	rc = hvc_remove(hp);
-	if (rc == 0) {
-		if (hvterm_privs[termno] != &hvterm_priv0)
-			kfree(hvterm_privs[termno]);
-		hvterm_privs[termno] = NULL;
-	}
-	return rc;
-}
-
 static struct vio_driver hvc_vio_driver = {
 	.id_table	= hvc_driver_table,
 	.probe		= hvc_vio_probe,
-	.remove		= hvc_vio_remove,
 	.name		= hvc_driver_name,
+	.driver = {
+		.suppress_bind_attrs	= true,
+	},
 };
 
 static int __init hvc_vio_init(void)
@@ -394,13 +379,7 @@ static int __init hvc_vio_init(void)
 
 	return rc;
 }
-module_init(hvc_vio_init); /* after drivers/char/hvc_console.c */
-
-static void __exit hvc_vio_exit(void)
-{
-	vio_unregister_driver(&hvc_vio_driver);
-}
-module_exit(hvc_vio_exit);
+device_initcall(hvc_vio_init); /* after drivers/tty/hvc/hvc_console.c */
 
 void __init hvc_vio_init_early(void)
 {
Signature · 1 line
2.6.1
#2 lore raw

PATCH 2/5 drivers/tty: make ehv_bytechan.c explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/tty/Kconfig:config PPC_EPAPR_HV_BYTECHAN
drivers/tty/Kconfig: bool "ePAPR hypervisor byte channel driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

---
 drivers/tty/ehv_bytechan.c | 40 +++-------------------------------------
 1 file changed, 3 insertions(+), 37 deletions(-)
drivers/tty/ehv_bytechan.c +3 -37
index 342b36b9ad35..7ac9bcdf1e61 100644
@@ -23,7 +23,6 @@
  * byte channel used for the console is designated as the default tty.
  */
 
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/err.h>
@@ -719,19 +718,6 @@ error:
 	return ret;
 }
 
-static int ehv_bc_tty_remove(struct platform_device *pdev)
-{
-	struct ehv_bc_data *bc = dev_get_drvdata(&pdev->dev);
-
-	tty_unregister_device(ehv_bc_driver, bc - bcs);
-
-	tty_port_destroy(&bc->port);
-	irq_dispose_mapping(bc->tx_irq);
-	irq_dispose_mapping(bc->rx_irq);
-
-	return 0;
-}
-
 static const struct of_device_id ehv_bc_tty_of_ids[] = {
 	{ .compatible = "epapr,hv-byte-channel" },
 	{}
@@ -741,15 +727,15 @@ static struct platform_driver ehv_bc_tty_driver = {
 	.driver = {
 		.name = "ehv-bc",
 		.of_match_table = ehv_bc_tty_of_ids,
+		.suppress_bind_attrs = true,
 	},
 	.probe		= ehv_bc_tty_probe,
-	.remove		= ehv_bc_tty_remove,
 };
 
 /**
  * ehv_bc_init - ePAPR hypervisor byte channel driver initialization
  *
- * This function is called when this module is loaded.
+ * This function is called when this driver is loaded.
  */
 static int __init ehv_bc_init(void)
 {
@@ -814,24 +800,4 @@ error:
 
 	return ret;
 }
-
-
-/**
- * ehv_bc_exit - ePAPR hypervisor byte channel driver termination
- *
- * This function is called when this driver is unloaded.
- */
-static void __exit ehv_bc_exit(void)
-{
-	platform_driver_unregister(&ehv_bc_tty_driver);
-	tty_unregister_driver(ehv_bc_driver);
-	put_tty_driver(ehv_bc_driver);
-	kfree(bcs);
-}
-
-module_init(ehv_bc_init);
-module_exit(ehv_bc_exit);
-
-MODULE_AUTHOR("Timur Tabi <[email protected]>");
-MODULE_DESCRIPTION("ePAPR hypervisor byte channel driver");
-MODULE_LICENSE("GPL v2");
+device_initcall(ehv_bc_init);
Signature · 1 line
2.6.1
#3 lore raw

PATCH 3/5 drivers/tty/serial: make serial/atmel_serial.c explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/tty/serial/Kconfig:config SERIAL_ATMEL
drivers/tty/serial/Kconfig: bool "AT91 / AT32 on-chip serial port support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Nicolas Ferre <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
---
 drivers/tty/serial/atmel_serial.c | 45 ++++-----------------------------------
 1 file changed, 4 insertions(+), 41 deletions(-)
drivers/tty/serial/atmel_serial.c +4 -41
index 94294558943c..d19a1e931529 100644
@@ -22,7 +22,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-#include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/ioport.h>
 #include <linux/slab.h>
@@ -2866,37 +2865,14 @@ err:
 	return ret;
 }
 
-static int atmel_serial_remove(struct platform_device *pdev)
-{
-	struct uart_port *port = platform_get_drvdata(pdev);
-	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
-	int ret = 0;
-
-	tasklet_kill(&atmel_port->tasklet);
-
-	device_init_wakeup(&pdev->dev, 0);
-
-	ret = uart_remove_one_port(&atmel_uart, port);
-
-	kfree(atmel_port->rx_ring.buf);
-
-	/* "port" is allocated statically, so we shouldn't free it */
-
-	clear_bit(port->line, atmel_ports_in_use);
-
-	clk_put(atmel_port->clk);
-
-	return ret;
-}
-
 static struct platform_driver atmel_serial_driver = {
 	.probe		= atmel_serial_probe,
-	.remove		= atmel_serial_remove,
 	.suspend	= atmel_serial_suspend,
 	.resume		= atmel_serial_resume,
 	.driver		= {
-		.name	= "atmel_usart",
-		.of_match_table	= of_match_ptr(atmel_serial_dt_ids),
+		.name			= "atmel_usart",
+		.of_match_table		= of_match_ptr(atmel_serial_dt_ids),
+		.suppress_bind_attrs    = true,
 	},
 };
 
@@ -2914,17 +2890,4 @@ static int __init atmel_serial_init(void)
 
 	return ret;
 }
-
-static void __exit atmel_serial_exit(void)
-{
-	platform_driver_unregister(&atmel_serial_driver);
-	uart_unregister_driver(&atmel_uart);
-}
-
-module_init(atmel_serial_init);
-module_exit(atmel_serial_exit);
-
-MODULE_AUTHOR("Rick Bronson");
-MODULE_DESCRIPTION("Atmel AT91 / AT32 serial port driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:atmel_usart");
+device_initcall(atmel_serial_init);
Signature · 1 line
2.6.1
#4 lore raw

PATCH 4/5 drivers/tty/serial: make msm_serial.c explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/tty/serial/Kconfig:config SERIAL_MSM
drivers/tty/serial/Kconfig: bool "MSM on-chip serial port support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

---
 drivers/tty/serial/msm_serial.c | 30 ++++--------------------------
 1 file changed, 4 insertions(+), 26 deletions(-)
drivers/tty/serial/msm_serial.c +4 -26
index dcde955475dc..15afa8070b7d 100644
@@ -23,7 +23,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
 #include <linux/hrtimer.h>
-#include <linux/module.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/irq.h>
@@ -1601,15 +1600,6 @@ static int msm_serial_probe(struct platform_device *pdev)
 	return uart_add_one_port(&msm_uart_driver, port);
 }
 
-static int msm_serial_remove(struct platform_device *pdev)
-{
-	struct uart_port *port = platform_get_drvdata(pdev);
-
-	uart_remove_one_port(&msm_uart_driver, port);
-
-	return 0;
-}
-
 static const struct of_device_id msm_match_table[] = {
 	{ .compatible = "qcom,msm-uart" },
 	{ .compatible = "qcom,msm-uartdm" },
@@ -1617,11 +1607,11 @@ static const struct of_device_id msm_match_table[] = {
 };
 
 static struct platform_driver msm_platform_driver = {
-	.remove = msm_serial_remove,
 	.probe = msm_serial_probe,
 	.driver = {
-		.name = "msm_serial",
-		.of_match_table = msm_match_table,
+		.name			= "msm_serial",
+		.of_match_table		= msm_match_table,
+		.suppress_bind_attrs	= true,
 	},
 };
 
@@ -1641,16 +1631,4 @@ static int __init msm_serial_init(void)
 
 	return ret;
 }
-
-static void __exit msm_serial_exit(void)
-{
-	platform_driver_unregister(&msm_platform_driver);
-	uart_unregister_driver(&msm_uart_driver);
-}
-
-module_init(msm_serial_init);
-module_exit(msm_serial_exit);
-
-MODULE_AUTHOR("Robert Love <[email protected]>");
-MODULE_DESCRIPTION("Driver for msm7x serial device");
-MODULE_LICENSE("GPL");
+device_initcall(msm_serial_init);
Signature · 1 line
2.6.1
#5 lore raw

Re: [PATCH 4/5] drivers/tty/serial: make msm_serial.c explicitly non-modular

Quoted 31 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/tty/serial/Kconfig:config SERIAL_MSM
drivers/tty/serial/Kconfig: bool "MSM on-chip serial port support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Quoted 1 line

---

I'd prefer we make the Kconfig a tristate. I'll test out that configuration today, but I don't see why it wouldn't work.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#6 lore raw

Re: [PATCH 4/5] drivers/tty/serial: make msm_serial.c explicitly non-modular

Quoted 34 lines · [Re: [PATCH 4/5] drivers/tty/serial: make msm_serial.c explicitly non-modular]…
Quoted 31 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/tty/serial/Kconfig:config SERIAL_MSM
drivers/tty/serial/Kconfig: bool "MSM on-chip serial port support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Quoted 1 line

---

Quoted 2 lines

I'd prefer we make the Kconfig a tristate. I'll test out that configuration today, but I don't see why it wouldn't work.

Sure, if you want to do that then great; as I've said in other threads, it simply doesn't scale for me to be expanding functionality in these kinds of commits, since there are 300+ of them and I can't do much more than just make the code consistent with the Makefile/Kconfig behaviour and still get through them all.

When I see a tristate patch for it appear in -next I will drop this. Or if Greg wants to merge the series w/o this one patch, that is fine too -- basically whatever works for Greg, since he's got the larger burden here, maintaining all these different things that he does.

Thanks,
Paul.
--

Quoted 5 lines
Signature · 3 lines
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#7 lore raw

PATCH 5/5 drivers/tty/serial: make 8250/8250_mtk.c explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/tty/serial/8250/Kconfig:config SERIAL_8250_MT6577
drivers/tty/serial/8250/Kconfig: bool "Mediatek serial port support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Matthias Brugger <[email protected]>
Cc linux-serial at vger.kernel.org
Cc linux-arm-kernel at lists.infradead.org
Cc linux-mediatek at lists.infradead.org
---
 drivers/tty/serial/8250/8250_mtk.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)
drivers/tty/serial/8250/8250_mtk.c +7 -28
index 78883ca64ddd..0e590b233f03 100644
@@ -16,7 +16,7 @@
  */
 #include <linux/clk.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
@@ -245,23 +245,6 @@ 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;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int mtk8250_suspend(struct device *dev)
 {
@@ -292,18 +275,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,
+		.name			= "mt6577-uart",
+		.pm			= &mtk8250_pm_ops,
+		.of_match_table		= mtk8250_of_match,
+		.suppress_bind_attrs	= true,
+
 	},
 	.probe			= mtk8250_probe,
-	.remove			= mtk8250_remove,
 };
-module_platform_driver(mtk8250_platform_driver);
+builtin_platform_driver(mtk8250_platform_driver);
 
 #ifdef CONFIG_SERIAL_8250_CONSOLE
 static int __init early_mtk8250_setup(struct earlycon_device *device,
@@ -319,7 +302,3 @@ 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");
Signature · 1 line
2.6.1
#8 lore raw
In reply to Paul Gortmaker
Quoted 9 lines · Paul Gortmaker

The one common thread here for all the patches is that we also scrap the .remove functions which would only be used for module unload (impossible) and driver unbind. For the drivers here, there doesn't seem to be a sensible unbind use case (vs. e.g. a multiport PCI ethernet driver where one port is unbound and passed through to a kvm guest or similar). Hence we just explicitly disallow any driver unbind operations to help prevent root from doing something illogical to the machine that they could have done previously.

Quoted 4 lines

We've already done this for drivers/tty/serial/mpsc.c previously.

Build tested for allmodconfig on ARM64 and powerpc for tty/tty-testing.

So, how does this actually build test atmel_serial?

A proper solution would be to actually make it a tristate and allow building as a module. I think it currently fails because of console_initcall() but that is certainly fixable.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#9 lore raw
Quoted 10 lines · [Re: [PATCH 0/5] drivers/tty: make more bool drivers explicitly non-modular]…
Quoted 9 lines · Paul Gortmaker

The one common thread here for all the patches is that we also scrap the .remove functions which would only be used for module unload (impossible) and driver unbind. For the drivers here, there doesn't seem to be a sensible unbind use case (vs. e.g. a multiport PCI ethernet driver where one port is unbound and passed through to a kvm guest or similar). Hence we just explicitly disallow any driver unbind operations to help prevent root from doing something illogical to the machine that they could have done previously.

Quoted 6 lines
Quoted 4 lines

We've already done this for drivers/tty/serial/mpsc.c previously.

Build tested for allmodconfig on ARM64 and powerpc for tty/tty-testing.

So, how does this actually build test atmel_serial?

Not sure why this should be a surprise; I build test it exactly like this:

paul at builder-02:~/git/linux-head$ echo $ARCH
arm64
paul at builder-02:~/git/linux-head$ echo $CROSS_COMPILE
aarch64-linux-gnu-
paul at builder-02:~/git/linux-head$ make O=../arm-build/ drivers/tty/serial/atmel_serial.o make[1]: Entering directory '/home/paul/git/arm-build' arch/arm64/Makefile:25: LSE atomics not supported by binutils
CHK include/config/kernel.release
Using /home/paul/git/linux-head as source for kernel

  GEN     ./Makefile
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h

[...]

  HOSTCC  scripts/sign-file
  HOSTCC  scripts/extract-cert
  CC      drivers/tty/serial/atmel_serial.o

make[1]: Leaving directory '/home/paul/git/arm-build' paul at builder-02:~/git/linux-head$

It did build; no warning/error. Would you call it an invalid build test?

Quoted 4 lines

A proper solution would be to actually make it a tristate and allow building as a module. I think it currently fails because of console_initcall() but that is certainly fixable.

Well, as per other threads on this topic, if people want to extend the functionality to support tristate, then great. But please do not confuse that with existing functionality which is clearly non modular in this case.

Thanks,
Paul.
--

Quoted 6 lines
Signature · 4 lines
-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#10 lore raw
Quoted 12 lines · Paul Gortmaker
Quoted 10 lines · [Re: [PATCH 0/5] drivers/tty: make more bool drivers explicitly non-modular]…
Quoted 9 lines · Paul Gortmaker

The one common thread here for all the patches is that we also scrap the .remove functions which would only be used for module unload (impossible) and driver unbind. For the drivers here, there doesn't seem to be a sensible unbind use case (vs. e.g. a multiport PCI ethernet driver where one port is unbound and passed through to a kvm guest or similar). Hence we just explicitly disallow any driver unbind operations to help prevent root from doing something illogical to the machine that they could have done previously.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

We've already done this for drivers/tty/serial/mpsc.c previously.

Build tested for allmodconfig on ARM64 and powerpc for tty/tty-testing.

So, how does this actually build test atmel_serial?

Not sure why this should be a surprise; I build test it exactly like this:

CONFIG_SERIAL_ATMEL is not selected by allmodconfig on arm64 or powerpc so this is not explaining how you build tested atmel_serial.

Quoted 15 lines

paul at builder-02:~/git/linux-head$ echo $ARCH
arm64
paul at builder-02:~/git/linux-head$ echo $CROSS_COMPILE
aarch64-linux-gnu-
paul at builder-02:~/git/linux-head$ make O=../arm-build/ drivers/tty/serial/atmel_serial.o make[1]: Entering directory '/home/paul/git/arm-build' arch/arm64/Makefile:25: LSE atomics not supported by binutils
CHK include/config/kernel.release
Using /home/paul/git/linux-head as source for kernel

  GEN     ./Makefile
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h

[...]

Quoted 8 lines
  HOSTCC  scripts/sign-file
  HOSTCC  scripts/extract-cert
  CC      drivers/tty/serial/atmel_serial.o

make[1]: Leaving directory '/home/paul/git/arm-build' paul at builder-02:~/git/linux-head$

It did build; no warning/error. Would you call it an invalid build test?

What you describe is a different test. I end up with 4 warnings when doing that on my machine.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#11 lore raw
In reply to Paul Gortmaker
Quoted 4 lines · [[PATCH 0/5] drivers/tty: make more bool drivers explicitly non-modular] On…

This next set of patches to drivers/tty fixes up more drivers that would perhaps appear modular when looking at the code, but are controlled by a bool Kconfig. We make sure they don't look modular and get rid of module related code in the drivers that would never be used.

[...]

Quoted 6 lines

Paul Gortmaker (5):
drivers/tty: make hvc/hvc_vio.c explicitly non-modular drivers/tty: make ehv_bytechan.c explicitly non-modular drivers/tty/serial: make serial/atmel_serial.c explicitly non-modular drivers/tty/serial: make msm_serial.c explicitly non-modular drivers/tty/serial: make 8250/8250_mtk.c explicitly non-modular

Hi Greg,

You've merged the #3 atmel patch and #5 the 8250_mtk patch; the msm_serial patch (#4) is no longer applicable since the authors changed it to tristate.

That leaves the top two patches; both for PPC hardware. Did you skip those because you wanted them pushed through the powerpc tree?

If so, that is fine, I can do that. Just let me know.

Thanks,
Paul.
--

Quoted 11 lines
 drivers/tty/ehv_bytechan.c         | 40 +++------------------------------
 drivers/tty/hvc/hvc_vio.c          | 29 ++++--------------------
 drivers/tty/serial/8250/8250_mtk.c | 35 ++++++-----------------------
 drivers/tty/serial/atmel_serial.c  | 45 ++++----------------------------------
 drivers/tty/serial/msm_serial.c    | 30 ++++---------------------
 5 files changed, 22 insertions(+), 157 deletions(-)
Signature · 1 line
2.6.1