Re: [PATCH v7 25/36] drm/connector: hdmi: Add Infoframes generation

Maxime Ripard
2024-02-27T12:08:34Z

[-- Attachment #1.1: Type: text/plain, Size: 1744 bytes --]

On Sun, Feb 25, 2024 at 05:02:51PM +0200, Dmitry Baryshkov wrote:
> > @@ -476,6 +478,7 @@ EXPORT_SYMBOL(drmm_connector_init);
> > */
> > int drmm_connector_hdmi_init(struct drm_device *dev,
> > struct drm_connector *connector,
> > + const char *vendor, const char *product,
> > const struct drm_connector_funcs *funcs,
> > const struct drm_connector_hdmi_funcs *hdmi_funcs,
> > int connector_type,
> > @@ -485,6 +488,13 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
> > {
> > int ret;
> >
> > + if (!vendor || !product)
> > + return -EINVAL;
> > +
> > + if ((strlen(vendor) > DRM_CONNECTOR_HDMI_VENDOR_LEN) ||
> > + (strlen(product) > DRM_CONNECTOR_HDMI_PRODUCT_LEN))
> > + return -EINVAL;
> > +
> > if (!(connector_type == DRM_MODE_CONNECTOR_HDMIA ||
> > connector_type == DRM_MODE_CONNECTOR_HDMIB))
> > return -EINVAL;
> > @@ -500,6 +510,12 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
> > return ret;
> >
> > connector->hdmi.supported_formats = supported_formats;
> > + strtomem_pad(connector->hdmi.vendor, vendor, 0);
> > + strtomem_pad(connector->hdmi.product, product, 0);
> > +
> > + ret = drmm_mutex_init(dev, &connector->hdmi.infoframes.lock);
>
> I'd suggest moving this call to the generic __drm_connector_init().
> This way no matter how the rest of the drm code (mis)uses the
> connector, the lock is always present and valid.

Yeah, that makes sense, I'll change it.

Thanks!
Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]