Re: [PATCH v5 08/10] drm/bridge: samsung-dsim: use supporting variable for out_bridge
From: Luca Ceresoli
Date: Fri Jan 10 2025 - 05:58:39 EST
Hi Dmitry,
On Thu, 2 Jan 2025 13:01:49 +0100
Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx> wrote:
> > > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> > > index f8b4fb8357659018ec0db65374ee5d05330639ae..c4d1563fd32019efde523dfc0863be044c05a826 100644
> > > --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> > > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> > > @@ -1705,6 +1705,7 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host,
> > > struct device *dev = dsi->dev;
> > > struct device_node *np = dev->of_node;
> > > struct device_node *remote;
> > > + struct drm_bridge *out_bridge;
> > > struct drm_panel *panel;
> > > int ret;
> > >
> > > @@ -1740,21 +1741,23 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host,
> > >
> > > panel = of_drm_find_panel(remote);
> > > if (!IS_ERR(panel)) {
> > > - dsi->out_bridge = devm_drm_panel_bridge_add(dev, panel);
> > > + out_bridge = devm_drm_panel_bridge_add(dev, panel);
> > > } else {
> > > - dsi->out_bridge = of_drm_find_bridge(remote);
> > > - if (!dsi->out_bridge)
> > > - dsi->out_bridge = ERR_PTR(-EINVAL);
> > > + out_bridge = of_drm_find_bridge(remote);
> > > + if (!out_bridge)
> > > + out_bridge = ERR_PTR(-EINVAL);
> > > }
> >
> > While looking at this patch, I think we should migrate the driver to
> > drm_of_find_panel_or_bridge().
>
> Indeed, the code here is duplicating drm_of_find_panel_or_bridge(). I'm
> going to convert it.
Or maybe not. A similar work has been attempted in the past [0] and
then reverted. There are many subtleties one would need to take care of
before getting this right, I don't think opening this other can of
worms in the middle of the bridge refcounting work makes sense.
[0] https://patchwork.freedesktop.org/patch/482751/
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com