diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2013-08-19 07:20:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-19 20:12:21 -0400 |
commit | 3abeff77c8e2d2ac494021a7ee12892b6136381c (patch) | |
tree | 4c7501627a3359ecf2976450826a487570b70fa8 | |
parent | 33acbb82695f84e9429c1f7fbdeb4588dea12ffa (diff) |
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: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/st-asc.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index 2ff4b1bb922d..4f5caa38e3dc 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c | |||
@@ -665,26 +665,20 @@ static int asc_init_port(struct asc_port *ascport, | |||
665 | struct platform_device *pdev) | 665 | struct platform_device *pdev) |
666 | { | 666 | { |
667 | struct uart_port *port = &ascport->port; | 667 | struct uart_port *port = &ascport->port; |
668 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 668 | struct resource *res; |
669 | |||
670 | if (!res) { | ||
671 | dev_err(&pdev->dev, "Unable to get io resource\n"); | ||
672 | return -ENODEV; | ||
673 | } | ||
674 | 669 | ||
675 | port->iotype = UPIO_MEM; | 670 | port->iotype = UPIO_MEM; |
676 | port->flags = UPF_BOOT_AUTOCONF; | 671 | port->flags = UPF_BOOT_AUTOCONF; |
677 | port->ops = &asc_uart_ops; | 672 | port->ops = &asc_uart_ops; |
678 | port->fifosize = ASC_FIFO_SIZE; | 673 | port->fifosize = ASC_FIFO_SIZE; |
679 | port->dev = &pdev->dev; | 674 | port->dev = &pdev->dev; |
680 | port->mapbase = res->start; | ||
681 | port->irq = platform_get_irq(pdev, 0); | 675 | port->irq = platform_get_irq(pdev, 0); |
682 | 676 | ||
683 | port->membase = devm_request_and_ioremap(&pdev->dev, res); | 677 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
684 | if (!port->membase) { | 678 | port->membase = devm_ioremap_resource(&pdev->dev, res); |
685 | dev_err(&pdev->dev, "Unable to request io memory\n"); | 679 | if (IS_ERR(port->membase)) |
686 | return -ENODEV; | 680 | return PTR_ERR(port->membase); |
687 | } | 681 | port->mapbase = res->start; |
688 | 682 | ||
689 | spin_lock_init(&port->lock); | 683 | spin_lock_init(&port->lock); |
690 | 684 | ||