On Wed, Jun 17, 2026 at 12:14:40PM +0200, Maxime Ripard wrote:
> The of-display-mode-bridge bridge still uses the deprecated non-atomic bridge
> callbacks.
>
> Switch to their atomic counterparts, adding the bridge state
> handlers if not already present.
The code looks fine, but the commit message could do with some
improvements. I don't see the driver "switching" to atomic callbacks,
and you can tailor the commit message to this specific patch to avoid
the "if not already present".
> Generated by the following Coccinelle script:
>
> @ is_bridge @
> identifier funcs;
> @@
>
> struct drm_bridge_funcs funcs = {
> ...,
> };
>
> @ has_create_state depends on is_bridge @
> identifier funcs, f;
> @@
>
> struct drm_bridge_funcs funcs = {
> ...,
> .atomic_create_state = f,
> ...,
> };
>
> @ update_struct depends on (is_bridge && !has_create_state) @
> identifier is_bridge.funcs;
> identifier f;
> @@
>
> struct drm_bridge_funcs funcs = {
> + .atomic_create_state = drm_atomic_helper_bridge_create_state,
> + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
> + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
> ...,
> };
>
> @ update_pre_enable_struct depends on (is_bridge && !has_create_state) @
> identifier is_bridge.funcs;
> identifier f;
> @@
>
> struct drm_bridge_funcs funcs = {
> ...,
> - .pre_enable = f,
> + .atomic_pre_enable = f,
> ...,
> };
>
> @ update_pre_enable_impl depends on update_pre_enable_struct @
> identifier update_pre_enable_struct.f;
> identifier b;
> @@
>
> -void f(struct drm_bridge *b)
> +void f(struct drm_bridge *b, struct drm_atomic_commit *commit)
> {
> ...
> }
>
> @ update_enable_struct depends on (is_bridge && !has_create_state) @
> identifier is_bridge.funcs;
> identifier f;
> @@
>
> struct drm_bridge_funcs funcs = {
> ...,
> - .enable = f,
> + .atomic_enable = f,
> ...,
> };
>
> @ update_enable_impl depends on update_enable_struct @
> identifier update_enable_struct.f;
> identifier b;
> @@
>
> -void f(struct drm_bridge *b)
> +void f(struct drm_bridge *b, struct drm_atomic_commit *commit)
> {
> ...
> }
>
> @ update_disable_struct depends on (is_bridge && !has_create_state) @
> identifier is_bridge.funcs;
> identifier f;
> @@
>
> struct drm_bridge_funcs funcs = {
> ...,
> - .disable = f,
> + .atomic_disable = f,
> ...,
> };
>
> @ update_disable_impl depends on update_disable_struct @
> identifier update_disable_struct.f;
> identifier b;
> @@
>
> -void f(struct drm_bridge *b)
> +void f(struct drm_bridge *b, struct drm_atomic_commit *commit)
> {
> ...
> }
>
> @ update_post_disable_struct depends on (is_bridge && !has_create_state) @
> identifier is_bridge.funcs;
> identifier f;
> @@
>
> struct drm_bridge_funcs funcs = {
> ...,
> - .post_disable = f,
> + .atomic_post_disable = f,
> ...,
> };
>
> @ update_post_disable_impl depends on update_post_disable_struct @
> identifier update_post_disable_struct.f;
> identifier b;
> @@
>
> -void f(struct drm_bridge *b)
> +void f(struct drm_bridge *b, struct drm_atomic_commit *commit)
> {
> ...
> }
>
> Signed-off-by: Maxime Ripard <[email protected]>
> ---
> drivers/gpu/drm/bridge/of-display-mode-bridge.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/of-display-mode-bridge.c
> b/drivers/gpu/drm/bridge/of-display-mode-bridge.c
> index cb15713f3a79..fd651d05428a 100644
> --- a/drivers/gpu/drm/bridge/of-display-mode-bridge.c
> +++ b/drivers/gpu/drm/bridge/of-display-mode-bridge.c
> @@ -7,10 +7,11 @@
> * Author: Dmitry Baryshkov <[email protected]>
> */
>
> #include <linux/export.h>
>
> +#include <drm/drm_atomic_state_helper.h>
> #include <drm/drm_bridge.h>
> #include <drm/drm_modes.h>
> #include <drm/drm_probe_helper.h>
> #include <drm/bridge/of-display-mode-bridge.h>
>
> @@ -50,10 +51,13 @@ static int of_display_mode_bridge_get_modes(struct
> drm_bridge *bridge,
>
> return 0;
> }
>
> struct drm_bridge_funcs of_display_mode_bridge_funcs = {
> + .atomic_create_state = drm_atomic_helper_bridge_create_state,
> + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
> + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
> .attach = of_display_mode_bridge_attach,
> .get_modes = of_display_mode_bridge_get_modes,
> };
>
> struct drm_bridge *devm_drm_of_display_mode_bridge(struct device *dev,
>
--
Regards,
Laurent Pinchart