Commit 3abeff77 authored by Julia Lawall's avatar Julia Lawall Committed by Greg Kroah-Hartman

serial: st-asc: replace devm_request_and_ioremap by devm_ioremap_resource

Use devm_ioremap_resource instead of devm_request_and_ioremap.

This was done using the semantic patch
scripts/coccinelle/api/devm_ioremap_resource.cocci
and various manual modifications to move associated calls to
platform_get_resource closer to the resulting call to devm_ioremap_resource
and to remove the associated error handling code.

The initialization of port->mapbase is also moved lower, to take advantage
of the NULL test on res performed by devm_ioremap_resource.
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 33acbb82
...@@ -665,26 +665,20 @@ static int asc_init_port(struct asc_port *ascport, ...@@ -665,26 +665,20 @@ static int asc_init_port(struct asc_port *ascport,
struct platform_device *pdev) struct platform_device *pdev)
{ {
struct uart_port *port = &ascport->port; struct uart_port *port = &ascport->port;
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res;
if (!res) {
dev_err(&pdev->dev, "Unable to get io resource\n");
return -ENODEV;
}
port->iotype = UPIO_MEM; port->iotype = UPIO_MEM;
port->flags = UPF_BOOT_AUTOCONF; port->flags = UPF_BOOT_AUTOCONF;
port->ops = &asc_uart_ops; port->ops = &asc_uart_ops;
port->fifosize = ASC_FIFO_SIZE; port->fifosize = ASC_FIFO_SIZE;
port->dev = &pdev->dev; port->dev = &pdev->dev;
port->mapbase = res->start;
port->irq = platform_get_irq(pdev, 0); port->irq = platform_get_irq(pdev, 0);
port->membase = devm_request_and_ioremap(&pdev->dev, res); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!port->membase) { port->membase = devm_ioremap_resource(&pdev->dev, res);
dev_err(&pdev->dev, "Unable to request io memory\n"); if (IS_ERR(port->membase))
return -ENODEV; return PTR_ERR(port->membase);
} port->mapbase = res->start;
spin_lock_init(&port->lock); spin_lock_init(&port->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment