Thread (77 messages) 77 messages, 10 authors, 2024-03-01

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

From: Maxime Ripard <mripard@kernel.org>
Date: 2024-02-27 12:08:17
Also in: dri-devel, linux-doc, linux-media, linux-rockchip, linux-sunxi, lkml

On Sun, Feb 25, 2024 at 05:02:51PM +0200, Dmitry Baryshkov wrote:
quoted
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help