Re: [PATCH 1/7] drm/bridge: analogix_dp: drop extra calls to analogix_dp_prepare_panel()

Dmitry Baryshkov
2025-04-20T22:56:23Z

On Mon, Apr 14, 2025 at 10:01:16AM +0800, Damon Ding wrote:
> On 2025/4/14 9:20, Damon Ding wrote:
> > Hi Dmitry,
> >
> > On 2025/4/1 13:11, Dmitry Baryshkov wrote:
> > > The analogix_dp_prepare_panel() returns immediately if there is no
> > > attached panel. Drop several calls to this function which are performed
> > > when dp->plat_data->panel is NULL.
> > >
> > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > > ---
> > >   drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 22
> > > +---------------------
> > >   1 file changed, 1 insertion(+), 21 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/
> > > drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> > > index 042154e2d8ccd74ac2dc27fe527e810a50e08a09..ab1cfc340aa95bbf13fe021bd33227b565a5458d
> > > 100644
> > > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> > > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> > > @@ -1005,17 +1005,11 @@ static int analogix_dp_get_modes(struct
> > > drm_connector *connector)
> > >   {
> > >       struct analogix_dp_device *dp = to_dp(connector);
> > >       const struct drm_edid *drm_edid;
> > > -    int ret, num_modes = 0;
> > > +    int num_modes = 0;
> > >       if (dp->plat_data->panel) {
> > >           num_modes += drm_panel_get_modes(dp->plat_data->panel,
> > > connector);
> > >       } else {
> > > -        ret = analogix_dp_prepare_panel(dp, true, false);
> > > -        if (ret) {
> > > -            DRM_ERROR("Failed to prepare panel (%d)\n", ret);
> > > -            return 0;
> > > -        }
> > > -
> > >           drm_edid = drm_edid_read_ddc(connector, &dp->aux.ddc);
> > >           drm_edid_connector_update(&dp->connector, drm_edid);
> > > @@ -1024,10 +1018,6 @@ static int analogix_dp_get_modes(struct
> > > drm_connector *connector)
> > >               num_modes += drm_edid_connector_add_modes(&dp->connector);
> > >               drm_edid_free(drm_edid);
> > >           }
> > > -
> > > -        ret = analogix_dp_prepare_panel(dp, false, false);
> > > -        if (ret)
> > > -            DRM_ERROR("Failed to unprepare panel (%d)\n", ret);
> > >       }
> > >       if (dp->plat_data->get_modes)
> > > @@ -1087,19 +1077,9 @@ analogix_dp_detect(struct drm_connector
> > > *connector, bool force)
> > >       if (dp->plat_data->panel)
> > >           return connector_status_connected;
> > > -    ret = analogix_dp_prepare_panel(dp, true, false);
> > > -    if (ret) {
> > > -        DRM_ERROR("Failed to prepare panel (%d)\n", ret);
> > > -        return connector_status_disconnected;
> > > -    }
> > > -
> > >       if (!analogix_dp_detect_hpd(dp))
> > >           status = connector_status_connected;
> > > -    ret = analogix_dp_prepare_panel(dp, false, false);
> > > -    if (ret)
> > > -        DRM_ERROR("Failed to unprepare panel (%d)\n", ret);
> > > -
> > >       return status;
> > >   }
> > >
> >
> > With the patch series:
> > https://patchwork.kernel.org/project/linux-rockchip/list/?series=942183
> >
> > When I verify this patch, there will be a small warning:
> > drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:1075:6: warning:
> > unused variable 'ret' [-Wunused-variable]
> >         int ret;
> >             ^
> >
> > It should be better to remove the unused 'ret'.

I can't reproduce the warning, so I'd like to push the series once patch
3/7 gets an R-B.

> >
> > Best regards,
> > Damon
> >
> >
> >
>
> Tested-by: Damon Ding <damon.ding@rock-chips.com>
>

--
With best wishes
Dmitry