diff mbox series

[3/4] drm/mediatek: mtk_dpi: Switch to devm_drm_of_get_bridge()

Message ID 20230412115250.164899-4-angelogioacchino.delregno@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: Small mtk-dpi cleanups | expand

Commit Message

AngeloGioacchino Del Regno April 12, 2023, 11:52 a.m. UTC
Function drm_of_find_panel_or_bridge() is marked as deprecated: since
the usage of that in this driver exactly corresponds to the new function
devm_drm_of_get_bridge(), switch to it.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Fei Shao July 13, 2023, 8:24 a.m. UTC | #1
Hi Angelo,

On Wed, Apr 12, 2023 at 7:53 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Function drm_of_find_panel_or_bridge() is marked as deprecated: since
> the usage of that in this driver exactly corresponds to the new function
> devm_drm_of_get_bridge(), switch to it.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 6be65ea21f8f..9025111013d3 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -1063,10 +1063,9 @@ static int mtk_dpi_probe(struct platform_device *pdev)
>         if (dpi->irq <= 0)
>                 return -EINVAL;
>
> -       ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
> -                                         NULL, &dpi->next_bridge);
> -       if (ret)
> -               return ret;
> +       dpi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
> +       if (IS_ERR(dpi->next_bridge))
> +               return PTR_ERR(dpi->next_bridge);

The original code doesn't print any log so it's probably fine, but
given you're already at it, perhaps you want to also make use of
dev_err_probe() here?
devm_drm_of_get_bridge() can also pass -EPROBE_DEFER from its wrapped
drm_of_find_panel_or_bridge(). Furthermore, that will make the code
visually align with your previous patch.

But that's just optional, and since this patch works anyway,

Reviewed-by: Fei Shao <fshao@chromium.org>

>
>         dev_info(dev, "Found bridge node: %pOF\n", dpi->next_bridge->of_node);
>
> --
> 2.40.0
>
>
AngeloGioacchino Del Regno July 13, 2023, 11:13 a.m. UTC | #2
Il 13/07/23 10:24, Fei Shao ha scritto:
> Hi Angelo,
> 
> On Wed, Apr 12, 2023 at 7:53 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> Function drm_of_find_panel_or_bridge() is marked as deprecated: since
>> the usage of that in this driver exactly corresponds to the new function
>> devm_drm_of_get_bridge(), switch to it.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/gpu/drm/mediatek/mtk_dpi.c | 7 +++----
>>   1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
>> index 6be65ea21f8f..9025111013d3 100644
>> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
>> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
>> @@ -1063,10 +1063,9 @@ static int mtk_dpi_probe(struct platform_device *pdev)
>>          if (dpi->irq <= 0)
>>                  return -EINVAL;
>>
>> -       ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
>> -                                         NULL, &dpi->next_bridge);
>> -       if (ret)
>> -               return ret;
>> +       dpi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
>> +       if (IS_ERR(dpi->next_bridge))
>> +               return PTR_ERR(dpi->next_bridge);
> 
> The original code doesn't print any log so it's probably fine, but
> given you're already at it, perhaps you want to also make use of
> dev_err_probe() here?
> devm_drm_of_get_bridge() can also pass -EPROBE_DEFER from its wrapped
> drm_of_find_panel_or_bridge(). Furthermore, that will make the code
> visually align with your previous patch.
> 
> But that's just optional, and since this patch works anyway,
> 
> Reviewed-by: Fei Shao <fshao@chromium.org>
> 

Thanks. Yeah it's a good idea to add an error print... since I will have
to anyway send a v2, I'll add it.

Cheers,
Angelo

>>
>>          dev_info(dev, "Found bridge node: %pOF\n", dpi->next_bridge->of_node);
>>
>> --
>> 2.40.0
>>
>>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 6be65ea21f8f..9025111013d3 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -1063,10 +1063,9 @@  static int mtk_dpi_probe(struct platform_device *pdev)
 	if (dpi->irq <= 0)
 		return -EINVAL;
 
-	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
-					  NULL, &dpi->next_bridge);
-	if (ret)
-		return ret;
+	dpi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
+	if (IS_ERR(dpi->next_bridge))
+		return PTR_ERR(dpi->next_bridge);
 
 	dev_info(dev, "Found bridge node: %pOF\n", dpi->next_bridge->of_node);