2013-10-31 11:09:36

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 0/5] Remove remaining instances of devm_request_and_ioremap

devm_request_and_ioremap is now obsolete and is replaced by
devm_ioremap_resource. Update the remaining places where
devm_request_and_ioremap is still used and remove its definition.

The patches are based on next-20131030.

Tushar Behera (5):
MIPS: ralink: Use devm_ioremap_resource
DRM: Armada: Use devm_ioremap_resource
iommu/arm-smmu: Use devm_ioremap_resource
watchdog: ralink: Use devm_ioremap_resource
lib: devres: Remove deprecated devm_request_and_ioremap

Documentation/driver-model/devres.txt | 1 -
arch/mips/ralink/timer.c | 2 +-
drivers/gpu/drm/armada/armada_crtc.c | 8 +++-----
drivers/iommu/arm-smmu.c | 6 +++---
drivers/watchdog/rt2880_wdt.c | 2 +-
include/linux/device.h | 2 --
lib/devres.c | 28 ----------------------------
7 files changed, 8 insertions(+), 41 deletions(-)

CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: David Airlie <[email protected]>
CC: Greg Kroah-Hartman <[email protected]>
CC: Joerg Roedel <[email protected]>
CC: John Crispin <[email protected]>
CC: Ralf Baechle <[email protected]>
CC: Rob Landley <[email protected]>
CC: Russell King <[email protected]>
CC: Will Deacon <[email protected]>
CC: Wim Van Sebroeck <[email protected]>

--
1.7.9.5


2013-10-31 11:09:37

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 1/5] MIPS: ralink: Use devm_ioremap_resource

Signed-off-by: Tushar Behera <[email protected]>
CC: [email protected]
CC: John Crispin <[email protected]>
CC: Ralf Baechle <[email protected]>
---
arch/mips/ralink/timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c
index e49241a..2027857 100644
--- a/arch/mips/ralink/timer.c
+++ b/arch/mips/ralink/timer.c
@@ -126,7 +126,7 @@ static int rt_timer_probe(struct platform_device *pdev)
return -ENOENT;
}

- rt->membase = devm_request_and_ioremap(&pdev->dev, res);
+ rt->membase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rt->membase))
return PTR_ERR(rt->membase);

--
1.7.9.5

2013-10-31 11:09:42

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 2/5] DRM: Armada: Use devm_ioremap_resource

While at it, propagate the error code.

Signed-off-by: Tushar Behera <[email protected]>
CC: [email protected]
CC: Russell King <[email protected]>
CC: David Airlie <[email protected]>
---
drivers/gpu/drm/armada/armada_crtc.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index d8e3982..2b6e7b7 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -1037,11 +1037,9 @@ int armada_drm_crtc_create(struct drm_device *dev, unsigned num,
if (ret)
return ret;

- base = devm_request_and_ioremap(dev->dev, res);
- if (!base) {
- DRM_ERROR("failed to ioremap register\n");
- return -ENOMEM;
- }
+ base = devm_ioremap_resource(dev->dev, res);
+ if (IS_ERR(base))
+ return PTR_ERR(base);

dcrtc = kzalloc(sizeof(*dcrtc), GFP_KERNEL);
if (!dcrtc) {
--
1.7.9.5

2013-10-31 11:09:48

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 4/5] watchdog: ralink: Use devm_ioremap_resource

Signed-off-by: Tushar Behera <[email protected]>
CC: [email protected]
CC: Wim Van Sebroeck <[email protected]>
---
drivers/watchdog/rt2880_wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/rt2880_wdt.c b/drivers/watchdog/rt2880_wdt.c
index a9f8491..53d37fe 100644
--- a/drivers/watchdog/rt2880_wdt.c
+++ b/drivers/watchdog/rt2880_wdt.c
@@ -144,7 +144,7 @@ static int rt288x_wdt_probe(struct platform_device *pdev)
int ret;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- rt288x_wdt_base = devm_request_and_ioremap(&pdev->dev, res);
+ rt288x_wdt_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rt288x_wdt_base))
return PTR_ERR(rt288x_wdt_base);

--
1.7.9.5

2013-10-31 11:10:03

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 5/5] lib: devres: Remove deprecated devm_request_and_ioremap

Now that all the users of devm_request_and_ioremap have been converted
to use devm_ioremap_resource, remove the definition.

Also remove the entries from Documentation.

Signed-off-by: Tushar Behera <[email protected]>
CC: [email protected]
CC: Rob Landley <[email protected]>
CC: Greg Kroah-Hartman <[email protected]>
---
Documentation/driver-model/devres.txt | 1 -
include/linux/device.h | 2 --
lib/devres.c | 28 ----------------------------
3 files changed, 31 deletions(-)

diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
index 5bdc8cb..7de1a54 100644
--- a/Documentation/driver-model/devres.txt
+++ b/Documentation/driver-model/devres.txt
@@ -273,7 +273,6 @@ IOMAP
devm_ioremap_nocache()
devm_iounmap()
devm_ioremap_resource() : checks resource, requests memory region, ioremaps
- devm_request_and_ioremap() : obsoleted by devm_ioremap_resource()
pcim_iomap()
pcim_iounmap()
pcim_iomap_table() : array of mapped addresses indexed by BAR
diff --git a/include/linux/device.h b/include/linux/device.h
index 5e44cff..54d74cf 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -628,8 +628,6 @@ static inline void *devm_kcalloc(struct device *dev,
extern void devm_kfree(struct device *dev, void *p);

void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
-void __iomem *devm_request_and_ioremap(struct device *dev,
- struct resource *res);

/* allows to add/remove a custom action to devres stack */
int devm_add_action(struct device *dev, void (*action)(void *), void *data);
diff --git a/lib/devres.c b/lib/devres.c
index 8235331..3ddb56d 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -140,34 +140,6 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res)
}
EXPORT_SYMBOL(devm_ioremap_resource);

-/**
- * devm_request_and_ioremap() - Check, request region, and ioremap resource
- * @dev: Generic device to handle the resource for
- * @res: resource to be handled
- *
- * Takes all necessary steps to ioremap a mem resource. Uses managed device, so
- * everything is undone on driver detach. Checks arguments, so you can feed
- * it the result from e.g. platform_get_resource() directly. Returns the
- * remapped pointer or NULL on error. Usage example:
- *
- * res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- * base = devm_request_and_ioremap(&pdev->dev, res);
- * if (!base)
- * return -EADDRNOTAVAIL;
- */
-void __iomem *devm_request_and_ioremap(struct device *device,
- struct resource *res)
-{
- void __iomem *dest_ptr;
-
- dest_ptr = devm_ioremap_resource(device, res);
- if (IS_ERR(dest_ptr))
- return NULL;
-
- return dest_ptr;
-}
-EXPORT_SYMBOL(devm_request_and_ioremap);
-
#ifdef CONFIG_HAS_IOPORT
/*
* Generic iomap devres
--
1.7.9.5

2013-10-31 11:09:45

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 3/5] iommu/arm-smmu: Use devm_ioremap_resource

While at it, propagate the error code.

Signed-off-by: Tushar Behera <[email protected]>
CC: [email protected]
CC: [email protected]
CC: Will Deacon <[email protected]>
CC: Joerg Roedel <[email protected]>
---
drivers/iommu/arm-smmu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 2349d62..fe275b3 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1790,9 +1790,9 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
}

smmu->size = resource_size(res);
- smmu->base = devm_request_and_ioremap(dev, res);
- if (!smmu->base)
- return -EADDRNOTAVAIL;
+ smmu->base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(smmu->base))
+ return PTR_ERR(smmu->base);

if (of_property_read_u32(dev->of_node, "#global-interrupts",
&smmu->num_global_irqs)) {
--
1.7.9.5

2013-10-31 15:12:47

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH 2/5] DRM: Armada: Use devm_ioremap_resource

On Thu, Oct 31, 2013 at 04:38:04PM +0530, Tushar Behera wrote:
> While at it, propagate the error code.
>
> Signed-off-by: Tushar Behera <[email protected]>
> CC: [email protected]
> CC: Russell King <[email protected]>
> CC: David Airlie <[email protected]>
> ---
> drivers/gpu/drm/armada/armada_crtc.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
> index d8e3982..2b6e7b7 100644
> --- a/drivers/gpu/drm/armada/armada_crtc.c
> +++ b/drivers/gpu/drm/armada/armada_crtc.c
> @@ -1037,11 +1037,9 @@ int armada_drm_crtc_create(struct drm_device *dev, unsigned num,
> if (ret)
> return ret;
>
> - base = devm_request_and_ioremap(dev->dev, res);
> - if (!base) {
> - DRM_ERROR("failed to ioremap register\n");
> - return -ENOMEM;
> - }
> + base = devm_ioremap_resource(dev->dev, res);
> + if (IS_ERR(base))
> + return PTR_ERR(base);

David,

Do you want to take this directly, or shall I and send you another pull?
I have a few other minor patches for armada as well (implementing the
lastclose callback, and destroying the framebuffer associated with the
fb helper only after the fb helper has been finalised.

Thanks.

2013-10-31 16:00:17

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH 3/5] iommu/arm-smmu: Use devm_ioremap_resource

On Thu, Oct 31, 2013 at 11:08:05AM +0000, Tushar Behera wrote:
> While at it, propagate the error code.

Thanks, but I already have an equivalent patch queued which Joerg is going
to pull real soon now (right, Joerg? :p).

Will