Re: [PATCH] drm/exynos: gsc: Get device id from OF alias

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

 



On 15 June 2018 at 14:26, Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> wrote:
> Platform devices instantiated from device-tree always have pdev->id set to
> -1, so use of_get_alias_id() helper to retrieve proper device id.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_gsc.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> index e99dd1e4ba65..a63287597985 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> @@ -1196,7 +1196,12 @@ static int gsc_probe(struct platform_device *pdev)
>         struct exynos_drm_ipp_formats *formats;
>         struct gsc_context *ctx;
>         struct resource *res;
> -       int ret, i;
> +       int ret, i, id;
> +
> +       ret = of_alias_get_id(pdev->dev.of_node, "gsc");
> +       if (ret < 0)
> +               return ret;
> +       id = ret;
>
>         ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
>         if (!ctx)
> @@ -1254,7 +1259,7 @@ static int gsc_probe(struct platform_device *pdev)
>         }
>
>         /* context initailization */
> -       ctx->id = pdev->id;
> +       ctx->id = id;

Why do you need ctx->id at all? I see it is used only in dev_dbg and
dev_err messages but these should be easily identifiable by device
name+address. Maybe get rid of ctx->id entirely?

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux