Re: [PATCH v7 3/8] drm: verisilicon: add a driver for Verisilicon display controllers

Icenowy Zheng
2026-03-09T16:51:46Z

在 2026-03-10二的 00:35 +0800，Icenowy Zheng写道：
================ 8< ==================
> > > + if (IS_ERR(bridge))
> > > + return ERR_PTR(PTR_ERR(bridge));
> > > +
> > > + bridge->crtc = crtc;
> > > + bridge->intf = intf;
> > > + bridge->next_bridge = next;
> >
> > There is now a next_bridge field in struct drm_bridge, which
> > handles
> > the
> > bridge lifetime in a safer way and more simply [0], so you could
> > use
> > it:
>
> Glad to hear such a field exists now. Will more code about
> next_bridge
> lifetime management being shared?

Looks like now many drivers can just share the .attach function,
because they're all doing the same thing:

```
int drm_bridge_attach_next(struct drm_bridge *bridge,
struct drm_encoder *encoder,
enum drm_bridge_attach_flags flags)
{
return drm_bridge_attach(encoder, bridge->next_bridge,
bridge, flags);
}
```

At least vs_bridge_attach here and meson_encoder_*_attach (named
encoder but they're bridge drivers now) match this pattern (the latter
does a cast from `struct drm_bridge *` to their subclasses, but then
only accessing the `bridge` field of the subclasses and doing the same
things here).

Thanks,
Icenowy

>
> Thanks,
> Icenowy
>
> >
> >        bridge->base.next_bridge = next;
> >
> > Or, after the renames I suggested above:
> >
> >        vbridge->bridge.next_bridge = next;
> >
> > [0]
> > https://elixir.bootlin.com/linux/v7.0-rc2/source/include/drm/drm_bridge.h#L1269-L1278
> >
> > Luca
> >
> > --
> > Luca Ceresoli, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com