* [PATCH 0/7] replace devm_request_and_ioremap by devm_ioremap_resource @ 2013-08-19 11:20 Julia Lawall 2013-08-19 11:20 ` [PATCH 3/7] iommu/arm: " Julia Lawall 0 siblings, 1 reply; 4+ messages in thread From: Julia Lawall @ 2013-08-19 11:20 UTC (permalink / raw) To: linux-arm-kernel devm_request_and_ioremap has been replaced by devm_ioremap_resource, which gives more informative error return code information. This patch series removes the remaining uses of devm_request_and_ioremap. This patch series was generated using the semantic patch scripts/coccinelle/api/devm_ioremap_resource.cocci from the Linux kernel source tree. Manual modifications have been made to move associated calls to platform_get_resource closer to the resulting call to devm_ioremap_resource and to remove the associated error handling code. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/7] iommu/arm: replace devm_request_and_ioremap by devm_ioremap_resource 2013-08-19 11:20 [PATCH 0/7] replace devm_request_and_ioremap by devm_ioremap_resource Julia Lawall @ 2013-08-19 11:20 ` Julia Lawall 2013-08-20 11:35 ` Will Deacon 0 siblings, 1 reply; 4+ messages in thread From: Julia Lawall @ 2013-08-19 11:20 UTC (permalink / raw) To: linux-arm-kernel From: Julia Lawall <Julia.Lawall@lip6.fr> Use devm_ioremap_resource instead of devm_request_and_ioremap. This was partly done using the semantic patch scripts/coccinelle/api/devm_ioremap_resource.cocci The error-handling code on the call to platform_get_resource was removed manually, and the initialization of smmu->size was manually moved lower, to take advantage of the NULL test on res performed by devm_ioremap_resource. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/iommu/arm-smmu.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index ebd0a4c..dd91465 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1761,15 +1761,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) smmu->dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, "missing base address/size\n"); - return -ENODEV; - } - + smmu->base = devm_ioremap_resource(dev, res); + if (IS_ERR(smmu->base)) + return PTR_ERR(smmu->base); smmu->size = resource_size(res); - smmu->base = devm_request_and_ioremap(dev, res); - if (!smmu->base) - return -EADDRNOTAVAIL; if (of_property_read_u32(dev->of_node, "#global-interrupts", &smmu->num_global_irqs)) { ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/7] iommu/arm: replace devm_request_and_ioremap by devm_ioremap_resource 2013-08-19 11:20 ` [PATCH 3/7] iommu/arm: " Julia Lawall @ 2013-08-20 11:35 ` Will Deacon 2013-08-20 11:49 ` Julia Lawall 0 siblings, 1 reply; 4+ messages in thread From: Will Deacon @ 2013-08-20 11:35 UTC (permalink / raw) To: linux-arm-kernel Hi Julia, On Mon, Aug 19, 2013 at 12:20:37PM +0100, Julia Lawall wrote: > From: Julia Lawall <Julia.Lawall@lip6.fr> > > Use devm_ioremap_resource instead of devm_request_and_ioremap. > > This was partly done using the semantic patch > scripts/coccinelle/api/devm_ioremap_resource.cocci > > The error-handling code on the call to platform_get_resource was removed > manually, and the initialization of smmu->size was manually moved lower, to > take advantage of the NULL test on res performed by devm_ioremap_resource. > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> > > --- > drivers/iommu/arm-smmu.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index ebd0a4c..dd91465 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -1761,15 +1761,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) > smmu->dev = dev; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (!res) { > - dev_err(dev, "missing base address/size\n"); > - return -ENODEV; > - } > - > + smmu->base = devm_ioremap_resource(dev, res); > + if (IS_ERR(smmu->base)) > + return PTR_ERR(smmu->base); > smmu->size = resource_size(res); > - smmu->base = devm_request_and_ioremap(dev, res); > - if (!smmu->base) > - return -EADDRNOTAVAIL; This does mean we trade arguably more useful error codes for the catch-all -EINVAL, but the code ends up looking neater so I can be swayed either way. Is this part of a series you're dealing with, or would you like me to take this (I already sent my SMMU patches for 3.12)? Cheers, Will ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/7] iommu/arm: replace devm_request_and_ioremap by devm_ioremap_resource 2013-08-20 11:35 ` Will Deacon @ 2013-08-20 11:49 ` Julia Lawall 0 siblings, 0 replies; 4+ messages in thread From: Julia Lawall @ 2013-08-20 11:49 UTC (permalink / raw) To: linux-arm-kernel On Tue, 20 Aug 2013, Will Deacon wrote: > Hi Julia, > > On Mon, Aug 19, 2013 at 12:20:37PM +0100, Julia Lawall wrote: > > From: Julia Lawall <Julia.Lawall@lip6.fr> > > > > Use devm_ioremap_resource instead of devm_request_and_ioremap. > > > > This was partly done using the semantic patch > > scripts/coccinelle/api/devm_ioremap_resource.cocci > > > > The error-handling code on the call to platform_get_resource was removed > > manually, and the initialization of smmu->size was manually moved lower, to > > take advantage of the NULL test on res performed by devm_ioremap_resource. > > > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> > > > > --- > > drivers/iommu/arm-smmu.c | 11 +++-------- > > 1 file changed, 3 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > > index ebd0a4c..dd91465 100644 > > --- a/drivers/iommu/arm-smmu.c > > +++ b/drivers/iommu/arm-smmu.c > > @@ -1761,15 +1761,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) > > smmu->dev = dev; > > > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > - if (!res) { > > - dev_err(dev, "missing base address/size\n"); > > - return -ENODEV; > > - } > > - > > + smmu->base = devm_ioremap_resource(dev, res); > > + if (IS_ERR(smmu->base)) > > + return PTR_ERR(smmu->base); > > smmu->size = resource_size(res); > > - smmu->base = devm_request_and_ioremap(dev, res); > > - if (!smmu->base) > > - return -EADDRNOTAVAIL; > > This does mean we trade arguably more useful error codes for the catch-all > -EINVAL, but the code ends up looking neater so I can be swayed either way. > > Is this part of a series you're dealing with, or would you like me to take > this (I already sent my SMMU patches for 3.12)? Please take it onwards. Thanks. julia ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-20 11:49 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-08-19 11:20 [PATCH 0/7] replace devm_request_and_ioremap by devm_ioremap_resource Julia Lawall 2013-08-19 11:20 ` [PATCH 3/7] iommu/arm: " Julia Lawall 2013-08-20 11:35 ` Will Deacon 2013-08-20 11:49 ` Julia Lawall
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox