From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.251.105.195 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796178028; b=GDl5pVJspvyuqVLIUopHLel4c2sZYhbGEpDhqtJAFexSw6nufXzdrjeSnzs34IUOt6WL pdYwvZzeRNTikbDK/loUr3ewr0V6vZFFB6tZzUeiEIaIQfm6tbtl9oJfs1mPuqsUwV1c5 ihevp7ScFCvqUqaKE3q9mxkFWSeLWt8bAjlnBQb1ZgtL39Z2kO1HXGQlZPu9VNXGmiiQ3 Suw8ycvTXELfvFyiWa1tStiskTrHobIyGY8a+FZQx8z0CHEYvkeHZRldblCBs1SPaqN8U fxIqBq3iGRD1ZtcIbwlusJUyia/yS1HAGI2y/V1BLcV4Tml4nl4B1sgI8W6Xlf6wBLQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796178028; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer; bh=bK93V3z89S70Mau4Fde7IW9klBJy9DVFaKUbQKgJ+5A=; b=tMEGs6uX1MLckOkoIldqKkRp9NEP3NMIy3RO3B6nmQGjfAxne3a4Xt5zPuiLVlILdaJm hJGDFCNCdX9RdoK8svmeBwE7784dG1ETL8MjbKpvriB7kvZVndw155EXoc/khvSATfMf0 lp9oJ6n2LYi9wfpZcsDYwGuJySoOfjctdp9SNn994HoGWc/ywtp/6w6fl+pk9EWFM/Nty ojVxRHbNSQQe4UgGhtC/63UtxQvMasecaTvbJ1/uTGZ/3pB3NVhejmB++soj3g65M2WAH 0ivqod1y48KCH1qJzg1Y697o0KMzBGY2INewdufb1XMqXjSI78/bJG37MMHJnwZugqw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=BYQmIKhp; arc=none smtp.remote-ip=148.251.105.195 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C092606A329; Wed, 2 Dec 2026 02:20:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6C092606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=BYQmIKhp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796178019; bh=UPkuu0ZZMVOCYSC2PoyzWg1LhUj0rFAoYHpEAat2XP0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BYQmIKhpz12rxlOFts2cREbi4PapJuwTo6pdd6eosDziQaPr296z4todzsRU9IAsq 3ri1e+lfb7wMiyr++5Ro2Ku5G1G26afo21+seZ9IPuQxNun/xa/7rzqw3XO9NTd6kR 4wm8/+RWXFVak+aXyH2oqswUUb+oTJNLbbo7rVHXywzWUKP64PPpJWDJSxaHkh3mnW 7t3av8u7t/IhPTHAU15Bn9WCfy1d6txIArjJ6CbxTzlQSs8f0dZBAj1dr8fLQJMpWr cVFGhKsHeb+HJFE+g8uC79N+VkBl32a11GFUjgXd45EMEXqucFecj7pZeioTyT/Hy+ dTmvc8000LQkg== Received: from localhost (unknown [100.64.0.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 83C6B17E0E34; Wed, 02 Dec 2026 03:20:19 +0100 (CET) From: Cristian Ciocaltea Date: Wed, 02 Dec 2026 04:19:56 +0200 Subject: [PATCH v2 02/25] video/hdmi: Define SPD InfoFrame vendor/product field lengths X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261202-drm-conn-hdmi-cleanup-v2-2-ba7d32550ea4@collabora.com> References: <20261202-drm-conn-hdmi-cleanup-v2-0-ba7d32550ea4@collabora.com> In-Reply-To: <20261202-drm-conn-hdmi-cleanup-v2-0-ba7d32550ea4@collabora.com> To: Helge Deller , Thomas Zimmermann , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , David Airlie , Simona Vetter Cc: kernel@collabora.com, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15.2 The HDMI specification defines the SPD InfoFrame Vendor Name and Product Description as fixed-size fields of 8 and 16 bytes respectively. Add defines for those lengths and use them in place of the related magic numbers, including the payload offsets and the log format precisions. While at it, fix the continuation line alignment in hdmi_spd_infoframe_log(). No functional change intended. Reviewed-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/video/hdmi.c | 20 +++++++++++++------- include/linux/hdmi.h | 7 +++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c index cd18121afa20..7eeadac2de69 100644 --- a/drivers/video/hdmi.c +++ b/drivers/video/hdmi.c @@ -304,9 +304,11 @@ ssize_t hdmi_spd_infoframe_pack_only(const struct hdmi_spd_infoframe *frame, ptr += HDMI_INFOFRAME_HEADER_SIZE; memcpy(ptr, frame->vendor, sizeof(frame->vendor)); - memcpy(ptr + 8, frame->product, sizeof(frame->product)); + memcpy(ptr + HDMI_SPD_INFOFRAME_VENDOR_LEN, frame->product, + sizeof(frame->product)); - ptr[24] = frame->sdi; + ptr[HDMI_SPD_INFOFRAME_VENDOR_LEN + HDMI_SPD_INFOFRAME_PRODUCT_LEN] = + frame->sdi; hdmi_infoframe_set_checksum(buffer, length); @@ -1284,10 +1286,12 @@ static void hdmi_spd_infoframe_log(const char *level, hdmi_infoframe_log_header(level, dev, (const struct hdmi_any_infoframe *)frame); - hdmi_log(" vendor: %.8s\n", frame->vendor); - hdmi_log(" product: %.16s\n", frame->product); + hdmi_log(" vendor: %.*s\n", HDMI_SPD_INFOFRAME_VENDOR_LEN, + frame->vendor); + hdmi_log(" product: %.*s\n", HDMI_SPD_INFOFRAME_PRODUCT_LEN, + frame->product); hdmi_log(" source device information: %s (0x%x)\n", - hdmi_spd_sdi_get_name(frame->sdi), frame->sdi); + hdmi_spd_sdi_get_name(frame->sdi), frame->sdi); } static const char * @@ -1642,11 +1646,13 @@ static int hdmi_spd_infoframe_unpack(struct hdmi_spd_infoframe *frame, ptr += HDMI_INFOFRAME_HEADER_SIZE; - ret = hdmi_spd_infoframe_init(frame, ptr, ptr + 8); + ret = hdmi_spd_infoframe_init(frame, ptr, + ptr + HDMI_SPD_INFOFRAME_VENDOR_LEN); if (ret) return ret; - frame->sdi = ptr[24]; + frame->sdi = ptr[HDMI_SPD_INFOFRAME_VENDOR_LEN + + HDMI_SPD_INFOFRAME_PRODUCT_LEN]; return 0; } diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index 08922d5330d6..7d96821b486d 100644 --- a/include/linux/hdmi.h +++ b/include/linux/hdmi.h @@ -267,12 +267,15 @@ enum hdmi_spd_sdi { HDMI_SPD_SDI_PMP, }; +#define HDMI_SPD_INFOFRAME_VENDOR_LEN 8 +#define HDMI_SPD_INFOFRAME_PRODUCT_LEN 16 + struct hdmi_spd_infoframe { enum hdmi_infoframe_type type; unsigned char version; unsigned char length; - char vendor[8] __nonstring; - char product[16] __nonstring; + char vendor[HDMI_SPD_INFOFRAME_VENDOR_LEN] __nonstring; + char product[HDMI_SPD_INFOFRAME_PRODUCT_LEN] __nonstring; enum hdmi_spd_sdi sdi; }; -- 2.56.0