The lvds-codec bridge uses the legacy non-atomic enable and disable
bridge callbacks.

In order to remove the legacy bridge callback support from the DRM
bridge core, switch to their atomic counterparts and add the bridge
atomic state handlers.

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 @
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 @
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 @
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 @
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)
 {
        ...
 }

Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Maxime Ripard <[email protected]>
---
 drivers/gpu/drm/bridge/lvds-codec.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/lvds-codec.c 
b/drivers/gpu/drm/bridge/lvds-codec.c
index d1135dc3b99f..a82ea0c944eb 100644
--- a/drivers/gpu/drm/bridge/lvds-codec.c
+++ b/drivers/gpu/drm/bridge/lvds-codec.c
@@ -41,11 +41,12 @@ static int lvds_codec_attach(struct drm_bridge *bridge,
 
        return drm_bridge_attach(encoder, lvds_codec->panel_bridge,
                                 bridge, flags);
 }
 
-static void lvds_codec_enable(struct drm_bridge *bridge)
+static void lvds_codec_enable(struct drm_bridge *bridge,
+                             struct drm_atomic_commit *commit)
 {
        struct lvds_codec *lvds_codec = to_lvds_codec(bridge);
        int ret;
 
        ret = regulator_enable(lvds_codec->vcc);
@@ -57,11 +58,12 @@ static void lvds_codec_enable(struct drm_bridge *bridge)
 
        if (lvds_codec->powerdown_gpio)
                gpiod_set_value_cansleep(lvds_codec->powerdown_gpio, 0);
 }
 
-static void lvds_codec_disable(struct drm_bridge *bridge)
+static void lvds_codec_disable(struct drm_bridge *bridge,
+                              struct drm_atomic_commit *commit)
 {
        struct lvds_codec *lvds_codec = to_lvds_codec(bridge);
        int ret;
 
        if (lvds_codec->powerdown_gpio)
@@ -98,12 +100,12 @@ lvds_codec_atomic_get_input_bus_fmts(struct drm_bridge 
*bridge,
        return input_fmts;
 }
 
 static const struct drm_bridge_funcs funcs = {
        .attach = lvds_codec_attach,
-       .enable = lvds_codec_enable,
-       .disable = lvds_codec_disable,
+       .atomic_enable = lvds_codec_enable,
+       .atomic_disable = lvds_codec_disable,
        .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
        .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
        .atomic_create_state = drm_atomic_helper_bridge_create_state,
        .atomic_get_input_bus_fmts = lvds_codec_atomic_get_input_bus_fmts,
 };

-- 
2.54.0

Reply via email to