Message ID | 20250213-bridge-connector-v3-28-e71598f49c8f@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | drm/bridge: Various quality of life improvements | expand |
On Thu, Feb 13, 2025 at 03:43:47PM +0100, Maxime Ripard wrote: > The current bridge state is accessible from the drm_bridge structure, > but since it's fairly indirect it's not easy to figure out. > > Provide a helper to retrieve it. > > Signed-off-by: Maxime Ripard <mripard@kernel.org> > --- > include/drm/drm_bridge.h | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 2b65466540306feb0694abdc7cd801369cb9c9f0..4cc12b8bbdfe2b496546607d1ae0b66a903c8f89 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -955,10 +955,31 @@ static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np) { return NULL; } #endif +/** + * @drm_bridge_get_current_state() - Get the current bridge state + * @bridge: bridge object + * + * This function must be called with the modeset lock held. + * + * RETURNS: + * + * The current bridge state, or NULL if there is none. + */ +static inline struct drm_bridge_state * +drm_bridge_get_current_state(struct drm_bridge *bridge) +{ + drm_modeset_lock_assert_held(&bridge->base.lock); + + if (!bridge) + return NULL; + + return drm_priv_to_bridge_state(bridge->base.state); +} + /** * drm_bridge_get_next_bridge() - Get the next bridge in the chain * @bridge: bridge object * * RETURNS:
The current bridge state is accessible from the drm_bridge structure, but since it's fairly indirect it's not easy to figure out. Provide a helper to retrieve it. Signed-off-by: Maxime Ripard <mripard@kernel.org> --- include/drm/drm_bridge.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)