From: Albert Esteve <aesteve@redhat.com>
To: "Rob Herring" <robh@kernel.org>,
"Saravana Kannan" <saravanak@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>
Cc: devicetree@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Albert Esteve <aesteve@redhat.com>,
mripard@kernel.org
Subject: [PATCH 2/5] rust: drm: add connector abstraction
Date: Mon, 17 Aug 2026 13:40:47 +0200 [thread overview]
Message-ID: <20260817-drm_panel_bindings-v1-2-1f974508a31c@redhat.com> (raw)
In-Reply-To: <20260817-drm_panel_bindings-v1-0-1f974508a31c@redhat.com>
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 <aesteve@redhat.com>
---
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 <linux/acpi.h>
#include <linux/gpu_buddy.h>
+#include <drm/drm_connector.h>
#include <drm/drm_device.h>
#include <drm/drm_drv.h>
#include <drm/drm_file.h>
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<bindings::drm_connector>);
+
+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
next prev parent reply other threads:[~2026-08-17 11:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 11:40 [PATCH 0/5] rust: drm: add panel bindings Albert Esteve
2026-08-17 11:40 ` [PATCH 1/5] rust: of: add Node type Albert Esteve
2026-08-17 15:18 ` Rob Herring
2026-08-18 7:20 ` Albert Esteve
2026-08-17 11:40 ` Albert Esteve [this message]
2026-08-17 11:40 ` [PATCH 3/5] rust: drm: add panel consumer abstractions Albert Esteve
2026-08-17 11:40 ` [PATCH 4/5] rust: drm: add panel producer abstractions Albert Esteve
2026-08-17 11:40 ` [PATCH 5/5] rust: drm: add KUnit tests for panel Albert Esteve
2026-08-18 11:45 ` [PATCH 0/5] rust: drm: add panel bindings Maxime Ripard
2026-08-18 12:43 ` Albert Esteve
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=20260817-drm_panel_bindings-v1-2-1f974508a31c@redhat.com \
--to=aesteve@redhat.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mripard@kernel.org \
--cc=ojeda@kernel.org \
--cc=robh@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=saravanak@kernel.org \
--cc=simona@ffwll.ch \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®