Commit 7331205a authored by Thierry Reding's avatar Thierry Reding Committed by Greg Kroah-Hartman

dma: Convert to devm_ioremap_resource()

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: default avatarThierry Reding <thierry.reding@avionic-design.de>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 93316e26
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -1489,9 +1490,9 @@ static int dw_probe(struct platform_device *pdev) ...@@ -1489,9 +1490,9 @@ static int dw_probe(struct platform_device *pdev)
if (irq < 0) if (irq < 0)
return irq; return irq;
regs = devm_request_and_ioremap(&pdev->dev, io); regs = devm_ioremap_resource(&pdev->dev, io);
if (!regs) if (IS_ERR(regs))
return -EBUSY; return PTR_ERR(regs);
dw_params = dma_read_byaddr(regs, DW_PARAMS); dw_params = dma_read_byaddr(regs, DW_PARAMS);
autocfg = dw_params >> DW_PARAMS_EN & 0x1; autocfg = dw_params >> DW_PARAMS_EN & 0x1;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* http://www.opensource.org/licenses/gpl-license.html * http://www.opensource.org/licenses/gpl-license.html
* http://www.gnu.org/copyleft/gpl.html * http://www.gnu.org/copyleft/gpl.html
*/ */
#include <linux/err.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -1011,9 +1012,9 @@ static int __init imxdma_probe(struct platform_device *pdev) ...@@ -1011,9 +1012,9 @@ static int __init imxdma_probe(struct platform_device *pdev)
imxdma->devtype = pdev->id_entry->driver_data; imxdma->devtype = pdev->id_entry->driver_data;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
imxdma->base = devm_request_and_ioremap(&pdev->dev, res); imxdma->base = devm_ioremap_resource(&pdev->dev, res);
if (!imxdma->base) if (IS_ERR(imxdma->base))
return -EADDRNOTAVAIL; return PTR_ERR(imxdma->base);
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) if (irq < 0)
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/err.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -782,9 +783,9 @@ static int mmp_pdma_probe(struct platform_device *op) ...@@ -782,9 +783,9 @@ static int mmp_pdma_probe(struct platform_device *op)
if (!iores) if (!iores)
return -EINVAL; return -EINVAL;
pdev->base = devm_request_and_ioremap(pdev->dev, iores); pdev->base = devm_ioremap_resource(pdev->dev, iores);
if (!pdev->base) if (IS_ERR(pdev->base))
return -EADDRNOTAVAIL; return PTR_ERR(pdev->base);
of_id = of_match_device(mmp_pdma_dt_ids, pdev->dev); of_id = of_match_device(mmp_pdma_dt_ids, pdev->dev);
if (of_id) if (of_id)
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* *
*/ */
#include <linux/err.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -547,9 +548,9 @@ static int mmp_tdma_probe(struct platform_device *pdev) ...@@ -547,9 +548,9 @@ static int mmp_tdma_probe(struct platform_device *pdev)
if (!iores) if (!iores)
return -EINVAL; return -EINVAL;
tdev->base = devm_request_and_ioremap(&pdev->dev, iores); tdev->base = devm_ioremap_resource(&pdev->dev, iores);
if (!tdev->base) if (IS_ERR(tdev->base))
return -EADDRNOTAVAIL; return PTR_ERR(tdev->base);
INIT_LIST_HEAD(&tdev->device.channels); INIT_LIST_HEAD(&tdev->device.channels);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -1236,12 +1237,9 @@ static int tegra_dma_probe(struct platform_device *pdev) ...@@ -1236,12 +1237,9 @@ static int tegra_dma_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
tdma->base_addr = devm_request_and_ioremap(&pdev->dev, res); tdma->base_addr = devm_ioremap_resource(&pdev->dev, res);
if (!tdma->base_addr) { if (IS_ERR(tdma->base_addr))
dev_err(&pdev->dev, return PTR_ERR(tdma->base_addr);
"Cannot request memregion/iomap dma address\n");
return -EADDRNOTAVAIL;
}
tdma->dma_clk = devm_clk_get(&pdev->dev, NULL); tdma->dma_clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(tdma->dma_clk)) { if (IS_ERR(tdma->dma_clk)) {
......
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