serial: 8250: Allow using ports higher than SERIAL_8250_RUNTIME_UARTS
authorTony Lindgren <tony@atomide.com>
Mon, 8 May 2023 11:19:02 +0000 (14:19 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 May 2023 10:35:39 +0000 (19:35 +0900)
commit9d86719f8769244dc99b8cb6091c41eae3fd684f
tree838753645c4aa0edccbb1dd92d35da07dc3b4f6d
parentdb86bb6ed4979ed8a987057f9098ea88f85e48be
serial: 8250: Allow using ports higher than SERIAL_8250_RUNTIME_UARTS

We already allocate CONFIG_SERIAL_8250_NR_UARTS, but only allow using
CONFIG_SERIAL_8250_RUNTIME_UARTS uarts unless nr_uarts module params
is set. This causes issues for using distro kernels on SoCs with a
large number of serial ports.

Let's allow up to CONFIG_SERIAL_8250_NR_UARTS instead. To do this, we init
the ports as needed if the initial uarts was too low. This way there's no
need to set the value for CONFIG_SERIAL_8250_RUNTIME_UARTS to some SoC
specific higher value. Typically the default value of 4 can be used as
set for legacy reasons.

Note that limiting the number of intial uarts still works as before
unless a serial console on a higher port is specified. In this case we
will increase the nr_ports up to the console port specified.

Suggested-by: Andrew Davis <afd@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20230508111903.39339-1-tony@atomide.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_core.c