The waveshare-dsi 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/waveshare-dsi.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/waveshare-dsi.c 
b/drivers/gpu/drm/bridge/waveshare-dsi.c
index ded57f298d64..9c9825c9b7c5 100644
--- a/drivers/gpu/drm/bridge/waveshare-dsi.c
+++ b/drivers/gpu/drm/bridge/waveshare-dsi.c
@@ -10,10 +10,11 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_graph.h>
 #include <linux/regmap.h>
 
+#include <drm/drm_atomic_state_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 
@@ -90,29 +91,34 @@ static int ws_bridge_bridge_attach(struct drm_bridge 
*bridge,
 
        return drm_bridge_attach(encoder, ws->next_bridge,
                                 &ws->bridge, flags);
 }
 
-static void ws_bridge_bridge_enable(struct drm_bridge *bridge)
+static void ws_bridge_bridge_enable(struct drm_bridge *bridge,
+                                   struct drm_atomic_commit *commit)
 {
        struct ws_bridge *ws = bridge_to_ws_bridge(bridge);
 
        regmap_write(ws->reg_map, 0xad, 0x01);
        backlight_enable(ws->backlight);
 }
 
-static void ws_bridge_bridge_disable(struct drm_bridge *bridge)
+static void ws_bridge_bridge_disable(struct drm_bridge *bridge,
+                                    struct drm_atomic_commit *commit)
 {
        struct ws_bridge *ws = bridge_to_ws_bridge(bridge);
 
        backlight_disable(ws->backlight);
        regmap_write(ws->reg_map, 0xad, 0x00);
 }
 
 static const struct drm_bridge_funcs ws_bridge_bridge_funcs = {
-       .enable = ws_bridge_bridge_enable,
-       .disable = ws_bridge_bridge_disable,
+       .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,
+       .atomic_enable = ws_bridge_bridge_enable,
+       .atomic_disable = ws_bridge_bridge_disable,
        .attach = ws_bridge_bridge_attach,
 };
 
 static int ws_bridge_bl_update_status(struct backlight_device *bl)
 {

-- 
2.54.0

Reply via email to