linux-mips
[Top] [All Lists]

[PATCH 03/33] MIPS: Convert to devm_ioremap_resource()

To: linux-kernel@vger.kernel.org
Subject: [PATCH 03/33] MIPS: Convert to devm_ioremap_resource()
From: Thierry Reding <thierry.reding@avionic-design.de>
Date: Mon, 21 Jan 2013 11:08:56 +0100
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Dmitry Torokhov <dmitry.torokhov@gmail.com>, Arnd Bergmann <arnd@arndb.de>, Wolfram Sang <w.sang@pengutronix.de>, Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
In-reply-to: <1358762966-20791-1-git-send-email-thierry.reding@avionic-design.de>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1358762966-20791-1-git-send-email-thierry.reding@avionic-design.de>
Sender: linux-mips-bounce@linux-mips.org
Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() 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: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/lantiq/xway/dma.c  |  5 +++--
 arch/mips/lantiq/xway/gptu.c |  8 +++-----
 arch/mips/pci/pci-lantiq.c   | 12 ++++++------
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c
index e44a186..08f7ebd 100644
--- a/arch/mips/lantiq/xway/dma.c
+++ b/arch/mips/lantiq/xway/dma.c
@@ -21,6 +21,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/clk.h>
+#include <linux/err.h>
 
 #include <lantiq_soc.h>
 #include <xway_dma.h>
@@ -223,8 +224,8 @@ ltq_dma_init(struct platform_device *pdev)
                panic("Failed to get dma resource");
 
        /* remap dma register range */
-       ltq_dma_membase = devm_request_and_ioremap(&pdev->dev, res);
-       if (!ltq_dma_membase)
+       ltq_dma_membase = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(ltq_dma_membase))
                panic("Failed to remap dma resource");
 
        /* power up and reset the dma engine */
diff --git a/arch/mips/lantiq/xway/gptu.c b/arch/mips/lantiq/xway/gptu.c
index e30b1ed..9861c86 100644
--- a/arch/mips/lantiq/xway/gptu.c
+++ b/arch/mips/lantiq/xway/gptu.c
@@ -150,11 +150,9 @@ static int gptu_probe(struct platform_device *pdev)
        }
 
        /* remap gptu register range */
-       gptu_membase = devm_request_and_ioremap(&pdev->dev, res);
-       if (!gptu_membase) {
-               dev_err(&pdev->dev, "Failed to remap resource\n");
-               return -ENOMEM;
-       }
+       gptu_membase = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(gptu_membase))
+               return PTR_ERR(gptu_membase);
 
        /* enable our clock */
        clk = clk_get(&pdev->dev, NULL);
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index 9568178..910fb4c 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -214,13 +214,13 @@ static int ltq_pci_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       ltq_pci_membase = devm_request_and_ioremap(&pdev->dev, res_bridge);
-       ltq_pci_mapped_cfg = devm_request_and_ioremap(&pdev->dev, res_cfg);
+       ltq_pci_membase = devm_ioremap_resource(&pdev->dev, res_bridge);
+       if (IS_ERR(ltq_pci_membase))
+               return PTR_ERR(ltq_pci_membase);
 
-       if (!ltq_pci_membase || !ltq_pci_mapped_cfg) {
-               dev_err(&pdev->dev, "failed to remap resources\n");
-               return -ENOMEM;
-       }
+       ltq_pci_mapped_cfg = devm_ioremap_resource(&pdev->dev, res_cfg);
+       if (IS_ERR(ltq_pci_mapped_cfg))
+               return PTR_ERR(ltq_pci_mapped_cfg);
 
        ltq_pci_startup(pdev);
 
-- 
1.8.1.1


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 03/33] MIPS: Convert to devm_ioremap_resource(), Thierry Reding <=