summaryrefslogtreecommitdiff
path: root/include/drm/drm_bridge.h
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@collabora.com>2019-12-03 15:15:10 +0100
committerBoris Brezillon <boris.brezillon@collabora.com>2019-12-09 10:03:29 +0100
commitac877c64c87aff5d228cf53e40d8f68899afa815 (patch)
tree9e5959b7ca4e7f9e23cbbac1e6b33bc7463aa731 /include/drm/drm_bridge.h
parent4ec5c9050a496a984ffdaaf2307aef353634dc87 (diff)
downloadlwn-ac877c64c87aff5d228cf53e40d8f68899afa815.tar.gz
lwn-ac877c64c87aff5d228cf53e40d8f68899afa815.zip
drm/bridge: Add the drm_bridge_get_prev_bridge() helper
The drm_bridge_get_prev_bridge() helper will be useful for bridge drivers that want to do bus format negotiation with their neighbours. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191203141515.3597631-7-boris.brezillon@collabora.com
Diffstat (limited to 'include/drm/drm_bridge.h')
-rw-r--r--include/drm/drm_bridge.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 1eb854025a20..bfb0385163f1 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -427,6 +427,22 @@ drm_bridge_get_next_bridge(struct drm_bridge *bridge)
}
/**
+ * drm_bridge_get_prev_bridge() - Get the previous bridge in the chain
+ * @bridge: bridge object
+ *
+ * RETURNS:
+ * the previous bridge in the chain, or NULL if @bridge is the first.
+ */
+static inline struct drm_bridge *
+drm_bridge_get_prev_bridge(struct drm_bridge *bridge)
+{
+ if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain))
+ return NULL;
+
+ return list_prev_entry(bridge, chain_node);
+}
+
+/**
* drm_bridge_chain_get_first_bridge() - Get the first bridge in the chain
* @encoder: encoder object
*