Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: 8250_ingenic: Switch to use platform_get_irq()

platform_get_irq() provides an established error code and error message.
Also, it's better to use dedicated API to retrieve Linux IRQ resource.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200618123320.88612-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
451a73c6 e914072c

+10 -6
+10 -6
drivers/tty/serial/8250/8250_ingenic.c
··· 207 207 static int ingenic_uart_probe(struct platform_device *pdev) 208 208 { 209 209 struct uart_8250_port uart = {}; 210 - struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 211 - struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 212 210 struct ingenic_uart_data *data; 213 211 const struct ingenic_uart_config *cdata; 214 212 const struct of_device_id *match; 215 - int err, line; 213 + struct resource *regs; 214 + int irq, err, line; 216 215 217 216 match = of_match_device(of_match, &pdev->dev); 218 217 if (!match) { ··· 220 221 } 221 222 cdata = match->data; 222 223 223 - if (!regs || !irq) { 224 - dev_err(&pdev->dev, "no registers/irq defined\n"); 224 + irq = platform_get_irq(pdev, 0); 225 + if (irq < 0) 226 + return irq; 227 + 228 + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 229 + if (!regs) { 230 + dev_err(&pdev->dev, "no registers defined\n"); 225 231 return -EINVAL; 226 232 } 227 233 ··· 242 238 uart.port.regshift = 2; 243 239 uart.port.serial_out = ingenic_uart_serial_out; 244 240 uart.port.serial_in = ingenic_uart_serial_in; 245 - uart.port.irq = irq->start; 241 + uart.port.irq = irq; 246 242 uart.port.dev = &pdev->dev; 247 243 uart.port.fifosize = cdata->fifosize; 248 244 uart.tx_loadsz = cdata->tx_loadsz;