[v2,11/21] drm/bridge: Add the drm_for_each_bridge_in_chain() helper
diff mbox series

Message ID 20190826152649.13820-12-boris.brezillon@collabora.com
State New
Headers show
Series
  • drm: Add support for bus-format negotiation
Related show

Commit Message

Boris Brezillon Aug. 26, 2019, 3:26 p.m. UTC
To iterate over all bridges attached to a specific encoder.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
Changes in v2:
* New patch
---
 include/drm/drm_bridge.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Neil Armstrong Aug. 27, 2019, 7:26 a.m. UTC | #1
On 26/08/2019 17:26, Boris Brezillon wrote:
> To iterate over all bridges attached to a specific encoder.
> 
> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

> ---
> Changes in v2:
> * New patch
> ---
>  include/drm/drm_bridge.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index 8af92f0a9541..cf05b30f2967 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -409,6 +409,17 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np);
>  int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
>  		      struct drm_bridge *previous);
>  
> +/**
> + * for_each_bridge_in_chain() - Iterate over all bridges present in a chain
> + * @encoder: the encoder to iterate bridges on
> + * @bridge: a bridge pointer updated to point to the current bridge at each
> + *	    iteration
> + *
> + * Iterate over all bridges present in the bridge chain attached to @encoder.
> + */
> +#define drm_for_each_bridge_in_chain(encoder, bridge)			\
> +	list_for_each_entry(bridge, &(encoder)->bridge_chain, chain_node)
> +
>  struct drm_bridge *
>  drm_bridge_chain_get_next_bridge(struct drm_bridge *bridge);
>  bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge,
>

Patch
diff mbox series

diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 8af92f0a9541..cf05b30f2967 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -409,6 +409,17 @@  struct drm_bridge *of_drm_find_bridge(struct device_node *np);
 int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
 		      struct drm_bridge *previous);
 
+/**
+ * for_each_bridge_in_chain() - Iterate over all bridges present in a chain
+ * @encoder: the encoder to iterate bridges on
+ * @bridge: a bridge pointer updated to point to the current bridge at each
+ *	    iteration
+ *
+ * Iterate over all bridges present in the bridge chain attached to @encoder.
+ */
+#define drm_for_each_bridge_in_chain(encoder, bridge)			\
+	list_for_each_entry(bridge, &(encoder)->bridge_chain, chain_node)
+
 struct drm_bridge *
 drm_bridge_chain_get_next_bridge(struct drm_bridge *bridge);
 bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge,