Skip to content

Commit 166ac2b

Browse files
andy-shevgregkh
authored andcommitted
serial: port: Assign ->iotype correctly when ->iobase is set
Currently the ->iotype is always assigned to the UPIO_MEM when the respective property is not found. However, this will not support the cases when user wants to have UPIO_PORT to be set or preserved. Support this scenario by checking ->iobase value and default the ->iotype respectively. Fixes: 1117a6f ("serial: 8250_of: Switch to use uart_read_port_properties()") Fixes: e894b60 ("serial: port: Introduce a common helper to read properties") Cc: stable <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e8ed246 commit 166ac2b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/tty/serial/serial_port.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ EXPORT_SYMBOL(uart_remove_one_port);
173173
* The caller is responsible to initialize the following fields of the @port
174174
* ->dev (must be valid)
175175
* ->flags
176+
* ->iobase
176177
* ->mapbase
177178
* ->mapsize
178179
* ->regshift (if @use_defaults is false)
@@ -214,7 +215,7 @@ static int __uart_read_properties(struct uart_port *port, bool use_defaults)
214215
/* Read the registers I/O access type (default: MMIO 8-bit) */
215216
ret = device_property_read_u32(dev, "reg-io-width", &value);
216217
if (ret) {
217-
port->iotype = UPIO_MEM;
218+
port->iotype = port->iobase ? UPIO_PORT : UPIO_MEM;
218219
} else {
219220
switch (value) {
220221
case 1:

0 commit comments

Comments
 (0)