diff mbox series

[RESEND,1/6] drm/bridge/analogix/anx6345: switch to struct drm_edid

Message ID 74b2f00e17b2614b44955cf0cbae270f3c31d91a.1715347488.git.jani.nikula@intel.com (mailing list archive)
State Accepted
Headers show
Series drm: struct drm_edid conversions | expand

Commit Message

Jani Nikula May 10, 2024, 1:26 p.m. UTC
Prefer struct drm_edid based functions over struct edid.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Robert Foss <rfoss@kernel.org>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 .../gpu/drm/bridge/analogix/analogix-anx6345.c    | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Robert Foss May 13, 2024, 5:08 p.m. UTC | #1
On Fri, May 10, 2024 at 3:26 PM Jani Nikula <jani.nikula@intel.com> wrote:
>
> Prefer struct drm_edid based functions over struct edid.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> ---
>
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Robert Foss <rfoss@kernel.org>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Jonas Karlman <jonas@kwiboo.se>
> Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---
>  .../gpu/drm/bridge/analogix/analogix-anx6345.c    | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> index c9e35731e6a1..42ab6014fe12 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> @@ -47,7 +47,7 @@ struct anx6345 {
>         struct drm_dp_aux aux;
>         struct drm_bridge bridge;
>         struct i2c_client *client;
> -       struct edid *edid;
> +       const struct drm_edid *drm_edid;
>         struct drm_connector connector;
>         struct drm_panel *panel;
>         struct regulator *dvdd12;
> @@ -458,7 +458,7 @@ static int anx6345_get_modes(struct drm_connector *connector)
>
>         mutex_lock(&anx6345->lock);
>
> -       if (!anx6345->edid) {
> +       if (!anx6345->drm_edid) {
>                 if (!anx6345->powered) {
>                         anx6345_poweron(anx6345);
>                         power_off = true;
> @@ -470,19 +470,18 @@ static int anx6345_get_modes(struct drm_connector *connector)
>                         goto unlock;
>                 }
>
> -               anx6345->edid = drm_get_edid(connector, &anx6345->aux.ddc);
> -               if (!anx6345->edid)
> +               anx6345->drm_edid = drm_edid_read_ddc(connector, &anx6345->aux.ddc);
> +               if (!anx6345->drm_edid)
>                         DRM_ERROR("Failed to read EDID from panel\n");
>
> -               err = drm_connector_update_edid_property(connector,
> -                                                        anx6345->edid);
> +               err = drm_edid_connector_update(connector, anx6345->drm_edid);
>                 if (err) {
>                         DRM_ERROR("Failed to update EDID property: %d\n", err);
>                         goto unlock;
>                 }
>         }
>
> -       num_modes += drm_add_edid_modes(connector, anx6345->edid);
> +       num_modes += drm_edid_connector_add_modes(connector);
>
>         /* Driver currently supports only 6bpc */
>         connector->display_info.bpc = 6;
> @@ -793,7 +792,7 @@ static void anx6345_i2c_remove(struct i2c_client *client)
>
>         unregister_i2c_dummy_clients(anx6345);
>
> -       kfree(anx6345->edid);
> +       drm_edid_free(anx6345->drm_edid);
>
>         mutex_destroy(&anx6345->lock);
>  }
> --
> 2.39.2
>

Reviewed-by: Robert Foss <rfoss@kernel.org>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
index c9e35731e6a1..42ab6014fe12 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -47,7 +47,7 @@  struct anx6345 {
 	struct drm_dp_aux aux;
 	struct drm_bridge bridge;
 	struct i2c_client *client;
-	struct edid *edid;
+	const struct drm_edid *drm_edid;
 	struct drm_connector connector;
 	struct drm_panel *panel;
 	struct regulator *dvdd12;
@@ -458,7 +458,7 @@  static int anx6345_get_modes(struct drm_connector *connector)
 
 	mutex_lock(&anx6345->lock);
 
-	if (!anx6345->edid) {
+	if (!anx6345->drm_edid) {
 		if (!anx6345->powered) {
 			anx6345_poweron(anx6345);
 			power_off = true;
@@ -470,19 +470,18 @@  static int anx6345_get_modes(struct drm_connector *connector)
 			goto unlock;
 		}
 
-		anx6345->edid = drm_get_edid(connector, &anx6345->aux.ddc);
-		if (!anx6345->edid)
+		anx6345->drm_edid = drm_edid_read_ddc(connector, &anx6345->aux.ddc);
+		if (!anx6345->drm_edid)
 			DRM_ERROR("Failed to read EDID from panel\n");
 
-		err = drm_connector_update_edid_property(connector,
-							 anx6345->edid);
+		err = drm_edid_connector_update(connector, anx6345->drm_edid);
 		if (err) {
 			DRM_ERROR("Failed to update EDID property: %d\n", err);
 			goto unlock;
 		}
 	}
 
-	num_modes += drm_add_edid_modes(connector, anx6345->edid);
+	num_modes += drm_edid_connector_add_modes(connector);
 
 	/* Driver currently supports only 6bpc */
 	connector->display_info.bpc = 6;
@@ -793,7 +792,7 @@  static void anx6345_i2c_remove(struct i2c_client *client)
 
 	unregister_i2c_dummy_clients(anx6345);
 
-	kfree(anx6345->edid);
+	drm_edid_free(anx6345->drm_edid);
 
 	mutex_destroy(&anx6345->lock);
 }