Re: [PATCH 2/2] serial: pl011: Move uart_register_driver call to device probe

From: One Thousand Gnomes
Date: Mon Feb 17 2014 - 10:55:32 EST


And an even simpler broad brush approach will also work I think (untested)

The "zero crap" approach....

commit c5cd0be0576ba9059799ef5383402ff6ffc212a3
Author: Alan <gnomes@xxxxxxxxxxxxxxxxxxx>
Date: Mon Feb 17 15:52:21 2014 +0000

tty: Allow serial port allocations to be fully dynamic

This switch allows platforms to make their serial port allocations entirely
dynamic as is needed on some non-x86 platforms which have overlapping static
minor numbers between some of their devices.

Default to the old static allocations for maximum compatibility with ancient
userspace.

Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxx>

diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index 65cd80b..670c076 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -166,6 +166,16 @@ config LEGACY_PTY_COUNT
When not in use, each legacy PTY occupies 12 bytes on 32-bit
architectures and 24 bytes on 64-bit architectures.

+config TTY_SERIAL_LEGACY
+ bool "Allocate legacy fixed minor numbers for serial ports"
+ default y
+ ---help---
+ Modern linux dynamically allocates device numbers. Some very old
+ Linux distributions only support static device numbering.
+ Selecting this option will enable support for very old
+ userspace but on some non PC architectures may prevent you building
+ a single kernel for multiple machines.
+
config BFIN_JTAG_COMM
tristate "Blackfin JTAG Communication"
depends on BLACKFIN
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index ece2049..b78afc1 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2315,8 +2315,10 @@ int uart_register_driver(struct uart_driver *drv)

normal->driver_name = drv->driver_name;
normal->name = drv->dev_name;
+#ifdef CONFIG_TTY_SERIAL_LEGACY
normal->major = drv->major;
normal->minor_start = drv->minor;
+#endif
normal->type = TTY_DRIVER_TYPE_SERIAL;
normal->subtype = SERIAL_TYPE_NORMAL;
normal->init_termios = tty_std_termios;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/