From nobody Tue Feb 10 02:30:24 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FC0F199B9 for ; Sun, 18 Aug 2024 10:43:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723977827; cv=none; b=bQe57TEnBsuAIC9WZU7Wifxs23e/D+RAVMJq7t1pk93h1clZ9hcsIQWre1nRUSmy2Y+xEHqcKSf8+ZvoE6y7tQCkdkLTHk8AxH9by2WuM7HTwTMvFJEnzyzAqi5eLWvuHLqInvzfyRPuNQ1eSZ7Y97kWjpJ0jdzInaeNdS30xMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723977827; c=relaxed/simple; bh=fKGZWTylCrkUKzQxU1idZr4kJxvtu34DylGKZuIhUtA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oICirkFnP6AaXXYxaPdBzBCQ0nEM6rjqawtG+jYBtTqrGJ1PT1uXjfDiQZVK2QvPhmNS5WdFl984W4HqkAcgRfEHbYB3D1Y8tapkuVfWZhkfC1tV9nnJ2wUKF3ZZOXa6zEc5XIest+aJ1fBqZx2WXFjvdft0uMr9FCDuVph1kNc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=GupqK+Wr; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="GupqK+Wr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1723977821; bh=fKGZWTylCrkUKzQxU1idZr4kJxvtu34DylGKZuIhUtA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GupqK+WrC/nHKVQ5eWB9kr93LX9LI6thKXSmKxYtAVW1ijm/f+ffxRvsdc0QgIrAy D1HMYMDaCwnEgcfh2gfd6oKBmUZ6H9Q9vjwQvelhd8rbP77BGxPczu5nq8EBfXdzWj IJX0GZbbNw6KQIWE+p3yo476z/JDy9mF1S7L5wtM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 18 Aug 2024 12:43:28 +0200 Subject: [PATCH 04/12] drm/amd/display: Simplify raw_edid handling in dm_helpers_parse_edid_caps() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240818-amdgpu-drm_edid-v1-4-aea66c1f7cf4@weissschuh.net> References: <20240818-amdgpu-drm_edid-v1-0-aea66c1f7cf4@weissschuh.net> In-Reply-To: <20240818-amdgpu-drm_edid-v1-0-aea66c1f7cf4@weissschuh.net> To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , Daniel Vetter , jinzh , Aric Cyr , Alan Liu , Tony Cheng , Andrey Grodzovsky , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Harry Wentland , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723977820; l=1951; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=fKGZWTylCrkUKzQxU1idZr4kJxvtu34DylGKZuIhUtA=; b=D+2ZzYzLkZGs1ZeuVCYAu/pTWlUI0ONm5mk0bbsmU6kf5nUOmkTVd8DylIc43uDOMTa63uem3 UdTFJEirwidAlIhNDuac7hDAswD6GOTLuWTrqVB0QK2uUqayvmPTDao X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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=C3=9Fschuh --- 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/dr= ivers/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 =3D link->priv; struct drm_connector *connector =3D &aconnector->base; - struct edid *edid_buf =3D edid ? (struct edid *) edid->raw_edid : NULL; + struct edid *edid_buf; struct cea_sad *sads; int sad_count =3D -1; int sadb_count =3D -1; @@ -106,6 +106,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps( if (!edid_caps || !edid) return EDID_BAD_INPUT; =20 + edid_buf =3D (struct edid *)edid->raw_edid; + if (!drm_edid_is_valid(edid_buf)) result =3D EDID_BAD_CHECKSUM; =20 @@ -125,7 +127,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( =20 apply_edid_quirks(edid_buf, edid_caps); =20 - sad_count =3D drm_edid_to_sad((struct edid *) edid->raw_edid, &sads); + sad_count =3D drm_edid_to_sad(edid_buf, &sads); if (sad_count <=3D 0) return result; =20 @@ -139,7 +141,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->audio_modes[i].sample_size =3D sad->byte2; } =20 - sadb_count =3D drm_edid_to_speaker_allocation((struct edid *) edid->raw_e= did, &sadb); + sadb_count =3D drm_edid_to_speaker_allocation(edid_buf, &sadb); =20 if (sadb_count < 0) { DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sadb_coun= t); --=20 2.46.0