[v9,58/61] drm/connector: Remove drmm_connector_hdmi_ini2()

Message ID 20260723-dw-hdmi-qp-scramb-v9-58-4fb12ea22ac9@collabora.com (mailing list archive)
State New
Headers
Series Add HDMI 2.0 support to DW HDMI QP TX |

Commit Message

Cristian Ciocaltea July 23, 2026, 1:35 a.m. UTC
All callers have been converted to the new drmm_connector_hdmi_init()
signature.  Remove the transitional drmm_connector_hdmi_ini2() function,
its declaration, its EXPORT_SYMBOL() and its kernel-doc.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
 drivers/gpu/drm/drm_connector.c | 104 ----------------------------------------
 include/drm/drm_connector.h     |   9 ----
 2 files changed, 113 deletions(-)
  

Comments

sashiko-bot@kernel.org July 23, 2026, 2:01 a.m. UTC | #1
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete transition and missed cleanup of TODOs for HDMI connector state fields.
--

--- Patch [58]: [PATCH v9 58/61] drm/connector: Remove drmm_connector_hdmi_ini2() ---
commit bc0f9c01790d98f211c2100593457435fcb56011
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

    drm/connector: Remove drmm_connector_hdmi_ini2()

This commit removes the transitional drmm_connector_hdmi_ini2() function
since all callers have been converted to the new drmm_connector_hdmi_init()
signature.

> All callers have been converted to the new drmm_connector_hdmi_init()
> signature.  Remove the transitional drmm_connector_hdmi_ini2() function,
> its declaration, its EXPORT_SYMBOL() and its kernel-doc.

[Severity: Medium]
If the transition is now complete, were the TODO cleanups in
drmm_connector_hdmi_init() missed?

There are still assignments left with explicit TODO comments in
drivers/gpu/drm/drm_connector.c:

	/* TODO: remove after conversion to new drmm_connector_hdmi_init() */
	connector->hdmi.supported_formats = hdmi_funcs->supported_formats;
	...
	/* TODO: remove after conversion to new drmm_connector_hdmi_init() */
	strtomem_pad(connector->hdmi.vendor, hdmi_funcs->vendor, 0);
	strtomem_pad(connector->hdmi.product, hdmi_funcs->product, 0);
	...
	/* TODO: remove after conversion to new drmm_connector_hdmi_init() */
	connector->max_bpc = hdmi_funcs->max_bpc;

Additionally, external consumers still appear to rely on the duplicated
state fields rather than using the funcs structure. For instance, in
drivers/gpu/drm/display/drm_hdmi_state_helper.c:

	if (!(connector->hdmi.supported_formats & BIT(format))) {

Since this patch marks the end of the transition, should these duplicated
fields be removed and their users updated to use
connector->hdmi.funcs->supported_formats instead?
  

Patch

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 96cca0ca64bd..d424d245ef71 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -694,110 +694,6 @@  int drmm_connector_hdmi_init(struct drm_device *dev,
 }
 EXPORT_SYMBOL(drmm_connector_hdmi_init);
 
-/**
- * drmm_connector_hdmi_ini2 - Init a preallocated HDMI connector
- * @dev: DRM device
- * @connector: A pointer to the HDMI connector to init
- * @vendor: HDMI Controller Vendor name
- * @product: HDMI Controller Product name
- * @funcs: callbacks for this connector
- * @hdmi_funcs: HDMI-related callbacks for this connector
- * @connector_type: user visible type of the connector
- * @ddc: optional pointer to the associated ddc adapter
- * @supported_formats: Bitmask of @drm_output_color_format listing supported output formats
- * @max_bpc: Maximum bits per char the HDMI connector supports
- *
- * Initialises a preallocated HDMI connector. Connectors can be
- * subclassed as part of driver connector objects.
- *
- * Cleanup is automatically handled with a call to
- * drm_connector_cleanup() in a DRM-managed action.
- *
- * The connector structure should be allocated with drmm_kzalloc().
- *
- * The @drm_connector_funcs.destroy hook must be NULL.
- *
- * Returns:
- * Zero on success, error code on failure.
- */
-int drmm_connector_hdmi_ini2(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,
-			     struct i2c_adapter *ddc,
-			     unsigned long supported_formats,
-			     unsigned int max_bpc)
-{
-	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;
-
-	if (!supported_formats || !(supported_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444)))
-		return -EINVAL;
-
-	if (connector->ycbcr_420_allowed != !!(supported_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420)))
-		return -EINVAL;
-
-	if (!(max_bpc == 8 || max_bpc == 10 || max_bpc == 12))
-		return -EINVAL;
-
-	if (!hdmi_funcs->avi.clear_infoframe ||
-	    !hdmi_funcs->avi.write_infoframe ||
-	    !hdmi_funcs->hdmi.clear_infoframe ||
-	    !hdmi_funcs->hdmi.write_infoframe)
-		return -EINVAL;
-
-	ret = drmm_connector_init(dev, connector, funcs, connector_type, ddc);
-	if (ret)
-		return ret;
-
-	connector->hdmi.supported_formats = supported_formats;
-	strtomem_pad(connector->hdmi.vendor, vendor, 0);
-	strtomem_pad(connector->hdmi.product, product, 0);
-
-	/*
-	 * drm_connector_attach_max_bpc_property() requires the
-	 * connector to have a state.
-	 */
-	if (connector->funcs->atomic_create_state) {
-		struct drm_connector_state *state;
-
-		state = connector->funcs->atomic_create_state(connector);
-		if (IS_ERR(state))
-			return PTR_ERR(state);
-
-		connector->state = state;
-	} else if (connector->funcs->reset) {
-		connector->funcs->reset(connector);
-	}
-
-	drm_connector_attach_max_bpc_property(connector, 8, max_bpc);
-	connector->max_bpc = max_bpc;
-
-	if (max_bpc > 8)
-		drm_connector_attach_hdr_output_metadata_property(connector);
-
-	ret = drm_connector_attach_color_format_property(connector, supported_formats);
-	if (ret)
-		return ret;
-
-	connector->hdmi.funcs = hdmi_funcs;
-
-	return 0;
-}
-EXPORT_SYMBOL(drmm_connector_hdmi_ini2);
-
 /**
  * drm_connector_attach_edid_property - attach edid property.
  * @connector: the connector
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 61ba20296f6a..b80cc667604e 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -2670,15 +2670,6 @@  int drmm_connector_hdmi_init(struct drm_device *dev,
 			     const struct drm_connector_hdmi_funcs *hdmi_funcs,
 			     int connector_type,
 			     struct i2c_adapter *ddc);
-int drmm_connector_hdmi_ini2(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,
-			     struct i2c_adapter *ddc,
-			     unsigned long supported_formats,
-			     unsigned int max_bpc);
 void drm_connector_attach_edid_property(struct drm_connector *connector);
 int drm_connector_register(struct drm_connector *connector);
 int drm_connector_dynamic_register(struct drm_connector *connector);