From 3bd69ad077a955b469baa90d938fd83510297335 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 18 Feb 2016 11:38:58 +0100 Subject: driver: replace dev_request_mem_region with dev_request_mem_resource dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // Signed-off-by: Sascha Hauer --- drivers/dma/apbh_dma.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/dma') diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c index bd0017b6c1..64f4326514 100644 --- a/drivers/dma/apbh_dma.c +++ b/drivers/dma/apbh_dma.c @@ -588,6 +588,7 @@ int mxs_dma_go(int chan) */ static int apbh_dma_probe(struct device_d *dev) { + struct resource *iores; struct apbh_dma *apbh; struct mxs_dma_chan *pchan; enum mxs_dma_id id; @@ -598,9 +599,10 @@ static int apbh_dma_probe(struct device_d *dev) return ret; apbh_dma = apbh = xzalloc(sizeof(*apbh)); - apbh->regs = dev_request_mem_region(dev, 0); - if (IS_ERR(apbh->regs)) - return PTR_ERR(apbh->regs); + iores = dev_request_mem_resource(dev, 0); + if (IS_ERR(iores)) + return PTR_ERR(iores); + apbh->regs = IOMEM(iores->start); apbh->id = id; -- cgit v1.2.3