msm: pil: Use devm_request_and_ioremap()
Cut down on lines of boiler plate error code by using
devm_request_and_ioremap(). We also get free error messages for
exceptional conditions and smaller code size with consolidated
code. Unfortunately we can't do this for shared mappings (clock
controller in particular) because only one driver can request a
region at a time.
Change-Id: I2d9d688d0feaf2ea4b2277aea22ab4424caf389e
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/pil-gss.c b/arch/arm/mach-msm/pil-gss.c
index 080c617..a6d13d0 100644
--- a/arch/arm/mach-msm/pil-gss.c
+++ b/arch/arm/mach-msm/pil-gss.c
@@ -485,24 +485,18 @@
struct pil_desc *desc;
int ret;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -EINVAL;
-
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
if (!drv)
return -ENOMEM;
platform_set_drvdata(pdev, drv);
- drv->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ drv->base = devm_request_and_ioremap(&pdev->dev, res);
if (!drv->base)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!res)
- return -EINVAL;
- drv->qgic2_base = devm_ioremap(&pdev->dev, res->start,
- resource_size(res));
+ drv->qgic2_base = devm_request_and_ioremap(&pdev->dev, res);
if (!drv->qgic2_base)
return -ENOMEM;