From nobody Mon Jun 8 08:52:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7192A3C768B; Wed, 3 Jun 2026 15:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780502205; cv=none; b=Z9oXE17BcVYF3uMNoGox8dFaDrpEbwYhrpBTc8mFFVAGqe0JwOHFU/b0MLZAKmc5YUQhDk0I5ynv0z1o7n5xHVMKZj2wk4N/RYWnDWSSrYWGMCnwBRuPi1o8cwzNpOO/78yVGKDhCaLPLu24hTlQ7+/D//IoNfkx/DllW86WH28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780502205; c=relaxed/simple; bh=1k7vvAOGO1oXU+3AgGuQ9wKxF8Gn/iiNS6SovrWXFQc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fv+WSVxsMPKA9g3nf3ERhc0q+ao6K32yk7WeYSvxlHo0zn0vtKQf5IKbqvlKMbbDxhfI2bhYqLQJ6zkHm0n9ZmQ39opHEDXKYyCRIKSXaoqdKlEEXwdFg2ivLUV92BQrouguFqLa+TWZI57D5/nGj9Kvb9lDt59yRuFftNLMiow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qKTVefZA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qKTVefZA" Received: by smtp.kernel.org (Postfix) with ESMTPS id 16477C2BCB0; Wed, 3 Jun 2026 15:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1780502205; bh=1k7vvAOGO1oXU+3AgGuQ9wKxF8Gn/iiNS6SovrWXFQc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=qKTVefZApdMuY+I6cAhrqLsd/e+muEu9BRY0QgogpGNBuc327hH4mpAwYBVmoIKgP 7VTYTGAskZFubFNXrEtTLEb+QoDRVk/kxnxLk8uz+BvQSE5crzVZdJ35MNs9nChJ1H Ir+kItf7kuWgSwppnSyvL8YqTEbBWNW8hvac8dUye5WgM26XKs/K4gqfHRjwf2d8B3 BTV9ZR6VPwh1JXiY1RnLExrIRi4L8Bo+PA/XLBVTR8ED8r2iNEEZuOY+PjWO5DSkFc M/JACXOy+cQR0zAuc9FSkg5UvVbGAzc8WJ/MJVp/0N9JjScwi7qefL19WtnSKs0PkG sRoxrXOmzuMLw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id F181FCD6E57; Wed, 3 Jun 2026 15:56:44 +0000 (UTC) From: Markus Probst via B4 Relay Date: Wed, 03 Jun 2026 17:56:39 +0200 Subject: [PATCH v12 1/3] rust: add basic serial device bus abstractions 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: <20260603-rust_serdev-v12-1-3400ffb88b12@posteo.de> References: <20260603-rust_serdev-v12-0-3400ffb88b12@posteo.de> In-Reply-To: <20260603-rust_serdev-v12-0-3400ffb88b12@posteo.de> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Miguel Ojeda , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Kari Argillander , "Rafael J. Wysocki" , Viresh Kumar , Boqun Feng , David Airlie , Simona Vetter , Boqun Feng Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, Markus Probst X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=26520; i=markus.probst@posteo.de; h=from:subject:message-id; bh=bbxzTb2wWVYESrgo3/XtGdcQNC+SaThhiaCUOZmj5Ck=; b=owEBiQJ2/ZANAwAIATR2H/jnrUPSAcsmYgBqIE66Zn2B7yVsvg4mtqdchzl4byA7sATteT5WV own4I1MY+yJAk8EAAEIADkWIQSCdBjE9KxY53IwxHM0dh/4561D0gUCaiBOuhsUgAAAAAAEAA5t YW51MiwyLjUrMS4xMiwyLDIACgkQNHYf+OetQ9Kf1A//bEQ9xSEkZQJGJ7a/hL8i6uILaEpLp3v X3DkVkuVfBwmsdaCV8lDVGEKD0JCrFVAkig8m/79icDRs6oJbbhaSAWfxutg1RuZivlunCNQvvf j+/HBoHYYzAo2q+P27Bk83twyxHY31C6z8ifuVj/Rp/7l+A08CRRaaL6EJ5lmkASmr6uxHISDyj NJCoc8jSHs+kvmm8i731DE3fN1m93ua75Jfis5VvFM8hAY3VY3hFov6UZVUQrXOm3IFEjgnCSA2 kKFUTH38w3NexM8y95lqDNXeNfCOGD+mrCW84f5wNcyn9aspJDKpY/JzvqDKOXn3MffpWFhW73y KY0bww2tuoQlYcmg0oACV/HqrNBE5aAIOWcIPnTQH1BLnBG0xsuYD2V5lOhqQmf2J17MM8FF7sn zWzy+5ugyGlUVE0l5a+nTbgcFWD8gvI1mih5ljPuxxGOPFj2sUTB4Hhb1zYSP303BinUWgGmJ25 /0MwBFOGkzDWNJCEcvt30oDvtPZ9fMf3hV24jz0zdigCxqF2VrPNA0Uc8nOI+DxuUOzUIlrqb06 oV1WNtAsMr6qaVzyyFpk7eiGAmVwG7rosqXnENvJ52OEE8oCvyIKm2PjGn+ZLH0CRkoRKq0ql/R UFC9WkiQ5p4cCAGzP+8duzfjWgW+nceba0ESYsr+9H+B8ZYaCY18= X-Developer-Key: i=markus.probst@posteo.de; a=openpgp; fpr=827418C4F4AC58E77230C47334761FF8E7AD43D2 X-Endpoint-Received: by B4 Relay for markus.probst@posteo.de/default with auth_id=680 X-Original-From: Markus Probst Reply-To: markus.probst@posteo.de From: Markus Probst Implement the basic serial device bus abstractions required to write a serial device bus device driver with or without the need for initial device data. This includes the following data structures: The `serdev::Driver` trait represents the interface to the driver. The `serdev::Device` abstraction represents a `struct serdev_device`. In order to provide the Serdev specific parts to a generic `driver::Registration` the `driver::RegistrationOps` trait is implemented by `serdev::Adapter`. Signed-off-by: Markus Probst --- MAINTAINERS | 2 + drivers/tty/serdev/Kconfig | 7 + rust/bindings/bindings_helper.h | 1 + rust/helpers/helpers.c | 1 + rust/helpers/serdev.c | 22 ++ rust/kernel/lib.rs | 2 + rust/kernel/serdev.rs | 590 ++++++++++++++++++++++++++++++++++++= ++++ 7 files changed, 625 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1a5508df3f44..d21be30a2d9d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24277,6 +24277,8 @@ S: Maintained F: Documentation/devicetree/bindings/serial/serial.yaml F: drivers/tty/serdev/ F: include/linux/serdev.h +F: rust/helpers/serdev.c +F: rust/kernel/serdev.rs =20 SERIAL IR RECEIVER M: Sean Young diff --git a/drivers/tty/serdev/Kconfig b/drivers/tty/serdev/Kconfig index 46ae732bfc68..e6dfe949ad01 100644 --- a/drivers/tty/serdev/Kconfig +++ b/drivers/tty/serdev/Kconfig @@ -9,6 +9,13 @@ menuconfig SERIAL_DEV_BUS =20 Note that you typically also want to enable TTY port controller support. =20 +config RUST_SERIAL_DEV_BUS_ABSTRACTIONS + bool "Rust Serial device bus abstractions" + depends on RUST + select SERIAL_DEV_BUS + help + This enables the Rust abstraction for the serial device bus API. + if SERIAL_DEV_BUS =20 config SERIAL_DEV_CTRL_TTYPORT diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helpe= r.h index 446dbeaf0866..4e42635b8607 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -84,6 +84,7 @@ #include #include #include +#include #include #include #include diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c index 38b34518eff1..2fb8506a748a 100644 --- a/rust/helpers/helpers.c +++ b/rust/helpers/helpers.c @@ -86,6 +86,7 @@ #include "regulator.c" #include "scatterlist.c" #include "security.c" +#include "serdev.c" #include "signal.c" #include "slab.c" #include "spinlock.c" diff --git a/rust/helpers/serdev.c b/rust/helpers/serdev.c new file mode 100644 index 000000000000..c52b78ca3fc7 --- /dev/null +++ b/rust/helpers/serdev.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include + +__rust_helper +void rust_helper_serdev_device_driver_unregister(struct serdev_device_driv= er *sdrv) +{ + serdev_device_driver_unregister(sdrv); +} + +__rust_helper +void rust_helper_serdev_device_put(struct serdev_device *serdev) +{ + serdev_device_put(serdev); +} + +__rust_helper +void rust_helper_serdev_device_set_client_ops(struct serdev_device *serdev, + const struct serdev_device_ops *ops) +{ + serdev_device_set_client_ops(serdev, ops); +} diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index b72b2fbe046d..83bc2c312241 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -118,6 +118,8 @@ pub mod scatterlist; pub mod security; pub mod seq_file; +#[cfg(CONFIG_RUST_SERIAL_DEV_BUS_ABSTRACTIONS)] +pub mod serdev; pub mod sizes; #[cfg(CONFIG_SOC_BUS)] pub mod soc; diff --git a/rust/kernel/serdev.rs b/rust/kernel/serdev.rs new file mode 100644 index 000000000000..ab5d6446b091 --- /dev/null +++ b/rust/kernel/serdev.rs @@ -0,0 +1,590 @@ +// SPDX-License-Identifier: GPL-2.0 + +//! Abstractions for the serial device bus. +//! +//! C header: [`include/linux/serdev.h`](srctree/include/linux/serdev.h) + +use crate::{ + acpi, + device, + driver, + error::{ + from_result, + to_result, + VTABLE_DEFAULT_ERROR, // + }, + new_mutex, + of, + prelude::*, + sync::{ + aref::AlwaysRefCounted, + Mutex, // + }, + time::{ + msecs_to_jiffies, + Jiffies, + Msecs, // + }, + types::{ + Opaque, + ScopeGuard, // + }, // +}; + +use core::{ + cell::UnsafeCell, + marker::PhantomData, + mem::{offset_of, MaybeUninit}, + num::NonZero, + ptr::NonNull, // +}; + +/// Parity bit to use with a serial device. +#[repr(u32)] +pub enum Parity { + /// No parity bit. + None =3D bindings::serdev_parity_SERDEV_PARITY_NONE, + /// Even partiy. + Even =3D bindings::serdev_parity_SERDEV_PARITY_EVEN, + /// Odd parity. + Odd =3D bindings::serdev_parity_SERDEV_PARITY_ODD, +} + +/// Timeout in Jiffies. +pub enum Timeout { + /// Wait for a specific amount of [`Jiffies`]. + Jiffies(NonZero), + /// Wait for a specific amount of [`Msecs`]. + Milliseconds(NonZero), + /// Wait as long as possible. + /// + /// This is equivalent to [`kernel::task::MAX_SCHEDULE_TIMEOUT`]. + Max, +} + +impl Timeout { + fn into_jiffies(self) -> isize { + match self { + Self::Jiffies(value) =3D> value.get().try_into().unwrap_or_def= ault(), + Self::Milliseconds(value) =3D> { + msecs_to_jiffies(value.get()).try_into().unwrap_or_default= () + } + Self::Max =3D> 0, + } + } +} + +/// An adapter for the registration of serial device bus device drivers. +pub struct Adapter(T); + +// SAFETY: +// - `bindings::serdev_device_driver` is a C type declared as `repr(C)`. +// - `PrivateData<'bound, T>` is the type of the driver's device private d= ata. +// - `struct serdev_device_driver` embeds a `struct device_driver`. +// - `DEVICE_DRIVER_OFFSET` is the correct byte offset to the embedded `st= ruct device_driver`. +unsafe impl driver::DriverLayout for Adapter { + type DriverType =3D bindings::serdev_device_driver; + type DriverData<'bound> =3D PrivateData<'bound, T>; + const DEVICE_DRIVER_OFFSET: usize =3D core::mem::offset_of!(Self::Driv= erType, driver); +} + +// SAFETY: A call to `unregister` for a given instance of `DriverType` is = guaranteed to be valid if +// a preceding call to `register` has been successful. +unsafe impl driver::RegistrationOps for Adapter { + unsafe fn register( + sdrv: &Opaque, + name: &'static CStr, + module: &'static ThisModule, + ) -> Result { + let of_table =3D match T::OF_ID_TABLE { + Some(table) =3D> table.as_ptr(), + None =3D> core::ptr::null(), + }; + + let acpi_table =3D match T::ACPI_ID_TABLE { + Some(table) =3D> table.as_ptr(), + None =3D> core::ptr::null(), + }; + + // SAFETY: It's safe to set the fields of `struct serdev_device_dr= iver` on initialization. + unsafe { + (*sdrv.get()).driver.name =3D name.as_char_ptr(); + (*sdrv.get()).probe =3D Some(Self::probe_callback); + (*sdrv.get()).remove =3D Some(Self::remove_callback); + (*sdrv.get()).driver.of_match_table =3D of_table; + (*sdrv.get()).driver.acpi_match_table =3D acpi_table; + } + + // SAFETY: `sdrv` is guaranteed to be a valid `DriverType`. + to_result(unsafe { bindings::__serdev_device_driver_register(sdrv.= get(), module.0) }) + } + + unsafe fn unregister(sdrv: &Opaque) { + // SAFETY: `sdrv` is guaranteed to be a valid `DriverType`. + unsafe { bindings::serdev_device_driver_unregister(sdrv.get()) }; + } +} + +#[doc(hidden)] +#[pin_data(PinnedDrop)] +pub struct PrivateData<'bound, T: Driver> { + sdev: &'bound Device, + #[pin] + driver: UnsafeCell>>, + open: UnsafeCell, + #[pin] + active: Mutex, +} + +#[pinned_drop] +impl PinnedDrop for PrivateData<'_, T> { + fn drop(self: Pin<&mut Self>) { + let mut active =3D self.active.lock(); + if *active { + // SAFETY: + // - We have exclusive access to `self.driver`. + // - `self.driver` is guaranteed to be initialized. + unsafe { (*self.driver.get()).assume_init_drop() }; + *active =3D false; + } + + // SAFETY: We have exclusive access to `self.open`. + if unsafe { *self.open.get() } { + // SAFETY: `self.sdev.as_raw()` is guaranteed to be a pointer = to a valid + // `struct serdev_device`. + unsafe { bindings::serdev_device_close(self.sdev.as_raw()) }; + } + } +} + +impl Adapter { + const OPS: &'static bindings::serdev_device_ops =3D &bindings::serdev_= device_ops { + receive_buf: if T::HAS_RECEIVE { + Some(Self::receive_buf_callback) + } else { + None + }, + write_wakeup: Some(bindings::serdev_device_write_wakeup), + }; + + extern "C" fn probe_callback(sdev: *mut bindings::serdev_device) -> ke= rnel::ffi::c_int { + // SAFETY: The serial device bus only ever calls the probe callbac= k with a valid pointer to + // a `struct serdev_device`. + // + // INVARIANT: `sdev` is valid for the duration of `probe_callback(= )`. + let sdev =3D unsafe { &*sdev.cast::>>() }; + let info =3D ::id_info(sdev.as_ref()); + + from_result(|| { + sdev.as_ref().set_drvdata(try_pin_init!(PrivateData:: { + sdev: &**sdev, + driver: MaybeUninit::>::zeroed().into(), + open: false.into(), + active <- new_mutex!(false), + }))?; + // SAFETY: We just set drvdata to `PrivateData<'_, T>`. + let private_data =3D unsafe { sdev.as_ref().drvdata_borrow::>() }; + let private_data =3D ScopeGuard::new_with_data(private_data, |= _| { + // SAFETY: We just set drvdata to `PrivateData<'_, T>`. + drop(unsafe { sdev.as_ref().drvdata_obtain::>() }); + }); + let mut active =3D private_data.active.lock(); + + // SAFETY: `sdev.as_raw()` is guaranteed to be a valid pointer= to `serdev_device`. + unsafe { bindings::serdev_device_set_client_ops(sdev.as_raw(),= Self::OPS) }; + + // SAFETY: The serial device bus only ever calls the probe cal= lback with a valid pointer + // to a `serdev_device`. + to_result(unsafe { bindings::serdev_device_open(sdev.as_raw())= })?; + + // SAFETY: We have exclusive access to `private_data.open`. + unsafe { *private_data.open.get() =3D true }; + + let data =3D T::probe(sdev, info); + + // SAFETY: We have exclusive access to `private_data.driver`. + let driver =3D unsafe { &mut *private_data.driver.get() }; + // SAFETY: + // - `driver.as_mut_ptr()` is a valid pointer to uninitialized= data. + // - `private_data.driver` is pinned. + let result =3D unsafe { data.__pinned_init(driver.as_mut_ptr()= ) }; + + *active =3D result.is_ok(); + + drop(active); + + result.map(|()| { + private_data.dismiss(); + 0 + }) + }) + } + + extern "C" fn remove_callback(sdev: *mut bindings::serdev_device) { + // SAFETY: The serial device bus only ever calls the remove callba= ck with a valid pointer + // to a `struct serdev_device`. + // + // INVARIANT: `sdev` is valid for the duration of `remove_callback= ()`. + let sdev =3D unsafe { &*sdev.cast::>>() }; + + // SAFETY: `remove_callback` is only ever called after a successfu= l call to + // `probe_callback`, hence it's guaranteed that `Device::set_drvda= ta()` has been called + // and stored a `Pin>>`. + let private_data =3D unsafe { sdev.as_ref().drvdata_borrow::>() }; + + // SAFETY: No one has exclusive access to `private_data.driver`. + let data =3D unsafe { &*private_data.driver.get() }; + // SAFETY: + // - `private_data.driver` is pinned. + // - `remove_callback` is only ever called after a successful call= to `probe_callback`, + // hence it's guaranteed that `private_data.driver` was initiali= zed. + let data_pinned =3D unsafe { Pin::new_unchecked(data.assume_init_r= ef()) }; + + T::unbind(sdev, data_pinned); + } + + extern "C" fn receive_buf_callback( + sdev: *mut bindings::serdev_device, + buf: *const u8, + length: usize, + ) -> usize { + // SAFETY: The serial device bus only ever calls the receive buf c= allback with a valid + // pointer to a `struct serdev_device`. + // + // INVARIANT: `sdev` is valid for the duration of `receive_buf_cal= lback()`. + let sdev =3D unsafe { &*sdev.cast::>= () }; + + // SAFETY: `receive_buf_callback` is only ever called after a succ= essful call to + // `probe_callback`, hence it's guaranteed that `Device::set_drvda= ta()` has been called + // and stored a `Pin>>`. + let private_data =3D unsafe { sdev.as_ref().drvdata_borrow::>() }; + let active =3D private_data.active.lock(); + + if !*active { + return length; + } + + // SAFETY: No one has exclusive access to `private_data.driver`. + let data =3D unsafe { &*private_data.driver.get() }; + // SAFETY: + // - `private_data.driver` is pinned. + // - `receive_buf_callback` is only ever called after a successful= call to `probe_callback`, + // hence it's guaranteed that `private_data.driver` was initiali= zed. + let data_pinned =3D unsafe { Pin::new_unchecked(data.assume_init_r= ef()) }; + + // SAFETY: `buf` is guaranteed to be non-null and has the size of = `length`. + let buf =3D unsafe { core::slice::from_raw_parts(buf, length) }; + + T::receive(sdev, data_pinned, buf) + } +} + +impl driver::Adapter for Adapter { + type IdInfo =3D T::IdInfo; + + fn of_id_table() -> Option> { + T::OF_ID_TABLE + } + + fn acpi_id_table() -> Option> { + T::ACPI_ID_TABLE + } +} + +/// Declares a kernel module that exposes a single serial device bus devic= e driver. +/// +/// # Examples +/// +/// ```ignore +/// kernel::module_serdev_device_driver! { +/// type: MyDriver, +/// name: "Module name", +/// authors: ["Author name"], +/// description: "Description", +/// license: "GPL v2", +/// } +/// ``` +#[macro_export] +macro_rules! module_serdev_device_driver { + ($($f:tt)*) =3D> { + $crate::module_driver!(, $crate::serdev::Adapter, { $($f)* }= ); + }; +} + +/// The serial device bus device driver trait. +/// +/// Drivers must implement this trait in order to get a serial device bus = device driver registered. +/// +/// # Examples +/// +///``` +/// # use kernel::{ +/// acpi, +/// bindings, +/// device::{ +/// Bound, +/// Core, // +/// }, +/// of, +/// serdev, // +/// }; +/// +/// struct MyDriver; +/// +/// kernel::of_device_table!( +/// OF_TABLE, +/// MODULE_OF_TABLE, +/// ::IdInfo, +/// [ +/// (of::DeviceId::new(c"test,device"), ()) +/// ] +/// ); +/// +/// kernel::acpi_device_table!( +/// ACPI_TABLE, +/// MODULE_ACPI_TABLE, +/// ::IdInfo, +/// [ +/// (acpi::DeviceId::new(c"LNUXBEEF"), ()) +/// ] +/// ); +/// +/// #[vtable] +/// impl serdev::Driver for MyDriver { +/// type IdInfo =3D (); +/// type Data<'bound> =3D Self; +/// const OF_ID_TABLE: Option> =3D Some(&OF_= TABLE); +/// const ACPI_ID_TABLE: Option> =3D Some(= &ACPI_TABLE); +/// +/// fn probe<'bound>( +/// sdev: &'bound serdev::Device>, +/// _id_info: Option<&'bound Self::IdInfo>, +/// ) -> impl PinInit, Error> + 'bound { +/// sdev.set_baudrate(115200); +/// sdev.write_all(b"Hello\n", serdev::Timeout::Max)?; +/// Ok(MyDriver) +/// } +/// } +///``` +#[vtable] +pub trait Driver { + /// The type holding driver private data about each device id supporte= d by the driver. + // TODO: Use associated_type_defaults once stabilized: + // + // ``` + // type IdInfo: 'static =3D (); + // ``` + type IdInfo: 'static; + + /// The type of the driver's bus device private data. + type Data<'bound>: Send + 'bound; + + /// The table of OF device ids supported by the driver. + const OF_ID_TABLE: Option> =3D None; + + /// The table of ACPI device ids supported by the driver. + const ACPI_ID_TABLE: Option> =3D None; + + /// Serial device bus device driver probe. + /// + /// Called when a new serial device bus device is added or discovered. + /// Implementers should attempt to initialize the device here. + fn probe<'bound>( + sdev: &'bound Device>, + id_info: Option<&'bound Self::IdInfo>, + ) -> impl PinInit, Error> + 'bound; + + /// Serial device bus device driver unbind. + /// + /// Called when a [`Device`] is unbound from its bound [`Driver`]. Imp= lementing this callback + /// is optional. + /// + /// This callback serves as a place for drivers to perform teardown op= erations that require a + /// `&Device` or `&Device` reference. For instance. + /// + /// Otherwise, release operations for driver resources should be perfo= rmed in `Drop`. + fn unbind<'bound>(sdev: &'bound Device>, this: Pin<&S= elf::Data<'bound>>) { + let _ =3D (sdev, this); + } + + /// Serial device bus device data receive callback. + /// + /// Called when data got received from device. + /// + /// Returns the number of bytes accepted. + fn receive<'bound>( + sdev: &'bound Device, + this: Pin<&Self::Data<'bound>>, + data: &[u8], + ) -> usize { + let _ =3D (sdev, this, data); + build_error!(VTABLE_DEFAULT_ERROR) + } +} + +/// The serial device bus device representation. +/// +/// This structure represents the Rust abstraction for a C `struct serdev_= device`. The +/// implementation abstracts the usage of an already existing C `struct se= rdev_device` within Rust +/// code that we get passed from the C side. +/// +/// # Invariants +/// +/// A [`Device`] instance represents a valid `struct serdev_device` create= d by the C portion of +/// the kernel. +#[repr(transparent)] +pub struct Device( + Opaque, + PhantomData, +); + +impl Device { + fn as_raw(&self) -> *mut bindings::serdev_device { + self.0.get() + } +} + +impl Device { + /// Set the baudrate in bits per second. + /// + /// Common baudrates are 115200, 9600, 19200, 57600, 4800. + /// + /// Use [`Device::write_flush`] before calling this if you have writte= n data prior to this call. + pub fn set_baudrate(&self, speed: u32) -> Result<(), u32> { + // SAFETY: `self.as_raw()` is guaranteed to be a pointer to a vali= d `serdev_device`. + let ret =3D unsafe { bindings::serdev_device_set_baudrate(self.as_= raw(), speed) }; + if ret =3D=3D speed { + Ok(()) + } else { + Err(ret) + } + } + + /// Set if flow control should be enabled. + /// + /// Use [`Device::write_flush`] before calling this if you have writte= n data prior to this call. + pub fn set_flow_control(&self, enable: bool) { + // SAFETY: `self.as_raw()` is guaranteed to be a pointer to a vali= d `serdev_device`. + unsafe { bindings::serdev_device_set_flow_control(self.as_raw(), e= nable) }; + } + + /// Set parity to use. + /// + /// Use [`Device::write_flush`] before calling this if you have writte= n data prior to this call. + pub fn set_parity(&self, parity: Parity) -> Result { + // SAFETY: `self.as_raw()` is guaranteed to be a pointer to a vali= d `serdev_device`. + to_result(unsafe { bindings::serdev_device_set_parity(self.as_raw(= ), parity as u32) }) + } + + /// Write data to the serial device until the controller has accepted = all the data or has + /// been interrupted by a timeout or signal. + /// + /// Note that any accepted data has only been buffered by the controll= er. Use + /// [`Device::wait_until_sent`] to make sure the controller write buff= er has actually been + /// emptied. + /// + /// Returns the number of bytes written (less than `data.len()` if int= errupted). + /// [`kernel::error::code::ETIMEDOUT`] or [`kernel::error::code::EREST= ARTSYS`] if interrupted + /// before any bytes were written. + pub fn write_all(&self, data: &[u8], timeout: Timeout) -> Result { + // SAFETY: + // - `self.as_raw()` is guaranteed to be a pointer to a valid `ser= dev_device`. + // - `data.as_ptr()` is guaranteed to be a valid array pointer wit= h the size of + // `data.len()`. + let ret =3D unsafe { + bindings::serdev_device_write( + self.as_raw(), + data.as_ptr(), + data.len(), + timeout.into_jiffies(), + ) + }; + // CAST: negative return values are guaranteed to be between `-MAX= _ERRNO` and `-1`, + // which always fit into a `i32`. + to_result(ret as i32).map(|()| ret.unsigned_abs()) + } + + /// Write data to the serial device. + /// + /// If you want to write until the controller has accepted all the dat= a, use + /// [`Device::write_all`]. + /// + /// Note that any accepted data has only been buffered by the controll= er. Use + /// [ Device::wait_until_sent`] to make sure the controller write buff= er has actually been + /// emptied. + /// + /// Returns the number of bytes written (less than `data.len()` if not= enough room in the + /// write buffer). + pub fn write(&self, data: &[u8]) -> Result { + // SAFETY: + // - `self.as_raw()` is guaranteed to be a pointer to a valid `ser= dev_device`. + // - `data.as_ptr()` is guaranteed to be a valid array pointer wit= h the size of + // `data.len()`. + let ret =3D + unsafe { bindings::serdev_device_write_buf(self.as_raw(), data= .as_ptr(), data.len()) }; + + to_result(ret as i32).map(|()| ret.unsigned_abs()) + } + + /// Send data to the serial device immediately. + /// + /// Note that this doesn't guarantee that the data has been transmitte= d. + /// Use [`Device::wait_until_sent`] for this purpose. + pub fn write_flush(&self) { + // SAFETY: `self.as_raw()` is guaranteed to be a pointer to a vali= d `serdev_device`. + unsafe { bindings::serdev_device_write_flush(self.as_raw()) }; + } + + /// Wait for the data to be sent. + /// + /// After this function, the write buffer of the controller should be = empty. + pub fn wait_until_sent(&self, timeout: Timeout) { + // SAFETY: `self.as_raw()` is guaranteed to be a pointer to a vali= d `serdev_device`. + unsafe { bindings::serdev_device_wait_until_sent(self.as_raw(), ti= meout.into_jiffies()) }; + } +} + +// SAFETY: `serdev::Device` is a transparent wrapper of `struct serdev_dev= ice`. +// The offset is guaranteed to point to a valid device field inside `serde= v::Device`. +unsafe impl device::AsBusDevice for Devic= e { + const OFFSET: usize =3D offset_of!(bindings::serdev_device, dev); +} + +// SAFETY: `Device` is a transparent wrapper of a type that doesn't depend= on `Device`'s generic +// argument. +kernel::impl_device_context_deref!(unsafe { Device }); +kernel::impl_device_context_into_aref!(Device); + +// SAFETY: Instances of `Device` are always reference-counted. +unsafe impl AlwaysRefCounted for Device { + fn inc_ref(&self) { + self.as_ref().inc_ref(); + } + + unsafe fn dec_ref(obj: NonNull) { + // SAFETY: The safety requirements guarantee that the refcount is = non-zero. + unsafe { bindings::serdev_device_put(obj.cast().as_ptr()) } + } +} + +impl AsRef> for Device { + fn as_ref(&self) -> &device::Device { + // SAFETY: By the type invariant of `Self`, `self.as_raw()` is a p= ointer to a valid + // `struct serdev_device`. + let dev =3D unsafe { &raw mut (*self.as_raw()).dev }; + + // SAFETY: `dev` points to a valid `struct device`. + unsafe { device::Device::from_raw(dev) } + } +} + +// SAFETY: A `Device` is always reference-counted and can be released from= any thread. +unsafe impl Send for Device {} + +// SAFETY: `Device` can be shared among threads because all methods of `De= vice` +// (i.e. `Device) are thread safe. +unsafe impl Sync for Device {} + +// SAFETY: Same as `Device` -- the underlying `struct serdev_devic= e` is the same; +// `Bound` is a zero-sized type-state marker that does not affect thread s= afety. +unsafe impl Sync for Device {} --=20 2.53.0 From nobody Mon Jun 8 08:52:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 719C13DA5C3; Wed, 3 Jun 2026 15:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780502205; cv=none; b=JsYLzSHNwTTYF1kqsMBIZtcdvYCeS7IX3HN41FRVAVpXQ7jvs3itf+wkBQwLo7qwLlA6iyqiVc5hpuMdVIO1iDl1E8pyqf5vgZMkJpeOPEhBobUu53xe4rAX7dp9x/KL5CZ3e/n4vFkk1xjiQ+pwAOpM/Q73hKMmVXzt2Me9Ngw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780502205; c=relaxed/simple; bh=r6qS2QK0QDZzI5OPlQCblhpmk0XQ5HoysdLwKjaKnU8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FPBnaCaN/7QheJ5bwQXLHiLbn7KgivFteAdVE7Bx8C/VD16/nhMBM03HYQRUmYqRGb8xzEhtHKS3bhjJoXSYFrmqctLGd41jhRxim/189eYbE4rmlrWReYpc0C8JhiFbYvxpiv8Fx29mJI/Sm/GOFBKh9LLE2zW9Qu0Hu8BMg6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Dn2j6fJL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dn2j6fJL" Received: by smtp.kernel.org (Postfix) with ESMTPS id 25825C2BCC4; Wed, 3 Jun 2026 15:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1780502205; bh=r6qS2QK0QDZzI5OPlQCblhpmk0XQ5HoysdLwKjaKnU8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Dn2j6fJLSbsHMLbXPGK0B6y5uRtump87IJjsRAmd8kADi2sUnmDE8iDGU+2cEXXZR HmEyf8PAVHykNVQPXg3W0zpMKGct06iH6D3oGR12HXUjC+oEWJpM7jHN22Va0Zuw0J ALMqfjmUO9IDdH7Hw971/ZAOqK7apfgfUrmHieq4gvf42AnX71nGWsL3XMQr3rhjCI l+8dvr7AcCuXT2LcKoOvSipwh10RNYuzTbq/aOTn10ywJJzc4jRn08jgoEH/Wki7RJ iDoNirJr2dAxd4kZOl3ulCmmM4Rhd0e5T534NN5X/okGUl+RuXWpMmX5SLZiNRWTi1 6LCcrq7qTCYSQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B209CD6E6D; Wed, 3 Jun 2026 15:56:45 +0000 (UTC) From: Markus Probst via B4 Relay Date: Wed, 03 Jun 2026 17:56:40 +0200 Subject: [PATCH v12 2/3] samples: rust: add Rust serial device bus sample device driver 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: <20260603-rust_serdev-v12-2-3400ffb88b12@posteo.de> References: <20260603-rust_serdev-v12-0-3400ffb88b12@posteo.de> In-Reply-To: <20260603-rust_serdev-v12-0-3400ffb88b12@posteo.de> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Miguel Ojeda , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Kari Argillander , "Rafael J. Wysocki" , Viresh Kumar , Boqun Feng , David Airlie , Simona Vetter , Boqun Feng Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, Markus Probst X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4748; i=markus.probst@posteo.de; h=from:subject:message-id; bh=gHj+a0iolyCoCcEpqpsr2jWHjdD96arYc+2miLWbMBc=; b=owEBiQJ2/ZANAwAIATR2H/jnrUPSAcsmYgBqIE67tlZHiyRUi+U6ZDY0Ksr4tJ5INiFRt7Enp dvQ0rrPHz2JAk8EAAEIADkWIQSCdBjE9KxY53IwxHM0dh/4561D0gUCaiBOuxsUgAAAAAAEAA5t YW51MiwyLjUrMS4xMiwyLDIACgkQNHYf+OetQ9JEww//RXScslFa5VWTCnxkwNVZLMT5KqaLWRc wWNy0Mew+HT89c4P/ddqB19nwgNgJAlXKQQTN637FI1zTk7PHZgnjtAyJtfV8pGBczxdZrW7lbH lL8UmlQnMqshHXhNZxdszh5/BWgdtW1EN4bYRi3Ut1ClEjncDNVsewgT8BVYASYUgACHZds0TUF j6iBWn+WbElZFBvcURuIWuF23hNr+eho1BsqVylP9DlUmHh+jrM+UMOwup+hbkngUbH3neCTWew ecwRoolu8IObG5Pd+8pUgilC5R4r3hN48IZnVVZkjOV9ombiapCi0jyAhTTrO2uWn/DulTy/OTE qqkuQugVVQgAyf8+pxNnAX2fiTW9Q0lpZTPGzCVNFh94y3kltc37jSpk8vgJENuWF2Dg0T/KNf2 RQpETI8bKNERgKQZaRi/exzm0BLi/p/6RbrlRFlK9B26bYMMm5ZG+4N0xSGIoRWSPeK5/xKzrFR vWE0qzptdxLB4gGrPynDI6zaMYZqWEAna3He4OzgENm3fYbdf+Z+Z4aYgB3ogwNADuQ6/VD1qqu 2i22bC8oik0FcVNYUOhAIXdDxXbffqrRd1InCmQ4IbmDt2Mvlo49+F9Vf5V78CuYmDXhFaV6SSc NpYf7w8Goz8R3KyxlJSgVbQeeMylXLuEh7NI33/7lMW3RMY6JsIs= X-Developer-Key: i=markus.probst@posteo.de; a=openpgp; fpr=827418C4F4AC58E77230C47334761FF8E7AD43D2 X-Endpoint-Received: by B4 Relay for markus.probst@posteo.de/default with auth_id=680 X-Original-From: Markus Probst Reply-To: markus.probst@posteo.de From: Markus Probst Add a sample Rust serial device bus device driver illustrating the usage of the serial device bus abstractions. This drivers probes through either a match of device / driver name or a match within the OF ID table. Signed-off-by: Markus Probst --- MAINTAINERS | 1 + samples/rust/Kconfig | 11 +++++ samples/rust/Makefile | 1 + samples/rust/rust_driver_serdev.rs | 91 ++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 104 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index d21be30a2d9d..3b995cb6e902 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24279,6 +24279,7 @@ F: drivers/tty/serdev/ F: include/linux/serdev.h F: rust/helpers/serdev.c F: rust/kernel/serdev.rs +F: samples/rust/rust_driver_serdev.rs =20 SERIAL IR RECEIVER M: Sean Young diff --git a/samples/rust/Kconfig b/samples/rust/Kconfig index c49ab9106345..31d62533ef25 100644 --- a/samples/rust/Kconfig +++ b/samples/rust/Kconfig @@ -161,6 +161,17 @@ config SAMPLE_RUST_DRIVER_AUXILIARY =20 If unsure, say N. =20 +config SAMPLE_RUST_DRIVER_SERDEV + tristate "Serial Device Bus Device Driver" + select RUST_SERIAL_DEV_BUS_ABSTRACTIONS + help + This option builds the Rust serial device bus driver sample. + + To compile this as a module, choose M here: + the module will be called rust_driver_serdev. + + If unsure, say N. + config SAMPLE_RUST_SOC tristate "SoC Driver" select SOC_BUS diff --git a/samples/rust/Makefile b/samples/rust/Makefile index 6c0aaa58cccc..b986b681cde5 100644 --- a/samples/rust/Makefile +++ b/samples/rust/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_SAMPLE_RUST_DRIVER_PLATFORM) +=3D rust_drive= r_platform.o obj-$(CONFIG_SAMPLE_RUST_DRIVER_USB) +=3D rust_driver_usb.o obj-$(CONFIG_SAMPLE_RUST_DRIVER_FAUX) +=3D rust_driver_faux.o obj-$(CONFIG_SAMPLE_RUST_DRIVER_AUXILIARY) +=3D rust_driver_auxiliary.o +obj-$(CONFIG_SAMPLE_RUST_DRIVER_SERDEV) +=3D rust_driver_serdev.o obj-$(CONFIG_SAMPLE_RUST_CONFIGFS) +=3D rust_configfs.o obj-$(CONFIG_SAMPLE_RUST_SOC) +=3D rust_soc.o =20 diff --git a/samples/rust/rust_driver_serdev.rs b/samples/rust/rust_driver_= serdev.rs new file mode 100644 index 000000000000..824affbf6593 --- /dev/null +++ b/samples/rust/rust_driver_serdev.rs @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0 + +//! Rust Serial device bus device driver sample. + +use kernel::{ + acpi, + device::{ + Bound, + Core, // + }, + of, + prelude::*, + serdev, + sync::aref::ARef, // +}; + +struct SampleDriver { + sdev: ARef, +} + +kernel::of_device_table!( + OF_TABLE, + MODULE_OF_TABLE, + ::IdInfo, + [(of::DeviceId::new(c"test,rust_driver_serdev"), ())] +); + +kernel::acpi_device_table!( + ACPI_TABLE, + MODULE_ACPI_TABLE, + ::IdInfo, + [(acpi::DeviceId::new(c"LNUXBEEF"), ())] +); + +#[vtable] +impl serdev::Driver for SampleDriver { + type IdInfo =3D (); + type Data<'bound> =3D Self; + const OF_ID_TABLE: Option> =3D Some(&OF_TABL= E); + const ACPI_ID_TABLE: Option> =3D Some(&ACP= I_TABLE); + + fn probe<'bound>( + sdev: &'bound serdev::Device>, + _info: Option<&'bound Self::IdInfo>, + ) -> impl PinInit + 'bound { + let dev =3D sdev.as_ref(); + + dev_dbg!(dev, "Probe Rust Serial device bus device driver sample.\= n"); + + if sdev + .set_baudrate( + dev.fwnode() + .and_then(|fwnode| fwnode.property_read(c"baudrate").o= ptional()) + .unwrap_or(115200), + ) + .is_err() + { + return Err(EINVAL); + } + sdev.set_flow_control(false); + sdev.set_parity(serdev::Parity::None)?; + + Ok(Self { sdev: sdev.into() }) + } + + fn receive<'bound>( + sdev: &'bound serdev::Device, + _this: Pin<&Self>, + data: &[u8], + ) -> usize { + let _ =3D sdev.write_all(data, serdev::Timeout::Max); + data.len() + } +} + +impl Drop for SampleDriver { + fn drop(&mut self) { + dev_dbg!( + self.sdev.as_ref(), + "Remove Rust Serial device bus device driver sample.\n" + ); + } +} + +kernel::module_serdev_device_driver! { + type: SampleDriver, + name: "rust_driver_serdev", + authors: ["Markus Probst"], + description: "Rust Serial device bus device driver", + license: "GPL v2", +} --=20 2.53.0 From nobody Mon Jun 8 08:52:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 75D893DD53E; Wed, 3 Jun 2026 15:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780502205; cv=none; b=pHgy5v/6QPnum76TVuAJ3hVtix4OUWxTgUt3ZvzYdv6/IGTWaEpTGZe/K+KAPiky7524PMTb1vhUd/PiU88ShIlDuMmT+CcIo+rGLTtpfplI900rr3T+c9Hn7ibxgl6M0Zl7nbAO0YK8sK6WGwYVt8Rzh18BhUtU7pMttyCNdiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780502205; c=relaxed/simple; bh=nWtiWxbs9tvtWNadYoIPsgP9JmcACOg4egKziZJamEE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mSAjXIHlfARrs5vkoJzloW41vXkw+EsAWqvvoGHF3iOU6yq8hjxJyX+DYm829il/0+B/pZ/s58QJuvQO8vSzjRbttdPS8uRaS2qGHBiogGz2IiTGlvt0o0iT+TJCzgsbozrqmtWXSuBPJe/Ywatz7jClyATka7dwECHfJYD4wDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u4FkIudM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u4FkIudM" Received: by smtp.kernel.org (Postfix) with ESMTPS id 3490BC2BCC6; Wed, 3 Jun 2026 15:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1780502205; bh=nWtiWxbs9tvtWNadYoIPsgP9JmcACOg4egKziZJamEE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=u4FkIudM/1I8vM4HV9SGoa/cVsQ1Xzy1dGpc/otUANR5iPjR2UmjzU+ts8kiP8214 bXgfX4uHqRz0RLVqU1Z4LQimtlgo+/Pv7gRd6dWAVIGpspKiasQ07KGlrhzwG+rFY4 5nbQ+TeGaakifCUV4DkUBh5F7cCLQvXV91sPte6DR0az/6sLEpMsKQeUDSh3obUTvH N+qSa95ub9UNuA84n9yxnt8TZxGPUvQvZoKeMiNzyzWe6EqO8JMChAOVGl6ozRfRxY 8W9Z0J1VZQEfFKMUZEJ+TskPZO0kH5QbDMnDTH9oTsqSNypjFvTCa+VFA34lS0WHwx lgUv1DCp5euWQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B01BCD6E55; Wed, 3 Jun 2026 15:56:45 +0000 (UTC) From: Markus Probst via B4 Relay Date: Wed, 03 Jun 2026 17:56:41 +0200 Subject: [PATCH v12 3/3] MAINTAINERS: serdev: Add self for serdev 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: <20260603-rust_serdev-v12-3-3400ffb88b12@posteo.de> References: <20260603-rust_serdev-v12-0-3400ffb88b12@posteo.de> In-Reply-To: <20260603-rust_serdev-v12-0-3400ffb88b12@posteo.de> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Miguel Ojeda , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Kari Argillander , "Rafael J. Wysocki" , Viresh Kumar , Boqun Feng , David Airlie , Simona Vetter , Boqun Feng Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, Markus Probst X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=838; i=markus.probst@posteo.de; h=from:subject:message-id; bh=qsfz+Nm+cALqBgF4yy3YFD9abHHV2IjzdqJIYuW/9vo=; b=owEBiQJ2/ZANAwAIATR2H/jnrUPSAcsmYgBqIE67A50dgZMxw9e71+OBgdsu3wwfdXOKEPw/o zt1R2EG1RKJAk8EAAEIADkWIQSCdBjE9KxY53IwxHM0dh/4561D0gUCaiBOuxsUgAAAAAAEAA5t YW51MiwyLjUrMS4xMiwyLDIACgkQNHYf+OetQ9IfpRAAnxApU7aU7REpSwd0w7WygzKbhWtSr+o IdmKAt/c1HMNLiI2UtH5Uy7M2sCiW5mIUJaEER+vlY92KwVTfNiUQs4dSjPKpQl3FFRN9yQKz28 BMR300Rrfy+1ql2GM/VhO7fZ+KHtfel4Wt9W6zIVOcOnz0QWmiaChS/iblAEqqSMIfIa2zEOe/s fXPzslcN0b7HycbQCm9nFOTFMT+Z7sOR93MWKFbfGbgu3VCh5CCVk37zVDh/m5Km6wGyDMg5MNd NmgpGuxqSv9JFXs5hknbLOYd1Tc/mRNRukt++7SskXEKzG1kL87FpNdU7Q6YO4niX4z3PIY3+Wk UbhDQQOm60yqnt+CUHm3YiWOhPPz2QhXz+TA3Zchb2DQy+r0QIc8Q4UEZFiibDg0ptsCEcBh8W1 TSIHKld4sP9k27r+LRgNBXFT8WLlRnkpa9XEEyOarU0vsiCvlw2jfAAo+NgrxfREeiKkHsQPG7y //VpWyqLz2tacEsdAwiv1Z9AejIpzZ269EHso2dfdrQOLjFBQwSH9H7RdU+OesKXVlFryeLF/Wp L9EjF3KSoA4F2UjIcAYmYwbaHCch/aqEpV7bqlB2IrvdGhKEVX9JMco+Cqj67Txm/4yjAAx/L4v yfst5hVLD3IJSx6R3UuTgkRH7tRRupzC1J9+6Wq2f7fNtpfKFLDg= X-Developer-Key: i=markus.probst@posteo.de; a=openpgp; fpr=827418C4F4AC58E77230C47334761FF8E7AD43D2 X-Endpoint-Received: by B4 Relay for markus.probst@posteo.de/default with auth_id=680 X-Original-From: Markus Probst Reply-To: markus.probst@posteo.de From: Markus Probst Rob mentioned he needs to find someone else to maintain serdev. Link: https://lore.kernel.org/rust-for-linux/20260430195858.GA1650658-robh@= kernel.org/ Link: https://lore.kernel.org/rust-for-linux/da85ceb81f51079d4a8248a1ffde6a= 27d2ef24ad.camel@posteo.de/ Signed-off-by: Markus Probst --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 3b995cb6e902..200f0ab09f9b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24271,7 +24271,7 @@ F: drivers/iio/chemical/sps30_i2c.c F: drivers/iio/chemical/sps30_serial.c =20 SERIAL DEVICE BUS -M: Rob Herring +M: Markus Probst L: linux-serial@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/serial/serial.yaml --=20 2.53.0