All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: dri-devel@lists.freedesktop.org,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [PATCH v2 14/39] drm/bridge: anx7625: switch to ->edid_read callback
Date: Wed,  3 Jan 2024 12:08:28 +0200	[thread overview]
Message-ID: <dfb0a454657894ad61b171fc9aecc6d7d597b02d.1704276309.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1704276309.git.jani.nikula@intel.com>

Prefer using the struct drm_edid based callback.

v2: Fix build (goto out;)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 30 ++++++++---------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index ef31033439bc..25f7afa408c2 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1782,24 +1782,14 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux,
 	return ret;
 }
 
-static struct edid *anx7625_get_edid(struct anx7625_data *ctx)
+static const struct drm_edid *anx7625_edid_read(struct anx7625_data *ctx)
 {
 	struct device *dev = ctx->dev;
 	struct s_edid_data *p_edid = &ctx->slimport_edid_p;
 	int edid_num;
-	u8 *edid;
 
-	edid = kmalloc(FOUR_BLOCK_SIZE, GFP_KERNEL);
-	if (!edid) {
-		DRM_DEV_ERROR(dev, "Fail to allocate buffer\n");
-		return NULL;
-	}
-
-	if (ctx->slimport_edid_p.edid_block_num > 0) {
-		memcpy(edid, ctx->slimport_edid_p.edid_raw_data,
-		       FOUR_BLOCK_SIZE);
-		return (struct edid *)edid;
-	}
+	if (ctx->slimport_edid_p.edid_block_num > 0)
+		goto out;
 
 	pm_runtime_get_sync(dev);
 	_anx7625_hpd_polling(ctx, 5000 * 100);
@@ -1808,14 +1798,14 @@ static struct edid *anx7625_get_edid(struct anx7625_data *ctx)
 
 	if (edid_num < 1) {
 		DRM_DEV_ERROR(dev, "Fail to read EDID: %d\n", edid_num);
-		kfree(edid);
 		return NULL;
 	}
 
 	p_edid->edid_block_num = edid_num;
 
-	memcpy(edid, ctx->slimport_edid_p.edid_raw_data, FOUR_BLOCK_SIZE);
-	return (struct edid *)edid;
+out:
+	return drm_edid_alloc(ctx->slimport_edid_p.edid_raw_data,
+			      FOUR_BLOCK_SIZE);
 }
 
 static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx)
@@ -2488,15 +2478,15 @@ anx7625_bridge_detect(struct drm_bridge *bridge)
 	return anx7625_sink_detect(ctx);
 }
 
-static struct edid *anx7625_bridge_get_edid(struct drm_bridge *bridge,
-					    struct drm_connector *connector)
+static const struct drm_edid *anx7625_bridge_edid_read(struct drm_bridge *bridge,
+						       struct drm_connector *connector)
 {
 	struct anx7625_data *ctx = bridge_to_anx7625(bridge);
 	struct device *dev = ctx->dev;
 
 	DRM_DEV_DEBUG_DRIVER(dev, "drm bridge get edid\n");
 
-	return anx7625_get_edid(ctx);
+	return anx7625_edid_read(ctx);
 }
 
 static const struct drm_bridge_funcs anx7625_bridge_funcs = {
@@ -2511,7 +2501,7 @@ static const struct drm_bridge_funcs anx7625_bridge_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
 	.atomic_reset = drm_atomic_helper_bridge_reset,
 	.detect = anx7625_bridge_detect,
-	.get_edid = anx7625_bridge_get_edid,
+	.edid_read = anx7625_bridge_edid_read,
 };
 
 static int anx7625_register_i2c_dummy_clients(struct anx7625_data *ctx,
-- 
2.39.2


  parent reply	other threads:[~2024-01-03 10:10 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 10:08 [PATCH v2 00/39] drm/bridge: switch to struct drm_edid Jani Nikula
2024-01-03 10:08 ` [PATCH v2 01/39] drm/bridge: add ->edid_read hook and drm_bridge_edid_read() Jani Nikula
2024-01-03 10:08 ` [PATCH v2 02/39] drm/bridge: switch to drm_bridge_read_edid() Jani Nikula
2024-01-03 10:33   ` Thomas Zimmermann
2024-01-03 10:57     ` Jani Nikula
2024-01-03 10:08 ` [PATCH v2 03/39] drm/bridge: chrontel-ch7033: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 04/39] drm/bridge: lt8912b: use drm_bridge_read_edid() Jani Nikula
2024-01-03 10:08 ` [PATCH v2 05/39] drm/bridge: lt8912b: clear the EDID property on failures Jani Nikula
2024-01-03 10:08 ` [PATCH v2 06/39] drm/bridge: lt8912b: use ->edid_read callback Jani Nikula
2024-01-03 10:08 ` [PATCH v2 07/39] drm/bridge: lt9611uxc: use drm_bridge_read_edid() Jani Nikula
2024-01-03 10:08 ` [PATCH v2 08/39] drm: bridge: simple-bridge: use drm_bridge_edid_read() Jani Nikula
2024-01-03 10:08 ` [PATCH v2 09/39] drm: bridge: simple-bridge: clear the EDID property on failures Jani Nikula
2024-01-03 10:08 ` [PATCH v2 10/39] drm/bridge: tfp410: use drm_bridge_edid_read() Jani Nikula
2024-01-03 10:08 ` [PATCH v2 11/39] drm/bridge: tfp410: clear the EDID property on failures Jani Nikula
2024-01-03 10:08 ` [PATCH v2 12/39] drm/meson: switch to drm_bridge_edid_read() Jani Nikula
2024-01-03 10:08 ` [PATCH v2 13/39] drm/bridge: remove drm_bridge_get_edid() in favour of drm_bridge_edid_read() Jani Nikula
2024-01-03 10:08 ` Jani Nikula [this message]
2024-01-03 10:08 ` [PATCH v2 15/39] drm/bridge: cdns-mhdp8546: switch to ->edid_read callback Jani Nikula
2024-01-03 10:08 ` [PATCH v2 16/39] drm/bridge: cdns-mhdp8546: clear the EDID property on failures Jani Nikula
2024-01-03 10:08 ` [PATCH v2 17/39] drm/bridge: display-connector: switch to ->edid_read callback Jani Nikula
2024-01-03 10:08 ` [PATCH v2 18/39] drm/bridge: it6505: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 19/39] drm: bridge: it66121: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 20/39] drm/bridge: lt9611: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 21/39] drm/bridge: lt9611uxc: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 22/39] drm/bridge: megachips: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 23/39] drm/bridge: nxp-ptn3460: " Jani Nikula
2024-01-03 20:20   ` kernel test robot
2024-01-03 20:20     ` kernel test robot
2024-01-04 12:17     ` Jani Nikula
2024-01-09 10:14   ` [PATCH v2] " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 24/39] drm/bridge: sii902x: use display info is_hdmi Jani Nikula
2024-01-03 10:08 ` [PATCH v2 25/39] drm/bridge: sii902x: switch to ->edid_read callback Jani Nikula
2024-01-03 10:08 ` [PATCH v2 26/39] drm/mediatek/dp: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 27/39] drm/mediatek/hdmi: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 28/39] drm/msm/hdmi: fix indent Jani Nikula
2024-01-03 10:08 ` [PATCH v2 29/39] drm/msm/hdmi: switch to ->edid_read callback Jani Nikula
2024-01-03 10:08 ` [PATCH v2 30/39] drm/omap/hdmi4: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 31/39] drm/omap/hdmi5: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 32/39] drm: xlnx: zynqmp_dpsub: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 33/39] drm: adv7511: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 34/39] drm: bridge: dw_hdmi: " Jani Nikula
2024-01-04  5:44   ` kernel test robot
2024-01-04  5:44     ` kernel test robot
2024-01-04 12:21     ` Jani Nikula
2024-01-09 10:11   ` [PATCH v2] drm/bridge: nxp-ptn3460: " Jani Nikula
2024-01-09 10:16     ` Jani Nikula
2024-01-09 10:13   ` [PATCH v2] drm: bridge: dw_hdmi: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 35/39] drm: bridge: dw_hdmi: clear the EDID property and CEC address on failures Jani Nikula
2024-01-03 10:08 ` [PATCH v2 36/39] drm/bridge: tc358767: update the EDID property Jani Nikula
2024-01-03 10:08 ` [PATCH v2 37/39] drm/bridge: tc358767: switch to ->edid_read callback Jani Nikula
2024-01-03 10:08 ` [PATCH v2 38/39] drm/bridge: ti-sn65dsi86: " Jani Nikula
2024-01-03 10:08 ` [PATCH v2 39/39] drm/bridge: remove ->get_edid callback Jani Nikula
2024-01-03 10:11 ` [PATCH v2 00/39] drm/bridge: switch to struct drm_edid Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfb0a454657894ad61b171fc9aecc6d7d597b02d.1704276309.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.