All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular
@ 2015-08-19 21:48 ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Greg Kroah-Hartman, Jiri Slaby, Joachim Eastwood,
	linux-arm-kernel, linuxppc-dev, linux-serial

[v2: drop dead module code removal from 8250_lpc18xx.c ; instead convert it
 from bool to tristate ; also add ack to hvc_console commit.]

This second set of patches to drivers/tty steps outside of the serial
dir, and an improved auditing finds two more serial drivers pretending
to be modular that really are not.

The reasoning for doing this is the same as the first set[1] of patches
and is largely copied below:

  In the previous merge window, we made changes to allow better
  delineation between modular and non-modular code in commit
  0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
  from init.h to module.h").  This allows us to now ensure module code
  looks modular and non-modular code does not accidentally look modular
  without suffering build breakage.
  
  Here we target code that is, by nature of their Kconfig settings, only
  available to be built-in, but implicitly presenting itself as being
  possibly modular by way of using modular headers, macros, and functions.
  
  The goal here is to remove that illusion of modularity from these
  drivers, but in a way that leaves the actual runtime unchanged.
  In doing so, we remove code that has never been tested and adds
  no value to the tree.  And we begin the process of expecting a
  level of consistency between the Kconfig of a driver and the code
  that the driver uses.
  
Build tested for allyesconfig on x86_64, and ARM for lpc81xx, and powerpc
for hvc_console and mpsc, layered onto tty/tty-next as a baseline.

Paul.

[1] https://lkml.kernel.org/r/1437530538-5078-1-git-send-email-paul.gortmaker@windriver.com
--

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-serial@vger.kernel.org

Paul Gortmaker (5):
  drivers/tty: make pty.c slightly more explicitly non-modular
  drivers/tty: make sysrq.c slightly more explicitly non-modular
  drivers/tty: make hvc_console.c explicitly non-modular
  drivers/tty: make serial/mpsc.c driver explicitly non-modular
  drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate

 drivers/tty/hvc/hvc_console.c   | 18 +-----------------
 drivers/tty/pty.c               |  7 +++++--
 drivers/tty/serial/8250/Kconfig |  2 +-
 drivers/tty/serial/mpsc.c       | 36 +++---------------------------------
 drivers/tty/sysrq.c             |  6 +++++-
 5 files changed, 15 insertions(+), 54 deletions(-)

-- 
2.5.0


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

* [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular
@ 2015-08-19 21:48 ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Joachim Eastwood, Paul Gortmaker,
	linux-serial, Jiri Slaby, linuxppc-dev, linux-arm-kernel

[v2: drop dead module code removal from 8250_lpc18xx.c ; instead convert it
 from bool to tristate ; also add ack to hvc_console commit.]

This second set of patches to drivers/tty steps outside of the serial
dir, and an improved auditing finds two more serial drivers pretending
to be modular that really are not.

The reasoning for doing this is the same as the first set[1] of patches
and is largely copied below:

  In the previous merge window, we made changes to allow better
  delineation between modular and non-modular code in commit
  0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
  from init.h to module.h").  This allows us to now ensure module code
  looks modular and non-modular code does not accidentally look modular
  without suffering build breakage.
  
  Here we target code that is, by nature of their Kconfig settings, only
  available to be built-in, but implicitly presenting itself as being
  possibly modular by way of using modular headers, macros, and functions.
  
  The goal here is to remove that illusion of modularity from these
  drivers, but in a way that leaves the actual runtime unchanged.
  In doing so, we remove code that has never been tested and adds
  no value to the tree.  And we begin the process of expecting a
  level of consistency between the Kconfig of a driver and the code
  that the driver uses.
  
Build tested for allyesconfig on x86_64, and ARM for lpc81xx, and powerpc
for hvc_console and mpsc, layered onto tty/tty-next as a baseline.

Paul.

[1] https://lkml.kernel.org/r/1437530538-5078-1-git-send-email-paul.gortmaker@windriver.com
--

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-serial@vger.kernel.org

Paul Gortmaker (5):
  drivers/tty: make pty.c slightly more explicitly non-modular
  drivers/tty: make sysrq.c slightly more explicitly non-modular
  drivers/tty: make hvc_console.c explicitly non-modular
  drivers/tty: make serial/mpsc.c driver explicitly non-modular
  drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate

 drivers/tty/hvc/hvc_console.c   | 18 +-----------------
 drivers/tty/pty.c               |  7 +++++--
 drivers/tty/serial/8250/Kconfig |  2 +-
 drivers/tty/serial/mpsc.c       | 36 +++---------------------------------
 drivers/tty/sysrq.c             |  6 +++++-
 5 files changed, 15 insertions(+), 54 deletions(-)

-- 
2.5.0

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

* [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular
@ 2015-08-19 21:48 ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-arm-kernel

[v2: drop dead module code removal from 8250_lpc18xx.c ; instead convert it
 from bool to tristate ; also add ack to hvc_console commit.]

This second set of patches to drivers/tty steps outside of the serial
dir, and an improved auditing finds two more serial drivers pretending
to be modular that really are not.

The reasoning for doing this is the same as the first set[1] of patches
and is largely copied below:

  In the previous merge window, we made changes to allow better
  delineation between modular and non-modular code in commit
  0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
  from init.h to module.h").  This allows us to now ensure module code
  looks modular and non-modular code does not accidentally look modular
  without suffering build breakage.
  
  Here we target code that is, by nature of their Kconfig settings, only
  available to be built-in, but implicitly presenting itself as being
  possibly modular by way of using modular headers, macros, and functions.
  
  The goal here is to remove that illusion of modularity from these
  drivers, but in a way that leaves the actual runtime unchanged.
  In doing so, we remove code that has never been tested and adds
  no value to the tree.  And we begin the process of expecting a
  level of consistency between the Kconfig of a driver and the code
  that the driver uses.
  
Build tested for allyesconfig on x86_64, and ARM for lpc81xx, and powerpc
for hvc_console and mpsc, layered onto tty/tty-next as a baseline.

Paul.

[1] https://lkml.kernel.org/r/1437530538-5078-1-git-send-email-paul.gortmaker at windriver.com
--

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linuxppc-dev at lists.ozlabs.org
Cc: linux-serial at vger.kernel.org

Paul Gortmaker (5):
  drivers/tty: make pty.c slightly more explicitly non-modular
  drivers/tty: make sysrq.c slightly more explicitly non-modular
  drivers/tty: make hvc_console.c explicitly non-modular
  drivers/tty: make serial/mpsc.c driver explicitly non-modular
  drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate

 drivers/tty/hvc/hvc_console.c   | 18 +-----------------
 drivers/tty/pty.c               |  7 +++++--
 drivers/tty/serial/8250/Kconfig |  2 +-
 drivers/tty/serial/mpsc.c       | 36 +++---------------------------------
 drivers/tty/sysrq.c             |  6 +++++-
 5 files changed, 15 insertions(+), 54 deletions(-)

-- 
2.5.0

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

* [PATCH 1/5] drivers/tty: make pty.c slightly more explicitly non-modular
  2015-08-19 21:48 ` Paul Gortmaker
  (?)
  (?)
@ 2015-08-19 21:48 ` Paul Gortmaker
  -1 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Greg Kroah-Hartman, Jiri Slaby

The Kconfig currently controlling compilation of this code is:

drivers/tty/Kconfig:config LEGACY_PTYS
drivers/tty/Kconfig:    bool "Legacy (BSD) PTY support"

...and:

drivers/tty/Kconfig:config UNIX98_PTYS
drivers/tty/Kconfig:    bool "Unix98 PTY support" if EXPERT

combined with this:

obj-$(CONFIG_LEGACY_PTYS)       += pty.o
obj-$(CONFIG_UNIX98_PTYS)       += pty.o

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

Lets remove the traces of modularity we can so that when reading the
driver there is less 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 don't delete the module.h include since other parts of the file are
using content from there.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/pty.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 4d5937c185c1..a45660f62db5 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -7,7 +7,6 @@
  */
 
 #include <linux/module.h>
-
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/tty.h>
@@ -501,6 +500,10 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
 }
 
 static int legacy_count = CONFIG_LEGACY_PTY_COUNT;
+/*
+ * not really modular, but the easiest way to keep compat with existing
+ * bootargs behaviour is to continue using module_param here.
+ */
 module_param(legacy_count, int, 0);
 
 /*
@@ -877,4 +880,4 @@ static int __init pty_init(void)
 	unix98_pty_init();
 	return 0;
 }
-module_init(pty_init);
+device_initcall(pty_init);
-- 
2.5.0


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

* [PATCH 2/5] drivers/tty: make sysrq.c slightly more explicitly non-modular
  2015-08-19 21:48 ` Paul Gortmaker
                   ` (2 preceding siblings ...)
  (?)
@ 2015-08-19 21:48 ` Paul Gortmaker
  -1 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Greg Kroah-Hartman, Jiri Slaby

The Kconfig currently controlling compilation of this code is:

config.debug:config MAGIC_SYSRQ
      bool "Magic SysRq key"

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

Lets remove the traces of modularity we can so that when reading the
driver there is less 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 don't delete the module.h include since other parts of the file are
using content from there.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/sysrq.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index b5b427888b24..dd2c435e223e 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -996,6 +996,10 @@ static const struct kernel_param_ops param_ops_sysrq_reset_seq = {
 #define param_check_sysrq_reset_seq(name, p)	\
 	__param_check(name, p, unsigned short)
 
+/*
+ * not really modular, but the easiest way to keep compat with existing
+ * bootargs behaviour is to continue using module_param here.
+ */
 module_param_array_named(reset_seq, sysrq_reset_seq, sysrq_reset_seq,
 			 &sysrq_reset_seq_len, 0644);
 
@@ -1112,4 +1116,4 @@ static int __init sysrq_init(void)
 
 	return 0;
 }
-module_init(sysrq_init);
+device_initcall(sysrq_init);
-- 
2.5.0


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

* [PATCH 3/5] drivers/tty: make hvc_console.c explicitly non-modular
  2015-08-19 21:48 ` Paul Gortmaker
                   ` (3 preceding siblings ...)
  (?)
@ 2015-08-19 21:48 ` Paul Gortmaker
  -1 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Greg Kroah-Hartman, Jiri Slaby, linuxppc-dev

The Kconfig currently controlling compilation of this code is:

drivers/tty/hvc/Kconfig:config HVC_DRIVER
drivers/tty/hvc/Kconfig:        bool

...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, even
though someone bothered to comment that the code was not used.

Unlike other changes, this driver binds in w/o using module_init,
so we dont have init ordering concerns with this commit.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/hvc/hvc_console.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index 4e9c4cc9e1b5..9c30f67c802a 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -29,7 +29,7 @@
 #include <linux/kernel.h>
 #include <linux/kthread.h>
 #include <linux/list.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/major.h>
 #include <linux/atomic.h>
 #include <linux/sysrq.h>
@@ -1005,19 +1005,3 @@ put_tty:
 out:
 	return err;
 }
-
-/* This isn't particularly necessary due to this being a console driver
- * but it is nice to be thorough.
- */
-static void __exit hvc_exit(void)
-{
-	if (hvc_driver) {
-		kthread_stop(hvc_task);
-
-		tty_unregister_driver(hvc_driver);
-		/* return tty_struct instances allocated in hvc_init(). */
-		put_tty_driver(hvc_driver);
-		unregister_console(&hvc_console);
-	}
-}
-module_exit(hvc_exit);
-- 
2.5.0


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

* [PATCH 4/5] drivers/tty: make serial/mpsc.c driver explicitly non-modular
  2015-08-19 21:48 ` Paul Gortmaker
@ 2015-08-19 21:48   ` Paul Gortmaker
  -1 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Greg Kroah-Hartman, Jiri Slaby, linux-serial

The Kconfig for this driver is currently:

config SERIAL_MPSC
        bool "Marvell MPSC 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.

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

We leave some tags like MODULE_AUTHOR for documentation purposes.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linux-serial@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/serial/mpsc.c | 36 +++---------------------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c
index 82bb6d1fe23b..edb32e3f1e84 100644
--- a/drivers/tty/serial/mpsc.c
+++ b/drivers/tty/serial/mpsc.c
@@ -55,8 +55,6 @@
 #define SUPPORT_SYSRQ
 #endif
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
 #include <linux/ioport.h>
@@ -2108,24 +2106,8 @@ static int mpsc_drv_probe(struct platform_device *dev)
 	return rc;
 }
 
-static int mpsc_drv_remove(struct platform_device *dev)
-{
-	pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
-
-	if (dev->id < MPSC_NUM_CTLRS) {
-		uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
-		mpsc_release_port((struct uart_port *)
-				&mpsc_ports[dev->id].port);
-		mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
-		return 0;
-	} else {
-		return -ENODEV;
-	}
-}
-
 static struct platform_driver mpsc_driver = {
 	.probe	= mpsc_drv_probe,
-	.remove	= mpsc_drv_remove,
 	.driver	= {
 		.name	= MPSC_CTLR_NAME,
 	},
@@ -2156,22 +2138,10 @@ static int __init mpsc_drv_init(void)
 
 	return rc;
 }
+device_initcall(mpsc_drv_init);
 
-static void __exit mpsc_drv_exit(void)
-{
-	platform_driver_unregister(&mpsc_driver);
-	platform_driver_unregister(&mpsc_shared_driver);
-	uart_unregister_driver(&mpsc_reg);
-	memset(mpsc_ports, 0, sizeof(mpsc_ports));
-	memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
-}
-
-module_init(mpsc_drv_init);
-module_exit(mpsc_drv_exit);
-
+/*
 MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>");
 MODULE_DESCRIPTION("Generic Marvell MPSC serial/UART driver");
-MODULE_VERSION(MPSC_VERSION);
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR);
-MODULE_ALIAS("platform:" MPSC_CTLR_NAME);
+*/
-- 
2.5.0


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

* [PATCH 4/5] drivers/tty: make serial/mpsc.c driver explicitly non-modular
@ 2015-08-19 21:48   ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Greg Kroah-Hartman, Jiri Slaby, linux-serial

The Kconfig for this driver is currently:

config SERIAL_MPSC
        bool "Marvell MPSC 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.

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

We leave some tags like MODULE_AUTHOR for documentation purposes.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linux-serial@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/serial/mpsc.c | 36 +++---------------------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c
index 82bb6d1fe23b..edb32e3f1e84 100644
--- a/drivers/tty/serial/mpsc.c
+++ b/drivers/tty/serial/mpsc.c
@@ -55,8 +55,6 @@
 #define SUPPORT_SYSRQ
 #endif
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
 #include <linux/ioport.h>
@@ -2108,24 +2106,8 @@ static int mpsc_drv_probe(struct platform_device *dev)
 	return rc;
 }
 
-static int mpsc_drv_remove(struct platform_device *dev)
-{
-	pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
-
-	if (dev->id < MPSC_NUM_CTLRS) {
-		uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
-		mpsc_release_port((struct uart_port *)
-				&mpsc_ports[dev->id].port);
-		mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
-		return 0;
-	} else {
-		return -ENODEV;
-	}
-}
-
 static struct platform_driver mpsc_driver = {
 	.probe	= mpsc_drv_probe,
-	.remove	= mpsc_drv_remove,
 	.driver	= {
 		.name	= MPSC_CTLR_NAME,
 	},
@@ -2156,22 +2138,10 @@ static int __init mpsc_drv_init(void)
 
 	return rc;
 }
+device_initcall(mpsc_drv_init);
 
-static void __exit mpsc_drv_exit(void)
-{
-	platform_driver_unregister(&mpsc_driver);
-	platform_driver_unregister(&mpsc_shared_driver);
-	uart_unregister_driver(&mpsc_reg);
-	memset(mpsc_ports, 0, sizeof(mpsc_ports));
-	memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
-}
-
-module_init(mpsc_drv_init);
-module_exit(mpsc_drv_exit);
-
+/*
 MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>");
 MODULE_DESCRIPTION("Generic Marvell MPSC serial/UART driver");
-MODULE_VERSION(MPSC_VERSION);
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR);
-MODULE_ALIAS("platform:" MPSC_CTLR_NAME);
+*/
-- 
2.5.0

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

* [PATCH 5/5] drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate
  2015-08-19 21:48 ` Paul Gortmaker
  (?)
@ 2015-08-19 21:48   ` Paul Gortmaker
  -1 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Greg Kroah-Hartman, Jiri Slaby, Joachim Eastwood,
	linux-serial, linux-arm-kernel

The Kconfig currently controlling compilation of this code is:

8250/Kconfig:config SERIAL_8250_LPC18XX
8250/Kconfig:        bool "NXP LPC18xx/43xx serial port support"

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

When targetting orphaned modular code in non-modular drivers, this
came up.  Joachim indicated that the driver was actually meant to
be tristate but ended up bool by accident.  So here we make it
tristate instead of removing the modular code that was essentially
orphaned.

Suggested-by: Joachim Eastwood <manabian@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: linux-serial@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/serial/8250/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index e1de1181b322..f5c4b01f6f1d 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -337,7 +337,7 @@ config SERIAL_8250_FINTEK
 	  through the PNP driver. If unsure, say N.
 
 config SERIAL_8250_LPC18XX
-	bool "NXP LPC18xx/43xx serial port support"
+	tristate "NXP LPC18xx/43xx serial port support"
 	depends on SERIAL_8250 && OF && (ARCH_LPC18XX || COMPILE_TEST)
 	default ARCH_LPC18XX
 	help
-- 
2.5.0


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

* [PATCH 5/5] drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate
@ 2015-08-19 21:48   ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Joachim Eastwood, Paul Gortmaker,
	linux-serial, Jiri Slaby, linux-arm-kernel

The Kconfig currently controlling compilation of this code is:

8250/Kconfig:config SERIAL_8250_LPC18XX
8250/Kconfig:        bool "NXP LPC18xx/43xx serial port support"

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

When targetting orphaned modular code in non-modular drivers, this
came up.  Joachim indicated that the driver was actually meant to
be tristate but ended up bool by accident.  So here we make it
tristate instead of removing the modular code that was essentially
orphaned.

Suggested-by: Joachim Eastwood <manabian@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: linux-serial@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/serial/8250/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index e1de1181b322..f5c4b01f6f1d 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -337,7 +337,7 @@ config SERIAL_8250_FINTEK
 	  through the PNP driver. If unsure, say N.
 
 config SERIAL_8250_LPC18XX
-	bool "NXP LPC18xx/43xx serial port support"
+	tristate "NXP LPC18xx/43xx serial port support"
 	depends on SERIAL_8250 && OF && (ARCH_LPC18XX || COMPILE_TEST)
 	default ARCH_LPC18XX
 	help
-- 
2.5.0

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

* [PATCH 5/5] drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate
@ 2015-08-19 21:48   ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-08-19 21:48 UTC (permalink / raw)
  To: linux-arm-kernel

The Kconfig currently controlling compilation of this code is:

8250/Kconfig:config SERIAL_8250_LPC18XX
8250/Kconfig:        bool "NXP LPC18xx/43xx serial port support"

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

When targetting orphaned modular code in non-modular drivers, this
came up.  Joachim indicated that the driver was actually meant to
be tristate but ended up bool by accident.  So here we make it
tristate instead of removing the modular code that was essentially
orphaned.

Suggested-by: Joachim Eastwood <manabian@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: linux-serial at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/serial/8250/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index e1de1181b322..f5c4b01f6f1d 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -337,7 +337,7 @@ config SERIAL_8250_FINTEK
 	  through the PNP driver. If unsure, say N.
 
 config SERIAL_8250_LPC18XX
-	bool "NXP LPC18xx/43xx serial port support"
+	tristate "NXP LPC18xx/43xx serial port support"
 	depends on SERIAL_8250 && OF && (ARCH_LPC18XX || COMPILE_TEST)
 	default ARCH_LPC18XX
 	help
-- 
2.5.0

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

* Re: [PATCH 5/5] drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate
  2015-08-19 21:48   ` Paul Gortmaker
  (?)
@ 2015-08-20  6:58     ` Joachim Eastwood
  -1 siblings, 0 replies; 22+ messages in thread
From: Joachim Eastwood @ 2015-08-20  6:58 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
	linux-arm-kernel

On 19 August 2015 at 23:48, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> The Kconfig currently controlling compilation of this code is:
>
> 8250/Kconfig:config SERIAL_8250_LPC18XX
> 8250/Kconfig:        bool "NXP LPC18xx/43xx serial port support"
>
> ...meaning that it currently is not being built as a module by anyone.
>
> When targetting orphaned modular code in non-modular drivers, this
> came up.  Joachim indicated that the driver was actually meant to
> be tristate but ended up bool by accident.  So here we make it
> tristate instead of removing the modular code that was essentially
> orphaned.
>
> Suggested-by: Joachim Eastwood <manabian@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.com>
> Cc: Joachim Eastwood <manabian@gmail.com>
> Cc: linux-serial@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Acked-by: Joachim Eastwood <manabian@gmail.com>

Build tested as a module on lpc18xx.

Thanks for fixing it Paul.


regards,
Joachim Eastwood

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

* Re: [PATCH 5/5] drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate
@ 2015-08-20  6:58     ` Joachim Eastwood
  0 siblings, 0 replies; 22+ messages in thread
From: Joachim Eastwood @ 2015-08-20  6:58 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
	linux-arm-kernel

On 19 August 2015 at 23:48, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> The Kconfig currently controlling compilation of this code is:
>
> 8250/Kconfig:config SERIAL_8250_LPC18XX
> 8250/Kconfig:        bool "NXP LPC18xx/43xx serial port support"
>
> ...meaning that it currently is not being built as a module by anyone.
>
> When targetting orphaned modular code in non-modular drivers, this
> came up.  Joachim indicated that the driver was actually meant to
> be tristate but ended up bool by accident.  So here we make it
> tristate instead of removing the modular code that was essentially
> orphaned.
>
> Suggested-by: Joachim Eastwood <manabian@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.com>
> Cc: Joachim Eastwood <manabian@gmail.com>
> Cc: linux-serial@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Acked-by: Joachim Eastwood <manabian@gmail.com>

Build tested as a module on lpc18xx.

Thanks for fixing it Paul.


regards,
Joachim Eastwood

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

* [PATCH 5/5] drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate
@ 2015-08-20  6:58     ` Joachim Eastwood
  0 siblings, 0 replies; 22+ messages in thread
From: Joachim Eastwood @ 2015-08-20  6:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 19 August 2015 at 23:48, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> The Kconfig currently controlling compilation of this code is:
>
> 8250/Kconfig:config SERIAL_8250_LPC18XX
> 8250/Kconfig:        bool "NXP LPC18xx/43xx serial port support"
>
> ...meaning that it currently is not being built as a module by anyone.
>
> When targetting orphaned modular code in non-modular drivers, this
> came up.  Joachim indicated that the driver was actually meant to
> be tristate but ended up bool by accident.  So here we make it
> tristate instead of removing the modular code that was essentially
> orphaned.
>
> Suggested-by: Joachim Eastwood <manabian@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.com>
> Cc: Joachim Eastwood <manabian@gmail.com>
> Cc: linux-serial at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Acked-by: Joachim Eastwood <manabian@gmail.com>

Build tested as a module on lpc18xx.

Thanks for fixing it Paul.


regards,
Joachim Eastwood

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

* Re: [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular
  2015-08-19 21:48 ` Paul Gortmaker
  (?)
@ 2015-09-26 22:53   ` Paul Gortmaker
  -1 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-09-26 22:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Jiri Slaby, Joachim Eastwood, linux-arm-kernel,
	linuxppc-dev, linux-serial

[[PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular] On 19/08/2015 (Wed 17:48) Paul Gortmaker wrote:

> [v2: drop dead module code removal from 8250_lpc18xx.c ; instead convert it
>  from bool to tristate ; also add ack to hvc_console commit.]
> 
> This second set of patches to drivers/tty steps outside of the serial
> dir, and an improved auditing finds two more serial drivers pretending
> to be modular that really are not.

Hi Greg -- wondering if this is still in your to-do queue.  I see the
patches to drivers/char that I sent about the same time made it onto
your char-testing branch but not these onto tty-testing.

The reason I ask is that I've about a 1/2 dozen more similar patches
that showed up once I started auditing non-x86 code.  I don't want to
re-spam you with these along with the new ones, if these are still in
your backlog for processing.

Thanks,
Paul.
--

> 
> The reasoning for doing this is the same as the first set[1] of patches
> and is largely copied below:
> 
>   In the previous merge window, we made changes to allow better
>   delineation between modular and non-modular code in commit
>   0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
>   from init.h to module.h").  This allows us to now ensure module code
>   looks modular and non-modular code does not accidentally look modular
>   without suffering build breakage.
>   
>   Here we target code that is, by nature of their Kconfig settings, only
>   available to be built-in, but implicitly presenting itself as being
>   possibly modular by way of using modular headers, macros, and functions.
>   
>   The goal here is to remove that illusion of modularity from these
>   drivers, but in a way that leaves the actual runtime unchanged.
>   In doing so, we remove code that has never been tested and adds
>   no value to the tree.  And we begin the process of expecting a
>   level of consistency between the Kconfig of a driver and the code
>   that the driver uses.
>   
> Build tested for allyesconfig on x86_64, and ARM for lpc81xx, and powerpc
> for hvc_console and mpsc, layered onto tty/tty-next as a baseline.
> 
> Paul.
> 
> [1] https://lkml.kernel.org/r/1437530538-5078-1-git-send-email-paul.gortmaker@windriver.com
> --
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.com>
> Cc: Joachim Eastwood <manabian@gmail.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-serial@vger.kernel.org
> 
> Paul Gortmaker (5):
>   drivers/tty: make pty.c slightly more explicitly non-modular
>   drivers/tty: make sysrq.c slightly more explicitly non-modular
>   drivers/tty: make hvc_console.c explicitly non-modular
>   drivers/tty: make serial/mpsc.c driver explicitly non-modular
>   drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate
> 
>  drivers/tty/hvc/hvc_console.c   | 18 +-----------------
>  drivers/tty/pty.c               |  7 +++++--
>  drivers/tty/serial/8250/Kconfig |  2 +-
>  drivers/tty/serial/mpsc.c       | 36 +++---------------------------------
>  drivers/tty/sysrq.c             |  6 +++++-
>  5 files changed, 15 insertions(+), 54 deletions(-)
> 
> -- 
> 2.5.0
> 

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

* Re: [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular
@ 2015-09-26 22:53   ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-09-26 22:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Jiri Slaby, Joachim Eastwood, linux-arm-kernel,
	linuxppc-dev, linux-serial

[[PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular] On 19/08/2015 (Wed 17:48) Paul Gortmaker wrote:

> [v2: drop dead module code removal from 8250_lpc18xx.c ; instead convert it
>  from bool to tristate ; also add ack to hvc_console commit.]
> 
> This second set of patches to drivers/tty steps outside of the serial
> dir, and an improved auditing finds two more serial drivers pretending
> to be modular that really are not.

Hi Greg -- wondering if this is still in your to-do queue.  I see the
patches to drivers/char that I sent about the same time made it onto
your char-testing branch but not these onto tty-testing.

The reason I ask is that I've about a 1/2 dozen more similar patches
that showed up once I started auditing non-x86 code.  I don't want to
re-spam you with these along with the new ones, if these are still in
your backlog for processing.

Thanks,
Paul.
--

> 
> The reasoning for doing this is the same as the first set[1] of patches
> and is largely copied below:
> 
>   In the previous merge window, we made changes to allow better
>   delineation between modular and non-modular code in commit
>   0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
>   from init.h to module.h").  This allows us to now ensure module code
>   looks modular and non-modular code does not accidentally look modular
>   without suffering build breakage.
>   
>   Here we target code that is, by nature of their Kconfig settings, only
>   available to be built-in, but implicitly presenting itself as being
>   possibly modular by way of using modular headers, macros, and functions.
>   
>   The goal here is to remove that illusion of modularity from these
>   drivers, but in a way that leaves the actual runtime unchanged.
>   In doing so, we remove code that has never been tested and adds
>   no value to the tree.  And we begin the process of expecting a
>   level of consistency between the Kconfig of a driver and the code
>   that the driver uses.
>   
> Build tested for allyesconfig on x86_64, and ARM for lpc81xx, and powerpc
> for hvc_console and mpsc, layered onto tty/tty-next as a baseline.
> 
> Paul.
> 
> [1] https://lkml.kernel.org/r/1437530538-5078-1-git-send-email-paul.gortmaker@windriver.com
> --
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.com>
> Cc: Joachim Eastwood <manabian@gmail.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-serial@vger.kernel.org
> 
> Paul Gortmaker (5):
>   drivers/tty: make pty.c slightly more explicitly non-modular
>   drivers/tty: make sysrq.c slightly more explicitly non-modular
>   drivers/tty: make hvc_console.c explicitly non-modular
>   drivers/tty: make serial/mpsc.c driver explicitly non-modular
>   drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate
> 
>  drivers/tty/hvc/hvc_console.c   | 18 +-----------------
>  drivers/tty/pty.c               |  7 +++++--
>  drivers/tty/serial/8250/Kconfig |  2 +-
>  drivers/tty/serial/mpsc.c       | 36 +++---------------------------------
>  drivers/tty/sysrq.c             |  6 +++++-
>  5 files changed, 15 insertions(+), 54 deletions(-)
> 
> -- 
> 2.5.0
> 

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

* [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular
@ 2015-09-26 22:53   ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-09-26 22:53 UTC (permalink / raw)
  To: linux-arm-kernel

[[PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular] On 19/08/2015 (Wed 17:48) Paul Gortmaker wrote:

> [v2: drop dead module code removal from 8250_lpc18xx.c ; instead convert it
>  from bool to tristate ; also add ack to hvc_console commit.]
> 
> This second set of patches to drivers/tty steps outside of the serial
> dir, and an improved auditing finds two more serial drivers pretending
> to be modular that really are not.

Hi Greg -- wondering if this is still in your to-do queue.  I see the
patches to drivers/char that I sent about the same time made it onto
your char-testing branch but not these onto tty-testing.

The reason I ask is that I've about a 1/2 dozen more similar patches
that showed up once I started auditing non-x86 code.  I don't want to
re-spam you with these along with the new ones, if these are still in
your backlog for processing.

Thanks,
Paul.
--

> 
> The reasoning for doing this is the same as the first set[1] of patches
> and is largely copied below:
> 
>   In the previous merge window, we made changes to allow better
>   delineation between modular and non-modular code in commit
>   0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
>   from init.h to module.h").  This allows us to now ensure module code
>   looks modular and non-modular code does not accidentally look modular
>   without suffering build breakage.
>   
>   Here we target code that is, by nature of their Kconfig settings, only
>   available to be built-in, but implicitly presenting itself as being
>   possibly modular by way of using modular headers, macros, and functions.
>   
>   The goal here is to remove that illusion of modularity from these
>   drivers, but in a way that leaves the actual runtime unchanged.
>   In doing so, we remove code that has never been tested and adds
>   no value to the tree.  And we begin the process of expecting a
>   level of consistency between the Kconfig of a driver and the code
>   that the driver uses.
>   
> Build tested for allyesconfig on x86_64, and ARM for lpc81xx, and powerpc
> for hvc_console and mpsc, layered onto tty/tty-next as a baseline.
> 
> Paul.
> 
> [1] https://lkml.kernel.org/r/1437530538-5078-1-git-send-email-paul.gortmaker at windriver.com
> --
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.com>
> Cc: Joachim Eastwood <manabian@gmail.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linuxppc-dev at lists.ozlabs.org
> Cc: linux-serial at vger.kernel.org
> 
> Paul Gortmaker (5):
>   drivers/tty: make pty.c slightly more explicitly non-modular
>   drivers/tty: make sysrq.c slightly more explicitly non-modular
>   drivers/tty: make hvc_console.c explicitly non-modular
>   drivers/tty: make serial/mpsc.c driver explicitly non-modular
>   drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate
> 
>  drivers/tty/hvc/hvc_console.c   | 18 +-----------------
>  drivers/tty/pty.c               |  7 +++++--
>  drivers/tty/serial/8250/Kconfig |  2 +-
>  drivers/tty/serial/mpsc.c       | 36 +++---------------------------------
>  drivers/tty/sysrq.c             |  6 +++++-
>  5 files changed, 15 insertions(+), 54 deletions(-)
> 
> -- 
> 2.5.0
> 

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

* Re: [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular
  2015-09-26 22:53   ` Paul Gortmaker
@ 2015-09-27 19:42     ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 22+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-27 19:42 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Jiri Slaby, Joachim Eastwood, linux-arm-kernel,
	linuxppc-dev, linux-serial

On Sat, Sep 26, 2015 at 06:53:47PM -0400, Paul Gortmaker wrote:
> [[PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular] On 19/08/2015 (Wed 17:48) Paul Gortmaker wrote:
> 
> > [v2: drop dead module code removal from 8250_lpc18xx.c ; instead convert it
> >  from bool to tristate ; also add ack to hvc_console commit.]
> > 
> > This second set of patches to drivers/tty steps outside of the serial
> > dir, and an improved auditing finds two more serial drivers pretending
> > to be modular that really are not.
> 
> Hi Greg -- wondering if this is still in your to-do queue.  I see the
> patches to drivers/char that I sent about the same time made it onto
> your char-testing branch but not these onto tty-testing.

Yes, they are in my queue, haven't caught up with tty patches yet :(

> The reason I ask is that I've about a 1/2 dozen more similar patches
> that showed up once I started auditing non-x86 code.  I don't want to
> re-spam you with these along with the new ones, if these are still in
> your backlog for processing.

I can handle resends and other patches just fine, send away!

thanks,

greg k-h

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

* [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular
@ 2015-09-27 19:42     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 22+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-27 19:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Sep 26, 2015 at 06:53:47PM -0400, Paul Gortmaker wrote:
> [[PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular] On 19/08/2015 (Wed 17:48) Paul Gortmaker wrote:
> 
> > [v2: drop dead module code removal from 8250_lpc18xx.c ; instead convert it
> >  from bool to tristate ; also add ack to hvc_console commit.]
> > 
> > This second set of patches to drivers/tty steps outside of the serial
> > dir, and an improved auditing finds two more serial drivers pretending
> > to be modular that really are not.
> 
> Hi Greg -- wondering if this is still in your to-do queue.  I see the
> patches to drivers/char that I sent about the same time made it onto
> your char-testing branch but not these onto tty-testing.

Yes, they are in my queue, haven't caught up with tty patches yet :(

> The reason I ask is that I've about a 1/2 dozen more similar patches
> that showed up once I started auditing non-x86 code.  I don't want to
> re-spam you with these along with the new ones, if these are still in
> your backlog for processing.

I can handle resends and other patches just fine, send away!

thanks,

greg k-h

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

* Re: [PATCH 4/5] drivers/tty: make serial/mpsc.c driver explicitly non-modular
  2015-08-19 21:48   ` Paul Gortmaker
  (?)
@ 2015-10-09 13:38   ` Thierry Reding
  2015-10-10 19:18       ` Paul Gortmaker
  -1 siblings, 1 reply; 22+ messages in thread
From: Thierry Reding @ 2015-10-09 13:38 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: linux-kernel, Greg Kroah-Hartman, Jiri Slaby, linux-serial

[-- Attachment #1: Type: text/plain, Size: 2236 bytes --]

On Wed, Aug 19, 2015 at 05:48:08PM -0400, Paul Gortmaker wrote:
> The Kconfig for this driver is currently:
> 
> config SERIAL_MPSC
>         bool "Marvell MPSC 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.
> 
> Since module_init translates to device_initcall in the non-modular
> case, the init ordering remains unchanged with this commit.
> 
> We leave some tags like MODULE_AUTHOR for documentation purposes.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.com>
> Cc: linux-serial@vger.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/tty/serial/mpsc.c | 36 +++---------------------------------
>  1 file changed, 3 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c
> index 82bb6d1fe23b..edb32e3f1e84 100644
> --- a/drivers/tty/serial/mpsc.c
> +++ b/drivers/tty/serial/mpsc.c
> @@ -55,8 +55,6 @@
>  #define SUPPORT_SYSRQ
>  #endif
>  
> -#include <linux/module.h>
> -#include <linux/moduleparam.h>
>  #include <linux/tty.h>
>  #include <linux/tty_flip.h>
>  #include <linux/ioport.h>
> @@ -2108,24 +2106,8 @@ static int mpsc_drv_probe(struct platform_device *dev)
>  	return rc;
>  }
>  
> -static int mpsc_drv_remove(struct platform_device *dev)
> -{
> -	pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
> -
> -	if (dev->id < MPSC_NUM_CTLRS) {
> -		uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
> -		mpsc_release_port((struct uart_port *)
> -				&mpsc_ports[dev->id].port);
> -		mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
> -		return 0;
> -	} else {
> -		return -ENODEV;
> -	}
> -}
> -
>  static struct platform_driver mpsc_driver = {
>  	.probe	= mpsc_drv_probe,
> -	.remove	= mpsc_drv_remove,
>  	.driver	= {
>  		.name	= MPSC_CTLR_NAME,
>  	},

I don't think this is right. The driver can always be unbound from the
device via sysfs, in which case it will now leak resources and leave
behind a dangling UART port.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 4/5] drivers/tty: make serial/mpsc.c driver explicitly non-modular
  2015-10-09 13:38   ` Thierry Reding
@ 2015-10-10 19:18       ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-10-10 19:18 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-kernel, Greg Kroah-Hartman, Jiri Slaby, linux-serial

[Re: [PATCH 4/5] drivers/tty: make serial/mpsc.c driver explicitly non-modular] On 09/10/2015 (Fri 15:38) Thierry Reding wrote:

> On Wed, Aug 19, 2015 at 05:48:08PM -0400, Paul Gortmaker wrote:

[...]

> >  static struct platform_driver mpsc_driver = {
> >  	.probe	= mpsc_drv_probe,
> > -	.remove	= mpsc_drv_remove,
> >  	.driver	= {
> >  		.name	= MPSC_CTLR_NAME,
> >  	},
> 
> I don't think this is right. The driver can always be unbound from the
> device via sysfs, in which case it will now leak resources and leave
> behind a dangling UART port.

I suppose it does open the window for root to do something else stupid
he shouldn't be doing anyway...

I think the right thing to do here is for me to send a follow on patch
that does also set:

	.suppress_bind_attrs = true

in the above block, since this is a console device used on 2005 vintage
74xx based powerpc embedded targets, and is essentially always used in
conjunction with SERIAL_MPSC_CONSOLE=y -- there is no sane reason anyone
would ever want to unbind the builtin driver and lose the console.

I'll send a follow on patch doing the above if folks are in agreement
with the above logic.

Thanks,
Paul.
--

> 
> Thierry



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

* Re: [PATCH 4/5] drivers/tty: make serial/mpsc.c driver explicitly non-modular
@ 2015-10-10 19:18       ` Paul Gortmaker
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Gortmaker @ 2015-10-10 19:18 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-kernel, Greg Kroah-Hartman, Jiri Slaby, linux-serial

[Re: [PATCH 4/5] drivers/tty: make serial/mpsc.c driver explicitly non-modular] On 09/10/2015 (Fri 15:38) Thierry Reding wrote:

> On Wed, Aug 19, 2015 at 05:48:08PM -0400, Paul Gortmaker wrote:

[...]

> >  static struct platform_driver mpsc_driver = {
> >  	.probe	= mpsc_drv_probe,
> > -	.remove	= mpsc_drv_remove,
> >  	.driver	= {
> >  		.name	= MPSC_CTLR_NAME,
> >  	},
> 
> I don't think this is right. The driver can always be unbound from the
> device via sysfs, in which case it will now leak resources and leave
> behind a dangling UART port.

I suppose it does open the window for root to do something else stupid
he shouldn't be doing anyway...

I think the right thing to do here is for me to send a follow on patch
that does also set:

	.suppress_bind_attrs = true

in the above block, since this is a console device used on 2005 vintage
74xx based powerpc embedded targets, and is essentially always used in
conjunction with SERIAL_MPSC_CONSOLE=y -- there is no sane reason anyone
would ever want to unbind the builtin driver and lose the console.

I'll send a follow on patch doing the above if folks are in agreement
with the above logic.

Thanks,
Paul.
--

> 
> Thierry

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

end of thread, other threads:[~2015-10-10 19:18 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-19 21:48 [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular Paul Gortmaker
2015-08-19 21:48 ` Paul Gortmaker
2015-08-19 21:48 ` Paul Gortmaker
2015-08-19 21:48 ` [PATCH 1/5] drivers/tty: make pty.c slightly more " Paul Gortmaker
2015-08-19 21:48 ` [PATCH 2/5] drivers/tty: make sysrq.c " Paul Gortmaker
2015-08-19 21:48 ` [PATCH 3/5] drivers/tty: make hvc_console.c " Paul Gortmaker
2015-08-19 21:48 ` [PATCH 4/5] drivers/tty: make serial/mpsc.c driver " Paul Gortmaker
2015-08-19 21:48   ` Paul Gortmaker
2015-10-09 13:38   ` Thierry Reding
2015-10-10 19:18     ` Paul Gortmaker
2015-10-10 19:18       ` Paul Gortmaker
2015-08-19 21:48 ` [PATCH 5/5] drivers/tty: make serial 8250_lpc18xx.c Kconfig a tristate Paul Gortmaker
2015-08-19 21:48   ` Paul Gortmaker
2015-08-19 21:48   ` Paul Gortmaker
2015-08-20  6:58   ` Joachim Eastwood
2015-08-20  6:58     ` Joachim Eastwood
2015-08-20  6:58     ` Joachim Eastwood
2015-09-26 22:53 ` [PATCH v2 0/5] drivers/tty: make more bool drivers explicitly non-modular Paul Gortmaker
2015-09-26 22:53   ` Paul Gortmaker
2015-09-26 22:53   ` Paul Gortmaker
2015-09-27 19:42   ` Greg Kroah-Hartman
2015-09-27 19:42     ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.