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

Luca Ceresoli
2026-03-10T10:26:06Z

Hello Icenowy,

On Mon Mar 9, 2026 at 5:51 PM CET, Icenowy Zheng wrote:
> 在 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).

Indeed, several drivers are more and more similar in this respect so a
helper could deduplicate a bit of code in an easy way here.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering