From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 6F0EC40B392 for ; Mon, 17 Aug 2026 11:41:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786966887; cv=none; b=g4o5Qqvqf2rgsOM/f3tDOyAS7KaclSxexU5DyHkVEpVizqzA5n03unCWdbbhX8U79TfdRNtNy440F1pmRRX8/kPHSVtdUiHrND/ggnTgOH2hFYlVXDMzVYA3nmHyTffc62UgOkR/mrJiVNZuXTzhGKGbHDTNKP6TIUp/uK7mIR8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786966887; c=relaxed/simple; bh=iF8KpoytzvpnqLwM+WPDFZesluui1b680ixY9h/BEKs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YcY37MrqburO8W7y+1frhNO/HGOF6UfgcScMonA6XQMBjV3USKYSShEb9VhcFqvkYAdm45F9tQg8+UJjCjaqbMbrtVWXyYB9eeffDx4Nb8gXjqA059AeQXtYLupzG+JY4iwv9owBKNrrD8zoJsgVmlfONJVVG1RpiGOusA6tncE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=h6kUJmlr; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="h6kUJmlr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786966885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yF5hSMmrhAchBrFi1aBwQrM8p8lTLNxn2Y/Hj6Zq5sA=; b=h6kUJmlr7fOm7WMPXIX7qvw3BALvnRjY2YoR3boPKsHMdNQdQTlbDqS9QYZP66iFoas5Dl ijPNlh7WM9iZ1ssW6JfL3TASZFHEUh/N4oupD5em7fRmsFvTNVySpDLvaupFrBN1wNOgb5 LKSAscoCnxq4zjNGm2IX+utXIt0ccOY= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-549-AcEoYBedOZm0vnA0TqXCCA-1; Mon, 17 Aug 2026 07:41:09 -0400 X-MC-Unique: AcEoYBedOZm0vnA0TqXCCA-1 X-Mimecast-MFC-AGG-ID: AcEoYBedOZm0vnA0TqXCCA_1786966866 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2A7DF1800471; Mon, 17 Aug 2026 11:41:06 +0000 (UTC) Received: from [192.168.1.153] (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 52B69422; Mon, 17 Aug 2026 11:41:01 +0000 (UTC) From: Albert Esteve Date: Mon, 17 Aug 2026 13:40:47 +0200 Subject: [PATCH 2/5] rust: drm: add connector abstraction Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260817-drm_panel_bindings-v1-2-1f974508a31c@redhat.com> References: <20260817-drm_panel_bindings-v1-0-1f974508a31c@redhat.com> In-Reply-To: <20260817-drm_panel_bindings-v1-0-1f974508a31c@redhat.com> To: Rob Herring , Saravana Kannan , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , David Airlie , Simona Vetter Cc: devicetree@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Albert Esteve , mripard@kernel.org X-Developer-Signature: v=1; a=ed25519-sha256; t=1786966849; l=2548; i=aesteve@redhat.com; s=20260303; h=from:subject:message-id; bh=iF8KpoytzvpnqLwM+WPDFZesluui1b680ixY9h/BEKs=; b=3yFrkKa4o8rqbjEkeGSkXfrl1LovnqUzx3mw+hXpd+psOy8Bh6nBQuEewpstRcMUwhbafMc2i 0hvL9nzn65LCnTCZvI6rGEcY5VlFbAOeqhlZ+rP99E3KZ2maq6NhzXs X-Developer-Key: i=aesteve@redhat.com; a=ed25519; pk=YSFz6sOHd2L45+Fr8DIvHTi6lSIjhLZ5T+rkxspJt1s= X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 Add DRM Connector abstraction wrapping `struct drm_connector`. Used by the DRM panel abstractions added in the following patch. Since it is merely used as a raw pointer and managed internally in the panel's C functions, the Connector does not need to expose anything else for now. Signed-off-by: Albert Esteve --- rust/bindings/bindings_helper.h | 1 + rust/kernel/drm/connector.rs | 33 +++++++++++++++++++++++++++++++++ rust/kernel/drm/mod.rs | 1 + 3 files changed, 35 insertions(+) diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h index 1124785e210b3..7f3030ac0feb6 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -30,6 +30,7 @@ #include #include +#include #include #include #include diff --git a/rust/kernel/drm/connector.rs b/rust/kernel/drm/connector.rs new file mode 100644 index 0000000000000..b3b36644375dd --- /dev/null +++ b/rust/kernel/drm/connector.rs @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 + +//! DRM connector abstractions. +//! +//! C header: [`include/drm/drm_connector.h`](srctree/include/drm/drm_connector.h) + +use crate::{bindings, types::Opaque}; + +/// A DRM connector (`struct drm_connector`). +/// +/// # Invariants +/// +/// The inner pointer is always a valid, non-null pointer to a `struct drm_connector`. +#[repr(transparent)] +pub struct Connector(Opaque); + +impl Connector { + /// Creates a reference to a [`Connector`] from a raw pointer. + /// + /// # Safety + /// + /// `ptr` must be a valid, non-null pointer to a `struct drm_connector` that + /// remains valid for at least the lifetime `'a`. + pub unsafe fn from_raw<'a>(ptr: *mut bindings::drm_connector) -> &'a Self { + // SAFETY: Caller guarantees `ptr` is valid and lives for `'a`. + unsafe { &*ptr.cast() } + } + + /// Returns the raw pointer to the underlying `struct drm_connector`. + pub fn as_raw(&self) -> *mut bindings::drm_connector { + self.0.get() + } +} diff --git a/rust/kernel/drm/mod.rs b/rust/kernel/drm/mod.rs index a66e7166f66b5..672ea8728e1c3 100644 --- a/rust/kernel/drm/mod.rs +++ b/rust/kernel/drm/mod.rs @@ -2,6 +2,7 @@ //! DRM subsystem abstractions. +pub mod connector; pub mod device; pub mod driver; pub mod file; -- 2.55.0