Skip to content

Commit

Permalink
iommu/arm-smmu: replace devm_request_and_ioremap by devm_ioremap_reso…
Browse files Browse the repository at this point in the history
…urce

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>
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
Julia Lawall authored and Will Deacon committed Oct 9, 2013
1 parent d0e639c commit 8a7f431
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/iommu/arm-smmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1781,15 +1781,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)) {
Expand Down

0 comments on commit 8a7f431

Please sign in to comment.