Skip to content

Commit e4cedfd

Browse files
committed
drm/bridge: add drm_bridge_is_last()
Some code needing to know whether a bridge is the last in a chain currently call drm_bridge_get_next_bridge(). However drm_bridge_get_next_bridge() will soon increment the refcount of the returned bridge, which would make such code more annoying to write. In preparation for drm_bridge_get_next_bridge() to increment the refcount, as well as to simplify such code, introduce a simple bool function to tell whether a bridge is the last in the chain. Reviewed-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20250801-drm-bridge-alloc-getput-drm_bridge_get_next_bridge-v2-5-888912b0be13@bootlin.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
1 parent c3183f7 commit e4cedfd

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

include/drm/drm_bridge.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,11 @@ static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)
13211321
}
13221322
#endif
13231323

1324+
static inline bool drm_bridge_is_last(struct drm_bridge *bridge)
1325+
{
1326+
return list_is_last(&bridge->chain_node, &bridge->encoder->bridge_chain);
1327+
}
1328+
13241329
/**
13251330
* drm_bridge_get_current_state() - Get the current bridge state
13261331
* @bridge: bridge object

0 commit comments

Comments
 (0)