serial: uniformize serial port I/O infos display

Uniformize serial port I/O infos display from three different functions
that display mostly the same information, but with some variations, by
adding a common function.

This make use of new functions uart_iotype_mmio() and
uart_iotype_legacy_io() to simplify and improve code readability.
This will prevent displaying irrelevant information for future IO types
(ex: UPIO_BUS), while also addressing the (eventually) invalid check for
"iotype >= UPIO_MEM".

This also allows us to remove the confusing cast to (unsigned long long)
for iobase which is defined as an unsigned long, and use %pa to display the
mapbase pointer, as it is done in earlycon_print_info().

Replace snprintf with more robust scnprintf so we could perhaps one day get
rid of snprintf() entirely.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://patch.msgid.link/20260521-tty-upio-v3-4-bf74567994a0@dimonoff.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Hugo Villeneuve 2026-05-21 14:16:50 -04:00 • committed by Greg Kroah-Hartman
commit 86305190f3
3 changed files with 43 additions and 43 deletions