media: davinci: Make use of the helper function devm_platform_ioremap_resource()
authorCai Huoqing <caihuoqing@baidu.com>
Wed, 1 Sep 2021 05:51:16 +0000 (07:51 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 30 Sep 2021 08:07:49 +0000 (10:07 +0200)
Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/davinci/vpbe_venc.c
drivers/media/platform/davinci/vpif.c
drivers/media/platform/davinci/vpss.c

index bde241c..4c8e31d 100644 (file)
@@ -621,7 +621,6 @@ static int venc_probe(struct platform_device *pdev)
 {
        const struct platform_device_id *pdev_id;
        struct venc_state *venc;
-       struct resource *res;
 
        if (!pdev->dev.platform_data) {
                dev_err(&pdev->dev, "No platform data for VENC sub device");
@@ -640,16 +639,12 @@ static int venc_probe(struct platform_device *pdev)
        venc->pdev = &pdev->dev;
        venc->pdata = pdev->dev.platform_data;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-       venc->venc_base = devm_ioremap_resource(&pdev->dev, res);
+       venc->venc_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(venc->venc_base))
                return PTR_ERR(venc->venc_base);
 
        if (venc->venc_type != VPBE_VERSION_1) {
-               res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-
-               venc->vdaccfg_reg = devm_ioremap_resource(&pdev->dev, res);
+               venc->vdaccfg_reg = devm_platform_ioremap_resource(pdev, 1);
                if (IS_ERR(venc->vdaccfg_reg))
                        return PTR_ERR(venc->vdaccfg_reg);
        }
index f1ce108..5a89d88 100644 (file)
@@ -425,12 +425,11 @@ EXPORT_SYMBOL(vpif_channel_getfid);
 
 static int vpif_probe(struct platform_device *pdev)
 {
-       static struct resource  *res, *res_irq;
+       static struct resource *res_irq;
        struct platform_device *pdev_capture, *pdev_display;
        struct device_node *endpoint = NULL;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       vpif_base = devm_ioremap_resource(&pdev->dev, res);
+       vpif_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(vpif_base))
                return PTR_ERR(vpif_base);
 
index 7000f0b..d15b991 100644 (file)
@@ -392,7 +392,6 @@ EXPORT_SYMBOL(dm365_vpss_set_pg_frame_size);
 
 static int vpss_probe(struct platform_device *pdev)
 {
-       struct resource *res;
        char *platform_name;
 
        if (!pdev->dev.platform_data) {
@@ -413,17 +412,12 @@ static int vpss_probe(struct platform_device *pdev)
        }
 
        dev_info(&pdev->dev, "%s vpss probed\n", platform_name);
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-       oper_cfg.vpss_regs_base0 = devm_ioremap_resource(&pdev->dev, res);
+       oper_cfg.vpss_regs_base0 = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(oper_cfg.vpss_regs_base0))
                return PTR_ERR(oper_cfg.vpss_regs_base0);
 
        if (oper_cfg.platform == DM355 || oper_cfg.platform == DM365) {
-               res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-
-               oper_cfg.vpss_regs_base1 = devm_ioremap_resource(&pdev->dev,
-                                                                res);
+               oper_cfg.vpss_regs_base1 = devm_platform_ioremap_resource(pdev, 1);
                if (IS_ERR(oper_cfg.vpss_regs_base1))
                        return PTR_ERR(oper_cfg.vpss_regs_base1);
        }