Commit 8f92a5fc authored by Luca Ceresoli's avatar Luca Ceresoli
Browse files

drm/bridge: ite-it66121: get/put the next bridge



This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to of_drm_find_and_get_bridge() for the bridge to be
refcounted and use bridge->next_bridge to put the reference on
deallocation.

Reviewed-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://patch.msgid.link/20251216-drm-bridge-alloc-getput-drm_of_find_bridge-v3-7-b5165fab8058@bootlin.com


Signed-off-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
parent 3fdeae13
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -298,7 +298,6 @@ struct it66121_chip_info {
struct it66121_ctx {
	struct regmap *regmap;
	struct drm_bridge bridge;
	struct drm_bridge *next_bridge;
	struct drm_connector *connector;
	struct device *dev;
	struct gpio_desc *gpio_reset;
@@ -596,7 +595,7 @@ static int it66121_bridge_attach(struct drm_bridge *bridge,
	if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
		return -EINVAL;

	ret = drm_bridge_attach(encoder, ctx->next_bridge, bridge, flags);
	ret = drm_bridge_attach(encoder, ctx->bridge.next_bridge, bridge, flags);
	if (ret)
		return ret;

@@ -1543,9 +1542,9 @@ static int it66121_probe(struct i2c_client *client)
		return -EINVAL;
	}

	ctx->next_bridge = of_drm_find_bridge(ep);
	ctx->bridge.next_bridge = of_drm_find_and_get_bridge(ep);
	of_node_put(ep);
	if (!ctx->next_bridge) {
	if (!ctx->bridge.next_bridge) {
		dev_dbg(ctx->dev, "Next bridge not found, deferring probe\n");
		return -EPROBE_DEFER;
	}