[PATCH V2 1/4] drm/bridge: Remove duplication from drm_bridge and drm_atomic_bridge chains

Dmitry Baryshkov dmitry.baryshkov at linaro.org
Wed Jun 8 11:00:57 UTC 2022


On 04/03/2022 18:17, Dave Stevenson wrote:
> drm_bridge_chain_pre_enable is a subset of
> drm_atomic_bridge_chain_pre_enable, and drm_bridge_chain_post_disable
> is a subset of drm_atomic_bridge_chain_post_disable.
> 
> Change drm_bridge_chain_pre_enable and drm_bridge_chain_post_disable to
> call the atomic versions with a NULL state, and ensure that atomic
> calls are not made if there is no state.
> 
> Signed-off-by: Dave Stevenson <dave.stevenson at raspberrypi.com>

I think we should update parade-ps8640 to use drm_atomic_bridge_chain_() 
and drop drm_bridge_chain_* API completely.

> ---
>   drivers/gpu/drm/drm_bridge.c | 30 ++++--------------------------
>   1 file changed, 4 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index c96847fc0ebc..198fd471a488 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -527,16 +527,7 @@ EXPORT_SYMBOL(drm_bridge_chain_disable);
>    */
>   void drm_bridge_chain_post_disable(struct drm_bridge *bridge)
>   {
> -	struct drm_encoder *encoder;
> -
> -	if (!bridge)
> -		return;
> -
> -	encoder = bridge->encoder;
> -	list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
> -		if (bridge->funcs->post_disable)
> -			bridge->funcs->post_disable(bridge);
> -	}
> +	drm_atomic_bridge_chain_post_disable(bridge, NULL);
>   }
>   EXPORT_SYMBOL(drm_bridge_chain_post_disable);
>   
> @@ -582,20 +573,7 @@ EXPORT_SYMBOL(drm_bridge_chain_mode_set);
>    */
>   void drm_bridge_chain_pre_enable(struct drm_bridge *bridge)
>   {
> -	struct drm_encoder *encoder;
> -	struct drm_bridge *iter;
> -
> -	if (!bridge)
> -		return;
> -
> -	encoder = bridge->encoder;
> -	list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) {
> -		if (iter->funcs->pre_enable)
> -			iter->funcs->pre_enable(iter);
> -
> -		if (iter == bridge)
> -			break;
> -	}
> +	drm_atomic_bridge_chain_pre_enable(bridge, NULL);
>   }
>   EXPORT_SYMBOL(drm_bridge_chain_pre_enable);
>   
> @@ -690,7 +668,7 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,
>   
>   	encoder = bridge->encoder;
>   	list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
> -		if (bridge->funcs->atomic_post_disable) {
> +		if (old_state && bridge->funcs->atomic_post_disable) {
>   			struct drm_bridge_state *old_bridge_state;
>   
>   			old_bridge_state =
> @@ -732,7 +710,7 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,
>   
>   	encoder = bridge->encoder;
>   	list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) {
> -		if (iter->funcs->atomic_pre_enable) {
> +		if (old_state && iter->funcs->atomic_pre_enable) {
>   			struct drm_bridge_state *old_bridge_state;
>   
>   			old_bridge_state =


-- 
With best wishes
Dmitry


More information about the dri-devel mailing list