[PATCH 1/5] drm/panel: Add new helpers for refcounted panel allocatons

Anusha Srivatsa asrivats at redhat.com
Wed Mar 26 16:57:31 UTC 2025


On Wed, Mar 26, 2025 at 11:26 AM Maxime Ripard <mripard at kernel.org> wrote:

> On Wed, Mar 26, 2025 at 10:22:59AM +0100, Luca Ceresoli wrote:
> > Hello Anusha,
> >
> > On Tue, 25 Mar 2025 13:24:08 -0400
> > Anusha Srivatsa <asrivats at redhat.com> wrote:
> >
> > > Introduce reference counted allocations for panels to avoid
> > > use-after-free. The patch adds the macro devm_drm_bridge_alloc()
> > > to allocate a new refcounted panel. Followed the documentation for
> > > drmm_encoder_alloc() and devm_drm_dev_alloc and other similar
> > > implementations for this purpose.
> > >
> > > Signed-off-by: Anusha Srivatsa <asrivats at redhat.com>
> >
> > [...]
> >
> > > +void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t
> offset,
> > > +                        const struct drm_panel_funcs *funcs,
> > > +                        int connector_type);
> > > +
> > > +/**
> > > + * devm_drm_panel_alloc - Allocate and initialize an refcounted panel
> >                                                      ^^
> > "a refcounted panel"
> >
> > > + * @dev: struct device of the panel device
> > > + * @type: the type of the struct which contains struct &drm_panel
> > > + * @member: the name of the &drm_panel within @type
> > > + * @funcs: callbacks for this panel
> > > + * @connector_type: connector type of the driver
> >
> > I'd say it's the connector type in the hardware, rather than of the
> > driver (the driver follows what is in the hardware. Maybe you can just
> > copy the description present in the drm_panel_init kdoc:
> >
> >  * @connector_type: the connector type (DRM_MODE_CONNECTOR_*)
> corresponding to
> >  *      the panel interface (must NOT be DRM_MODE_CONNECTOR_Unknown)
> >
> > Other than that it looks good!
>
> Heh, Unknown is fine, but you're right for the rest. I'd use the
> drm_panel_init doc for that field actually.
>
> Will make this change in the next iteration,
Thanks Luca and Maxime

Anusha

> Maxime
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20250326/a628ba44/attachment-0001.htm>


More information about the dri-devel mailing list