On Thu, Jun 25, 2026 at 10:08:21AM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 17.06.26 um 12:14 schrieb Maxime Ripard:
> > The analogix-anx6345 bridge still uses the deprecated non-atomic bridge
> > callbacks.
> > 
> > Switch to their atomic counterparts, adding the bridge state
> > handlers 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/analogix/analogix-anx6345.c | 13 +++++++++----
> >   1 file changed, 9 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c 
> > b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> > index f3fe47b12edc..eba5c6dcb5ad 100644
> > --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> > @@ -564,11 +564,12 @@ anx6345_bridge_mode_valid(struct drm_bridge *bridge,
> >             return MODE_CLOCK_HIGH;
> >     return MODE_OK;
> >   }
> > -static void anx6345_bridge_disable(struct drm_bridge *bridge)
> > +static void anx6345_bridge_disable(struct drm_bridge *bridge,
> > +                              struct drm_atomic_commit *commit)
> >   {
> >     struct anx6345 *anx6345 = bridge_to_anx6345(bridge);
> >     /* Power off all modules except configuration registers access */
> >     anx6345_set_bits(anx6345->map[I2C_IDX_TXCOM], SP_POWERDOWN_CTRL_REG,
> > @@ -578,11 +579,12 @@ static void anx6345_bridge_disable(struct drm_bridge 
> > *bridge)
> >     if (anx6345->powered)
> >             anx6345_poweroff(anx6345);
> >   }
> > -static void anx6345_bridge_enable(struct drm_bridge *bridge)
> > +static void anx6345_bridge_enable(struct drm_bridge *bridge,
> > +                             struct drm_atomic_commit *commit)
> >   {
> >     struct anx6345 *anx6345 = bridge_to_anx6345(bridge);
> >     int err;
> >     if (anx6345->panel)
> > @@ -598,15 +600,18 @@ static void anx6345_bridge_enable(struct drm_bridge 
> > *bridge)
> >     if (err)
> >             DRM_ERROR("Failed to enable DP output: %d\n", err);
> >   }
> >   static const struct drm_bridge_funcs anx6345_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 = anx6345_bridge_attach,
> >     .detach = anx6345_bridge_detach,
> >     .mode_valid = anx6345_bridge_mode_valid,
> > -   .disable = anx6345_bridge_disable,
> > -   .enable = anx6345_bridge_enable,
> > +   .atomic_disable = anx6345_bridge_disable,
> > +   .atomic_enable = anx6345_bridge_enable,
> 
> More of a style issue:  since these enable/disable helpers now implement the
> atomic callbacks, could they be renamed to _atomic_enable and
> _atomic_disable ?  IIRC I've seen other cases with _pre_enable and
> _post_disable that might be renamed as well.

I'd really prefer not to :)

It's going to be a pain to do automatically, and even more painful by hand.

Maxime

Attachment: signature.asc
Description: PGP signature

Reply via email to