The tegra DSI and SOR connector reset implementations create custom
state subclasses, but only initialize a pristine state without resetting
any hardware. This is equivalent to what atomic_create_state expects.
Convert to it.

Signed-off-by: Maxime Ripard <[email protected]>
---
Cc: Jonathan Hunter <[email protected]>
Cc: Mikko Perttunen <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: [email protected]
---
 drivers/gpu/drm/tegra/dsi.c | 17 ++++++++---------
 drivers/gpu/drm/tegra/sor.c | 13 +++++--------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 7b595310e737..e4d842119bef 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -783,23 +783,22 @@ static void tegra_dsi_soft_reset(struct tegra_dsi *dsi)
 
        if (dsi->slave)
                tegra_dsi_soft_reset(dsi->slave);
 }
 
-static void tegra_dsi_connector_reset(struct drm_connector *connector)
+static struct drm_connector_state *
+tegra_dsi_connector_create_state(struct drm_connector *connector)
 {
-       struct tegra_dsi_state *state = kzalloc_obj(*state);
+       struct tegra_dsi_state *state;
 
+       state = kzalloc_obj(*state);
        if (!state)
-               return;
+               return ERR_PTR(-ENOMEM);
 
-       if (connector->state) {
-               __drm_atomic_helper_connector_destroy_state(connector->state);
-               kfree(connector->state);
-       }
+       __drm_atomic_helper_connector_state_init(&state->base, connector);
 
-       __drm_atomic_helper_connector_reset(connector, &state->base);
+       return &state->base;
 }
 
 static struct drm_connector_state *
 tegra_dsi_connector_duplicate_state(struct drm_connector *connector)
 {
@@ -815,11 +814,11 @@ tegra_dsi_connector_duplicate_state(struct drm_connector 
*connector)
 
        return &copy->base;
 }
 
 static const struct drm_connector_funcs tegra_dsi_connector_funcs = {
-       .reset = tegra_dsi_connector_reset,
+       .atomic_create_state = tegra_dsi_connector_create_state,
        .detect = tegra_output_connector_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .destroy = tegra_output_connector_destroy,
        .atomic_duplicate_state = tegra_dsi_connector_duplicate_state,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index e384cbd0cbf7..fd60acd22ed1 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -1718,24 +1718,21 @@ static void tegra_sor_early_unregister(struct 
drm_connector *connector)
                                 connector->dev->primary);
        kfree(sor->debugfs_files);
        sor->debugfs_files = NULL;
 }
 
-static void tegra_sor_connector_reset(struct drm_connector *connector)
+static struct drm_connector_state *tegra_sor_connector_create_state(struct 
drm_connector *connector)
 {
        struct tegra_sor_state *state;
 
        state = kzalloc_obj(*state);
        if (!state)
-               return;
+               return ERR_PTR(-ENOMEM);
 
-       if (connector->state) {
-               __drm_atomic_helper_connector_destroy_state(connector->state);
-               kfree(connector->state);
-       }
+       __drm_atomic_helper_connector_state_init(&state->base, connector);
 
-       __drm_atomic_helper_connector_reset(connector, &state->base);
+       return &state->base;
 }
 
 static enum drm_connector_status
 tegra_sor_connector_detect(struct drm_connector *connector, bool force)
 {
@@ -1762,11 +1759,11 @@ tegra_sor_connector_duplicate_state(struct 
drm_connector *connector)
 
        return &copy->base;
 }
 
 static const struct drm_connector_funcs tegra_sor_connector_funcs = {
-       .reset = tegra_sor_connector_reset,
+       .atomic_create_state = tegra_sor_connector_create_state,
        .detect = tegra_sor_connector_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .destroy = tegra_output_connector_destroy,
        .atomic_duplicate_state = tegra_sor_connector_duplicate_state,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,

-- 
2.55.0

Reply via email to