serial: tty: uartlite: fix console setup
authorDaniel Mack <daniel@zonque.org>
Fri, 28 May 2021 13:33:20 +0000 (15:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:05:42 +0000 (16:05 +0200)
commit2f4e7363a998b28f0f6821f4312f402ab3e3f54b
treeff4ceaffd08e9e30132138d24d84f84fd8785299
parentdc9db4629210bec1c6fd6710c3b783b91641d9d2
serial: tty: uartlite: fix console setup

[ Upstream commit d157fca711ad42e75efef3444c83d2e1a17be27a ]

Remove the hack to assign the global console_port variable at probe time.
This assumption that cons->index is -1 is wrong for systems that specify
'console=' in the cmdline (or 'stdout-path' in dts). Hence, on such system
the actual console assignment is ignored, and the first UART that happens
to be probed is used as console instead.

Move the logic to console_setup() and map the console to the correct port
through the array of available ports instead.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Link: https://lore.kernel.org/r/20210528133321.1859346-1-daniel@zonque.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/uartlite.c