Re: [PATCH] media: davinci: Make use of the helper function devm_platform_ioremap_resource()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Cai,

Thank you for the patch.

On Wed, Sep 1, 2021 at 6:51 AM Cai Huoqing <caihuoqing@xxxxxxxxx> wrote:
>
> Use the devm_platform_ioremap_resource() helper instead of
> calling platform_get_resource() and devm_ioremap_resource()
> separately
>
> Signed-off-by: Cai Huoqing <caihuoqing@xxxxxxxxx>
> ---
>  drivers/media/platform/davinci/vpbe_venc.c |  9 ++-------
>  drivers/media/platform/davinci/vpif.c      |  5 ++---
>  drivers/media/platform/davinci/vpss.c      | 10 ++--------
>  3 files changed, 6 insertions(+), 18 deletions(-)
>
Reviewed-by: Lad Prabhakar <prabhakar.csengg@xxxxxxxxx>

Cheers,
Prabhakar

> diff --git a/drivers/media/platform/davinci/vpbe_venc.c b/drivers/media/platform/davinci/vpbe_venc.c
> index bde241c26d79..4c8e31de12b1 100644
> --- a/drivers/media/platform/davinci/vpbe_venc.c
> +++ b/drivers/media/platform/davinci/vpbe_venc.c
> @@ -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);
>         }
> diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c
> index f1ce10828b8e..5a89d885d0e3 100644
> --- a/drivers/media/platform/davinci/vpif.c
> +++ b/drivers/media/platform/davinci/vpif.c
> @@ -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);
>
> diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c
> index 7000f0bf0b35..d15b991ab17c 100644
> --- a/drivers/media/platform/davinci/vpss.c
> +++ b/drivers/media/platform/davinci/vpss.c
> @@ -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);
>         }
> --
> 2.25.1
>



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux