[media] omap3isp: Use devm_ioremap_resource()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 4 Dec 2013 16:49:02 +0000 (13:49 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 18 Dec 2013 08:24:41 +0000 (06:24 -0200)
Replace devm_request_mem_region() and devm_ioremap_nocache() with
devm_ioremap_resource(). The behaviour remains the same and the code is
simplified.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/omap3isp/isp.c
drivers/media/platform/omap3isp/isp.h

index fdbdeae3900dd0bb92ea10184239d9bd6c004074..bb4e0a7c7b5eb0751aa2bb7528cc4b6af4ed7c8c 100644 (file)
@@ -2130,28 +2130,13 @@ static int isp_map_mem_resource(struct platform_device *pdev,
        /* request the mem region for the camera registers */
 
        mem = platform_get_resource(pdev, IORESOURCE_MEM, res);
-       if (!mem) {
-               dev_err(isp->dev, "no mem resource?\n");
-               return -ENODEV;
-       }
-
-       if (!devm_request_mem_region(isp->dev, mem->start, resource_size(mem),
-                                    pdev->name)) {
-               dev_err(isp->dev,
-                       "cannot reserve camera register I/O region\n");
-               return -ENODEV;
-       }
-       isp->mmio_base_phys[res] = mem->start;
-       isp->mmio_size[res] = resource_size(mem);
 
        /* map the region */
-       isp->mmio_base[res] = devm_ioremap_nocache(isp->dev,
-                                                  isp->mmio_base_phys[res],
-                                                  isp->mmio_size[res]);
-       if (!isp->mmio_base[res]) {
-               dev_err(isp->dev, "cannot map camera register I/O region\n");
-               return -ENODEV;
-       }
+       isp->mmio_base[res] = devm_ioremap_resource(isp->dev, mem);
+       if (IS_ERR(isp->mmio_base[res]))
+               return PTR_ERR(isp->mmio_base[res]);
+
+       isp->mmio_base_phys[res] = mem->start;
 
        return 0;
 }
index d1e857e41731cf3b5c807ff0416ef117ee152ae5..72685ad0fc1ed6eb23f484ffd6d42a4758d9c302 100644 (file)
@@ -152,7 +152,6 @@ struct isp_xclk {
  *             regions.
  * @mmio_base_phys: Array with physical L4 bus addresses for ISP register
  *                  regions.
- * @mmio_size: Array with ISP register regions size in bytes.
  * @stat_lock: Spinlock for handling statistics
  * @isp_mutex: Mutex for serializing requests to ISP.
  * @crashed: Bitmask of crashed entities (indexed by entity ID)
@@ -188,7 +187,6 @@ struct isp_device {
 
        void __iomem *mmio_base[OMAP3_ISP_IOMEM_LAST];
        unsigned long mmio_base_phys[OMAP3_ISP_IOMEM_LAST];
-       resource_size_t mmio_size[OMAP3_ISP_IOMEM_LAST];
 
        /* ISP Obj */
        spinlock_t stat_lock;   /* common lock for statistic drivers */