From: Andy Shevchenko Date: Fri, 21 Mar 2025 18:20:14 +0000 (+0200) Subject: serial: 8250_ni: Switch to use platform_get_mem_or_io() X-Git-Tag: v6.16-rc1~29^2~103 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=b4694a76180b71cc4040c3c9ab75ea0058b6cc3a;p=linux-block.git serial: 8250_ni: Switch to use platform_get_mem_or_io() Switch to use new platform_get_mem_or_io() instead of home grown analogue. Signed-off-by: Andy Shevchenko Tested-by: Chaitanya Vadrevu Reviewed-by: Chaitanya Vadrevu Link: https://lore.kernel.org/r/20250321182119.454507-4-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/8250/8250_ni.c b/drivers/tty/serial/8250/8250_ni.c index 562f7f29e209..2dc510c0a5ef 100644 --- a/drivers/tty/serial/8250/8250_ni.c +++ b/drivers/tty/serial/8250/8250_ni.c @@ -224,26 +224,26 @@ static int ni16550_get_regs(struct platform_device *pdev, { struct resource *regs; - regs = platform_get_resource(pdev, IORESOURCE_IO, 0); - if (regs) { + regs = platform_get_mem_or_io(pdev, 0); + if (!regs) + return dev_err_probe(&pdev->dev, -EINVAL, "no registers defined\n"); + + switch (resource_type(regs)) { + case IORESOURCE_IO: port->iotype = UPIO_PORT; port->iobase = regs->start; return 0; - } - - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (regs) { + case IORESOURCE_MEM: port->iotype = UPIO_MEM; port->mapbase = regs->start; port->mapsize = resource_size(regs); port->flags |= UPF_IOREMAP; return 0; + default: + return -EINVAL; } - - dev_err(&pdev->dev, "no registers defined\n"); - return -EINVAL; } /*