[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240818-amdgpu-drm_edid-v1-4-aea66c1f7cf4@weissschuh.net>
Date: Sun, 18 Aug 2024 12:43:28 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Harry Wentland <harry.wentland@....com>, Leo Li <sunpeng.li@....com>,
Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
Xinhui Pan <Xinhui.Pan@....com>, David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, jinzh <jinzh@...hub.amd.com>,
Aric Cyr <Aric.Cyr@....com>, Alan Liu <HaoPing.Liu@....com>,
Tony Cheng <Tony.Cheng@....com>,
Andrey Grodzovsky <Andrey.Grodzovsky@....com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>
Cc: amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, Harry Wentland <Harry.Wentland@....com>,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 04/12] drm/amd/display: Simplify raw_edid handling in
dm_helpers_parse_edid_caps()
Reduce the number of casts needed by reusing the edid_buf variable.
Also initialize edid_buf after the !edid case has been handled to avoid
the ternary expression.
Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index 165e010fe69c..3cc0808f391a 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -94,7 +94,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
{
struct amdgpu_dm_connector *aconnector = link->priv;
struct drm_connector *connector = &aconnector->base;
- struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid : NULL;
+ struct edid *edid_buf;
struct cea_sad *sads;
int sad_count = -1;
int sadb_count = -1;
@@ -106,6 +106,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
if (!edid_caps || !edid)
return EDID_BAD_INPUT;
+ edid_buf = (struct edid *)edid->raw_edid;
+
if (!drm_edid_is_valid(edid_buf))
result = EDID_BAD_CHECKSUM;
@@ -125,7 +127,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
apply_edid_quirks(edid_buf, edid_caps);
- sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads);
+ sad_count = drm_edid_to_sad(edid_buf, &sads);
if (sad_count <= 0)
return result;
@@ -139,7 +141,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
edid_caps->audio_modes[i].sample_size = sad->byte2;
}
- sadb_count = drm_edid_to_speaker_allocation((struct edid *) edid->raw_edid, &sadb);
+ sadb_count = drm_edid_to_speaker_allocation(edid_buf, &sadb);
if (sadb_count < 0) {
DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sadb_count);
--
2.46.0
Powered by blists - more mailing lists