drm: get drm_bridge_panel connector via helper
authorSam Ravnborg <sam@ravnborg.org>
Sat, 7 Dec 2019 14:03:32 +0000 (15:03 +0100)
committerSam Ravnborg <sam@ravnborg.org>
Mon, 9 Dec 2019 21:57:26 +0000 (22:57 +0100)
The drm_connector created by drm_panel_bridge was accessed
via drm_panel.connector.
Avoid the detour around drm_panel by providing a simple get method.
This avoids direct access to the connector field in drm_panel in
the two users.

The change is done in preparation for removal of drm_panel.connector.

Update pl111 and tve200 to use the new helper.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: Eric Anholt <eric@anholt.net>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191207140353.23967-5-sam@ravnborg.org
drivers/gpu/drm/bridge/panel.c
drivers/gpu/drm/pl111/pl111_drv.c
drivers/gpu/drm/tve200/tve200_drv.c
include/drm/drm_bridge.h

index f4e293e7cf64268db54339a5f5ae1a5eb3ee8a53..554da47f6d62116ab87ee951ad70988cd5927b09 100644 (file)
@@ -289,3 +289,20 @@ struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
        return bridge;
 }
 EXPORT_SYMBOL(devm_drm_panel_bridge_add_typed);
+
+/**
+ * drm_panel_bridge_connector - return the connector for the panel bridge
+ *
+ * drm_panel_bridge creates the connector.
+ * This function gives external access to the connector.
+ *
+ * Returns: Pointer to drm_connector
+ */
+struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge)
+{
+       struct panel_bridge *panel_bridge;
+
+       panel_bridge = drm_bridge_to_panel_bridge(bridge);
+
+       return &panel_bridge->connector;
+}
index 63dfcda041474704ea2e950052c7733f999fb754..aa8aa8d9e405a4cf92bdd831eb2cf0a39fd64805 100644 (file)
@@ -166,7 +166,7 @@ static int pl111_modeset_init(struct drm_device *dev)
        priv->bridge = bridge;
        if (panel) {
                priv->panel = panel;
-               priv->connector = panel->connector;
+               priv->connector = drm_panel_bridge_connector(bridge);
        }
 
        ret = pl111_display_init(dev);
index 954b09c948ebe3b1089bb603d839d542c01939db..00ba9e5ce1307041e855e1d932265a54422a772a 100644 (file)
@@ -110,7 +110,7 @@ static int tve200_modeset_init(struct drm_device *dev)
        }
 
        priv->panel = panel;
-       priv->connector = panel->connector;
+       priv->connector = drm_panel_bridge_connector(bridge);
        priv->bridge = bridge;
 
        dev_info(dev->dev, "attached to panel %s\n",
index d7d7140230505d772d5b2d9f601c416c0e488c68..694e153a75314b4f3c550e4f30da0ceff1f3675d 100644 (file)
@@ -501,6 +501,7 @@ struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,
 struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
                                                   struct drm_panel *panel,
                                                   u32 connector_type);
+struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);
 #endif
 
 #endif