Re: [PATCH v2 2/2] serial: tegra: Convert to devm_ioremap_resource()

From: Thierry Reding
Date: Fri Feb 01 2013 - 06:24:44 EST


On Fri, Feb 01, 2013 at 03:37:57PM +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() which provides more consistent error handling.
>
> devm_ioremap_resource() provides its own error messages; so all explicit
> error messages can be removed from the failure code paths.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
> Cc: Laxman Dewangan <ldewangan@xxxxxxxxxx>
> Cc: linux-serial@xxxxxxxxxxxxxxx
> ---
> Patch based & compile tested on linux-next tree (20130128).
> Changes since v1:
> * Dropped the error message as it is now handled by devm_ioremap_resource()
> itself.
> ---
> drivers/tty/serial/serial-tegra.c | 9 ++++-----
> 1 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
> index 4f5e629..24ced23 100644
> --- a/drivers/tty/serial/serial-tegra.c
> +++ b/drivers/tty/serial/serial-tegra.c
> @@ -26,6 +26,7 @@
> #include <linux/dmaengine.h>
> #include <linux/dma-mapping.h>
> #include <linux/dmapool.h>
> +#include <linux/err.h>
> #include <linux/io.h>
> #include <linux/irq.h>
> #include <linux/module.h>
> @@ -1302,11 +1303,9 @@ static int tegra_uart_probe(struct platform_device *pdev)
> }
>
> u->mapbase = resource->start;
> - u->membase = devm_request_and_ioremap(&pdev->dev, resource);
> - if (!u->membase) {
> - dev_err(&pdev->dev, "memregion/iomap address req failed\n");
> - return -EADDRNOTAVAIL;
> - }
> + u->membase = devm_ioremap_resource(&pdev->dev, resource);
> + if (IS_ERR(u->membase))
> + return PTR_ERR(u->membase);
>
> tup->uart_clk = devm_clk_get(&pdev->dev, NULL);
> if (IS_ERR(tup->uart_clk)) {

Reviewed-by: Thierry Reding <thierry.reding@xxxxxxxxxxxxxxxxx>

Attachment: pgp00000.pgp
Description: PGP signature