Re: [PATCH v7 2/5] drm/scdc-helper: Add scdc_status debugfs entry
Maxime Ripard <[email protected]>
| Newsgroups | dev.linux.lists.linux-sunxi,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260721-wooden-placid-bumblebee-73360c@houat> |
On Tue, Jul 21, 2026 at 03:01:12PM +0200, Nicolas Frattaroli wrote: > On Tuesday, 21 July 2026 14:41:42 Central European Summer Time Maxime Ripard wrote: > > On Tue, Jul 21, 2026 at 10:58:58AM +0200, Nicolas Frattaroli wrote: > > > SCDC provides status information on the current display link. At the > > > very least, it may be useful to expose this info through debugfs. > > > > > > Add a debugfs entry for it under the connector, which displays a few > > > more details parsed out of the SCDC registers. A new > > > drm_scdc_debugfs_init function can be called by the connector > > > implementation to initialise the debugfs file. > > > > > > Signed-off-by: Nicolas Frattaroli <[email protected]> > > > --- > > > drivers/gpu/drm/display/drm_scdc_helper.c | 184 ++++++++++++++++++++++++++++++ > > > include/drm/display/drm_scdc_helper.h | 32 ++++++ > > > 2 files changed, 216 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/display/drm_scdc_helper.c b/drivers/gpu/drm/display/drm_scdc_helper.c > > > +/** > > > + * drm_scdc_debugfs_init - Initialize scdc files in connector debugfs > > > + * @connector: pointer to &struct drm_connector to operate on > > > + * @root: debugfs &struct dentry for the debugfs root of @connector > > > + * > > > + * Creates SCDC-related debugfs files for @connector. Must be called after > > > + * @root is already created. > > > + */ > > > +void drm_scdc_debugfs_init(struct drm_connector *connector, struct dentry *root) > > > +{ > > > + struct scdc_debugfs_priv *priv; > > > + > > > + if (!root || !connector) > > > + return; > > > + > > > + priv = drmm_kzalloc(connector->dev, sizeof(*priv), GFP_KERNEL); > > > + if (!priv) > > > + return; > > > + > > > + priv->connector = connector; > > > > You need to take a reference to the connector pointer here with > > drm_connector_get() > > > > With this fixed, > > Reviewed-by: Maxime Ripard <[email protected]> > > > > Maxime > > > > I think sashiko is onto something here with the memleak and the > entirety of the priv thing should go, which is fairly easy to do. > We don't reuse the state anymore anyways. > > I'll then just pass the connector as the priv, which will be valid > for the lifetime of the debugfs entry. This means there's no cleanup. Connectors can be hotplugged, so they have a shorter (or equal) lifetime than what drmm_kzalloc provides. Maxime
signature.asc
(application/pgp-signature, 273 B)
-----BEGIN PGP SIGNATURE----- iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCal9yBQAKCRAnX84Zoj2+ djbVAYDohBqoOi6dEtLX0bqbl0aljhsUfHcZC3fb1TYOgKURiRy5KZAGugxyJU5z 298gN1kBfiaVDF/Xr+lM6KrsiLuapmElClTOMC4p9EsWGzz4+YFIiSurQylDLoP7 p4g1IkjsHg== =Tmw5 -----END PGP SIGNATURE-----