summaryrefslogtreecommitdiff
path: root/samples/rust
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-06-15 12:41:17 +0530
committerLinus Torvalds <torvalds@linux-foundation.org>2026-06-15 12:41:17 +0530
commit36808d5e983985bbda87e01059cccc071fe3ec8d (patch)
treefe89e03319a2eeacabced24f1e6b96123ad527f9 /samples/rust
parent5504ce0317f777dcf102751c3e518284226fc2e1 (diff)
parentfe221742e388bea3f5856b5d9b2cb0a037020ea4 (diff)
Merge tag 'driver-core-7.2-rc1' of gitolite.kernel.org:pub/scm/linux/kernel/git/driver-core/driver-core
Pull driver core updates from Danilo Krummrich: "Deferred probe: - Fix race where deferred probe timeout work could be permanently canceled by using mod_delayed_work() - Fix missing jiffies conversion in deferred_probe_extend_timeout() - Guard timeout extension with delayed_work_pending() to prevent premature firing - Use system_percpu_wq instead of the deprecated system_wq - Update deferred_probe_timeout documentation device: - Replace direct struct device bitfield access (can_match, dma_iommu, dma_skip_sync, dma_ops_bypass, state_synced, dma_coherent, of_node_reused, offline, offline_disabled) with flag-based accessors using bit operations - Reject devices with unregistered buses - Delete unused DEVICE_ATTR_PREALLOC() - Add low-level device attribute macros with const show/store callbacks, allowing device attributes to reside in read-only memory - Move core device attributes to read-only memory - Constify group array pointers in driver_add_groups() / driver_remove_groups(), struct bus_type, and struct device_driver device property: - Fix fwnode reference leak in fwnode_graph_get_endpoint_by_id() - Initialize all fields of fwnode_handle in fwnode_init() - Provide swnode_get()/swnode_put() wrappers around kobject_get/put() - Allow passing struct software_node_ref_args pointers directly to PROPERTY_ENTRY_REF() driver_override: - Migrate amba, cdx, vmbus, and rpmsg to the generic driver_override infrastructure, fixing a UAF from unsynchronized access to driver_override in bus match() callbacks - Remove the now-unused driver_set_override() firmware loader: - Fix recursive lock deadlock in device_cache_fw_images() when async work falls back to synchronous execution - Fix device reference leak in firmware_upload_register() platform: - Pass KBUILD_MODNAME through the platform driver registration macro to create module symlinks in sysfs for built-in drivers; move module_kset initialization to a pure_initcall and tegra cbb registration to core_initcall to ensure correct ordering - Pass THIS_MODULE implicitly through a coresight_init_driver() macro sysfs: - Upgrade OOB write detection in sysfs_kf_seq_show() from printk to WARN - Add return value clamping to sysfs_kf_read() Rust: - ACPI: Fix missing match data for PRP0001 by exporting acpi_of_match_device() - Auxiliary: Replace drvdata() with dedicated registration data on auxiliary_device. drvdata() exposed the driver's bus device private data beyond the driver's own scope, creating ordering constraints and forcing the data to outlive all registrations that access it. Registration data is instead scoped structurally to the Registration object, making lifecycle ordering enforced by construction rather than convention. - Rust-native device driver lifetimes (HRT): Allow Rust device drivers to carry a lifetime parameter on their bus device private data, tied to the device binding scope -- the interval during which a bus device is bound to a driver. Device resources like pci::Bar<'a> and IoMem<'a> can be stored directly in the driver's bus device private data with a lifetime bounded by the binding scope, so the compiler enforces at build time that they do not outlive the binding. This removes Devres indirection from every access site and eliminates try_access() failure paths in destructors. Bus driver traits use a Generic Associated Type (GAT) Data<'bound> to introduce the lifetime on the private data, rather than parameterizing the Driver trait itself. Auxiliary registration data, where the lifetime is not introduced by a trait callback but must be threaded through Registration, uses the ForLt trait (a type-level abstraction for types generic over a lifetime). Misc: - Fix DT overlayed devices not probing by reverting the broken treewide overlay fix and re-running fw_devlink consumer pickup when an overlay is applied to a bound device - Use root_device_register() for faux bus root device; add sanity check for failed bus init - Fix dev_has_sync_state() data race with READ_ONCE() and move it to base.h - Avoid spurious device_links warning when removing a device while its supplier is unbinding - Switch ISA bus to dynamic root device - Fix suspicious RCU usage in kernfs_put() - Remove devcoredump exit callback - Constify devfreq_event_class" * tag 'driver-core-7.2-rc1' of gitolite.kernel.org:pub/scm/linux/kernel/git/driver-core/driver-core: (81 commits) software node: allow passing reference args to PROPERTY_ENTRY_REF() driver core: platform: set mod_name in driver registration coresight: pass THIS_MODULE implicitly through a macro kernel: param: initialize module_kset in a pure_initcall soc/tegra: cbb: Move driver registration from pure_initcall to core_initcall firmware_loader: Fix recursive lock in device_cache_fw_images() driver core: Use system_percpu_wq instead of system_wq driver core: remove driver_set_override() rpmsg: use generic driver_override infrastructure Drivers: hv: vmbus: use generic driver_override infrastructure cdx: use generic driver_override infrastructure amba: use generic driver_override infrastructure rust: devres: add 'static bound to Devres<T> samples: rust: rust_driver_auxiliary: showcase lifetime-bound registration data rust: auxiliary: generalize Registration over ForLt rust: types: add `ForLt` trait for higher-ranked lifetime support gpu: nova-core: separate driver type from driver data samples: rust: rust_driver_pci: use HRT lifetime for Bar rust: io: make IoMem and ExclusiveIoMem lifetime-parameterized rust: pci: make Bar lifetime-parameterized ...
Diffstat (limited to 'samples/rust')
-rw-r--r--samples/rust/rust_debugfs.rs11
-rw-r--r--samples/rust/rust_dma.rs6
-rw-r--r--samples/rust/rust_driver_auxiliary.rs79
-rw-r--r--samples/rust/rust_driver_i2c.rs13
-rw-r--r--samples/rust/rust_driver_pci.rs90
-rw-r--r--samples/rust/rust_driver_platform.rs9
-rw-r--r--samples/rust/rust_driver_usb.rs15
-rw-r--r--samples/rust/rust_i2c_client.rs14
-rw-r--r--samples/rust/rust_soc.rs9
9 files changed, 144 insertions, 102 deletions
diff --git a/samples/rust/rust_debugfs.rs b/samples/rust/rust_debugfs.rs
index 0963efe19f93..1f59e08aaa4b 100644
--- a/samples/rust/rust_debugfs.rs
+++ b/samples/rust/rust_debugfs.rs
@@ -117,13 +117,14 @@ kernel::acpi_device_table!(
impl platform::Driver for RustDebugFs {
type IdInfo = ();
+ type Data<'bound> = Self;
const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = None;
const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);
- fn probe(
- pdev: &platform::Device<Core>,
- _info: Option<&Self::IdInfo>,
- ) -> impl PinInit<Self, Error> {
+ fn probe<'bound>(
+ pdev: &'bound platform::Device<Core<'_>>,
+ _info: Option<&'bound Self::IdInfo>,
+ ) -> impl PinInit<Self, Error> + 'bound {
RustDebugFs::new(pdev).pin_chain(|this| {
this.counter.store(91, Relaxed);
{
@@ -146,7 +147,7 @@ impl RustDebugFs {
dir.read_write_file(c"pair", new_mutex!(Inner { x: 3, y: 10 }))
}
- fn new(pdev: &platform::Device<Core>) -> impl PinInit<Self, Error> + '_ {
+ fn new<'a>(pdev: &'a platform::Device<Core<'_>>) -> impl PinInit<Self, Error> + 'a {
let debugfs = Dir::new(c"sample_debugfs");
let dev = pdev.as_ref();
diff --git a/samples/rust/rust_dma.rs b/samples/rust/rust_dma.rs
index a2c34bb74273..5046b4628d0e 100644
--- a/samples/rust/rust_dma.rs
+++ b/samples/rust/rust_dma.rs
@@ -58,9 +58,13 @@ kernel::pci_device_table!(
impl pci::Driver for DmaSampleDriver {
type IdInfo = ();
+ type Data<'bound> = Self;
const ID_TABLE: pci::IdTable<Self::IdInfo> = &PCI_TABLE;
- fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, Error> {
+ fn probe<'bound>(
+ pdev: &'bound pci::Device<Core<'_>>,
+ _info: &'bound Self::IdInfo,
+ ) -> impl PinInit<Self, Error> + 'bound {
pin_init::pin_init_scope(move || {
dev_info!(pdev, "Probe DMA test driver.\n");
diff --git a/samples/rust/rust_driver_auxiliary.rs b/samples/rust/rust_driver_auxiliary.rs
index 5c5a5105a3ff..2c1351040e45 100644
--- a/samples/rust/rust_driver_auxiliary.rs
+++ b/samples/rust/rust_driver_auxiliary.rs
@@ -10,15 +10,13 @@ use kernel::{
Bound,
Core, //
},
- devres::Devres,
driver,
pci,
prelude::*,
+ types::ForLt,
InPlaceModule, //
};
-use core::any::TypeId;
-
const MODULE_NAME: &CStr = <LocalModule as kernel::ModuleMetadata>::NAME;
const AUXILIARY_NAME: &CStr = c"auxiliary";
@@ -33,10 +31,14 @@ kernel::auxiliary_device_table!(
impl auxiliary::Driver for AuxiliaryDriver {
type IdInfo = ();
+ type Data<'bound> = Self;
const ID_TABLE: auxiliary::IdTable<Self::IdInfo> = &AUX_TABLE;
- fn probe(adev: &auxiliary::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, Error> {
+ fn probe<'bound>(
+ adev: &'bound auxiliary::Device<Core<'_>>,
+ _info: &'bound Self::IdInfo,
+ ) -> impl PinInit<Self, Error> + 'bound {
dev_info!(
adev,
"Probing auxiliary driver for auxiliary device with id={}\n",
@@ -49,13 +51,17 @@ impl auxiliary::Driver for AuxiliaryDriver {
}
}
-#[pin_data]
-struct ParentDriver {
- private: TypeId,
- #[pin]
- _reg0: Devres<auxiliary::Registration>,
- #[pin]
- _reg1: Devres<auxiliary::Registration>,
+struct Data<'bound> {
+ index: u32,
+ parent: &'bound pci::Device<Bound>,
+}
+
+struct ParentDriver;
+
+#[allow(clippy::type_complexity)]
+struct ParentData<'bound> {
+ _reg0: auxiliary::Registration<'bound, ForLt!(Data<'_>)>,
+ _reg1: auxiliary::Registration<'bound, ForLt!(Data<'_>)>,
}
kernel::pci_device_table!(
@@ -67,26 +73,53 @@ kernel::pci_device_table!(
impl pci::Driver for ParentDriver {
type IdInfo = ();
+ type Data<'bound> = ParentData<'bound>;
const ID_TABLE: pci::IdTable<Self::IdInfo> = &PCI_TABLE;
- fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, Error> {
- try_pin_init!(Self {
- private: TypeId::of::<Self>(),
- _reg0 <- auxiliary::Registration::new(pdev.as_ref(), AUXILIARY_NAME, 0, MODULE_NAME),
- _reg1 <- auxiliary::Registration::new(pdev.as_ref(), AUXILIARY_NAME, 1, MODULE_NAME),
+ fn probe<'bound>(
+ pdev: &'bound pci::Device<Core<'_>>,
+ _info: &'bound Self::IdInfo,
+ ) -> impl PinInit<Self::Data<'bound>, Error> + 'bound {
+ Ok(ParentData {
+ // SAFETY: `ParentData` is the driver's private data, which is dropped when the
+ // device is unbound; i.e. `mem::forget()` is never called on it.
+ _reg0: unsafe {
+ auxiliary::Registration::new_with_lt(
+ pdev.as_ref(),
+ AUXILIARY_NAME,
+ 0,
+ MODULE_NAME,
+ Data {
+ index: 0,
+ parent: pdev,
+ },
+ )?
+ },
+ // SAFETY: See `_reg0` above.
+ _reg1: unsafe {
+ auxiliary::Registration::new_with_lt(
+ pdev.as_ref(),
+ AUXILIARY_NAME,
+ 1,
+ MODULE_NAME,
+ Data {
+ index: 1,
+ parent: pdev,
+ },
+ )?
+ },
})
}
}
impl ParentDriver {
fn connect(adev: &auxiliary::Device<Bound>) -> Result {
- let dev = adev.parent();
- let pdev: &pci::Device<Bound> = dev.try_into()?;
- let drvdata = dev.drvdata::<Self>()?;
+ let data = adev.registration_data::<ForLt!(Data<'_>)>()?;
+ let pdev = data.parent;
dev_info!(
- dev,
+ pdev,
"Connect auxiliary {} with parent: VendorID={}, DeviceID={:#x}\n",
adev.id(),
pdev.vendor_id(),
@@ -94,9 +127,9 @@ impl ParentDriver {
);
dev_info!(
- dev,
- "We have access to the private data of {:?}.\n",
- drvdata.private
+ pdev,
+ "Connected to auxiliary device with index {}.\n",
+ data.index
);
Ok(())
diff --git a/samples/rust/rust_driver_i2c.rs b/samples/rust/rust_driver_i2c.rs
index 6be79f9e9fb5..ead8263a7d48 100644
--- a/samples/rust/rust_driver_i2c.rs
+++ b/samples/rust/rust_driver_i2c.rs
@@ -35,15 +35,16 @@ kernel::of_device_table! {
impl i2c::Driver for SampleDriver {
type IdInfo = u32;
+ type Data<'bound> = Self;
const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);
const I2C_ID_TABLE: Option<i2c::IdTable<Self::IdInfo>> = Some(&I2C_TABLE);
const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);
- fn probe(
- idev: &i2c::I2cClient<Core>,
- info: Option<&Self::IdInfo>,
- ) -> impl PinInit<Self, Error> {
+ fn probe<'bound>(
+ idev: &'bound i2c::I2cClient<Core<'_>>,
+ info: Option<&'bound Self::IdInfo>,
+ ) -> impl PinInit<Self, Error> + 'bound {
let dev = idev.as_ref();
dev_info!(dev, "Probe Rust I2C driver sample.\n");
@@ -55,11 +56,11 @@ impl i2c::Driver for SampleDriver {
Ok(Self)
}
- fn shutdown(idev: &i2c::I2cClient<Core>, _this: Pin<&Self>) {
+ fn shutdown<'bound>(idev: &'bound i2c::I2cClient<Core<'_>>, _this: Pin<&Self>) {
dev_info!(idev.as_ref(), "Shutdown Rust I2C driver sample.\n");
}
- fn unbind(idev: &i2c::I2cClient<Core>, _this: Pin<&Self>) {
+ fn unbind<'bound>(idev: &'bound i2c::I2cClient<Core<'_>>, _this: Pin<&Self>) {
dev_info!(idev.as_ref(), "Unbind Rust I2C driver sample.\n");
}
}
diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs
index 47d3e84fab63..1aa8197d8698 100644
--- a/samples/rust/rust_driver_pci.rs
+++ b/samples/rust/rust_driver_pci.rs
@@ -9,7 +9,6 @@ use kernel::{
Bound,
Core, //
},
- devres::Devres,
io::{
register,
register::Array,
@@ -17,8 +16,7 @@ use kernel::{
},
num::Bounded,
pci,
- prelude::*,
- sync::aref::ARef, //
+ prelude::*, //
};
mod regs {
@@ -45,7 +43,7 @@ mod regs {
pub(super) const END: usize = 0x10;
}
-type Bar0 = pci::Bar<{ regs::END }>;
+type Bar0<'bound> = pci::Bar<'bound, { regs::END }>;
#[derive(Copy, Clone, Debug)]
struct TestIndex(u8);
@@ -66,14 +64,14 @@ impl TestIndex {
const NO_EVENTFD: Self = Self(0);
}
-#[pin_data(PinnedDrop)]
-struct SampleDriver {
- pdev: ARef<pci::Device>,
- #[pin]
- bar: Devres<Bar0>,
+struct SampleDriverData<'bound> {
+ pdev: &'bound pci::Device,
+ bar: Bar0<'bound>,
index: TestIndex,
}
+struct SampleDriver;
+
kernel::pci_device_table!(
PCI_TABLE,
MODULE_PCI_TABLE,
@@ -84,8 +82,8 @@ kernel::pci_device_table!(
)]
);
-impl SampleDriver {
- fn testdev(index: &TestIndex, bar: &Bar0) -> Result<u32> {
+impl SampleDriverData<'_> {
+ fn testdev(index: &TestIndex, bar: &Bar0<'_>) -> Result<u32> {
// Select the test.
bar.write_reg(regs::TEST::zeroed().with_index(*index));
@@ -140,51 +138,49 @@ impl SampleDriver {
impl pci::Driver for SampleDriver {
type IdInfo = TestIndex;
+ type Data<'bound> = SampleDriverData<'bound>;
const ID_TABLE: pci::IdTable<Self::IdInfo> = &PCI_TABLE;
- fn probe(pdev: &pci::Device<Core>, info: &Self::IdInfo) -> impl PinInit<Self, Error> {
- pin_init::pin_init_scope(move || {
- let vendor = pdev.vendor_id();
- dev_dbg!(
- pdev,
- "Probe Rust PCI driver sample (PCI ID: {}, 0x{:x}).\n",
- vendor,
- pdev.device_id()
- );
-
- pdev.enable_device_mem()?;
- pdev.set_master();
-
- Ok(try_pin_init!(Self {
- bar <- pdev.iomap_region_sized::<{ regs::END }>(0, c"rust_driver_pci"),
- index: *info,
- _: {
- let bar = bar.access(pdev.as_ref())?;
-
- dev_info!(
- pdev,
- "pci-testdev data-match count: {}\n",
- Self::testdev(info, bar)?
- );
- Self::config_space(pdev);
- },
- pdev: pdev.into(),
- }))
+ fn probe<'bound>(
+ pdev: &'bound pci::Device<Core<'_>>,
+ info: &'bound Self::IdInfo,
+ ) -> impl PinInit<Self::Data<'bound>, Error> + 'bound {
+ let vendor = pdev.vendor_id();
+ dev_dbg!(
+ pdev,
+ "Probe Rust PCI driver sample (PCI ID: {}, 0x{:x}).\n",
+ vendor,
+ pdev.device_id()
+ );
+
+ pdev.enable_device_mem()?;
+ pdev.set_master();
+
+ let bar = pdev.iomap_region_sized::<{ regs::END }>(0, c"rust_driver_pci")?;
+
+ dev_info!(
+ pdev,
+ "pci-testdev data-match count: {}\n",
+ SampleDriverData::testdev(info, &bar)?
+ );
+ SampleDriverData::config_space(pdev);
+
+ Ok(SampleDriverData {
+ pdev,
+ bar,
+ index: *info,
})
}
- fn unbind(pdev: &pci::Device<Core>, this: Pin<&Self>) {
- if let Ok(bar) = this.bar.access(pdev.as_ref()) {
- // Reset pci-testdev by writing a new test index.
- bar.write_reg(regs::TEST::zeroed().with_index(this.index));
- }
+ fn unbind<'bound>(_pdev: &'bound pci::Device<Core<'_>>, this: Pin<&Self::Data<'bound>>) {
+ this.bar
+ .write_reg(regs::TEST::zeroed().with_index(this.index));
}
}
-#[pinned_drop]
-impl PinnedDrop for SampleDriver {
- fn drop(self: Pin<&mut Self>) {
+impl Drop for SampleDriverData<'_> {
+ fn drop(&mut self) {
dev_dbg!(self.pdev, "Remove Rust PCI driver sample.\n");
}
}
diff --git a/samples/rust/rust_driver_platform.rs b/samples/rust/rust_driver_platform.rs
index f2229d176fb9..ec0d6cac4f57 100644
--- a/samples/rust/rust_driver_platform.rs
+++ b/samples/rust/rust_driver_platform.rs
@@ -101,13 +101,14 @@ kernel::acpi_device_table!(
impl platform::Driver for SampleDriver {
type IdInfo = Info;
+ type Data<'bound> = Self;
const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);
const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);
- fn probe(
- pdev: &platform::Device<Core>,
- info: Option<&Self::IdInfo>,
- ) -> impl PinInit<Self, Error> {
+ fn probe<'bound>(
+ pdev: &'bound platform::Device<Core<'_>>,
+ info: Option<&'bound Self::IdInfo>,
+ ) -> impl PinInit<Self, Error> + 'bound {
let dev = pdev.as_ref();
dev_dbg!(dev, "Probe Rust Platform driver sample.\n");
diff --git a/samples/rust/rust_driver_usb.rs b/samples/rust/rust_driver_usb.rs
index ab72e99e1274..02bd5085f9bc 100644
--- a/samples/rust/rust_driver_usb.rs
+++ b/samples/rust/rust_driver_usb.rs
@@ -26,21 +26,22 @@ kernel::usb_device_table!(
impl usb::Driver for SampleDriver {
type IdInfo = ();
+ type Data<'bound> = Self;
const ID_TABLE: usb::IdTable<Self::IdInfo> = &USB_TABLE;
- fn probe(
- intf: &usb::Interface<Core>,
+ fn probe<'bound>(
+ intf: &'bound usb::Interface<Core<'_>>,
_id: &usb::DeviceId,
- _info: &Self::IdInfo,
- ) -> impl PinInit<Self, Error> {
- let dev: &device::Device<Core> = intf.as_ref();
+ _info: &'bound Self::IdInfo,
+ ) -> impl PinInit<Self, Error> + 'bound {
+ let dev: &device::Device<Core<'_>> = intf.as_ref();
dev_info!(dev, "Rust USB driver sample probed\n");
Ok(Self { _intf: intf.into() })
}
- fn disconnect(intf: &usb::Interface<Core>, _data: Pin<&Self>) {
- let dev: &device::Device<Core> = intf.as_ref();
+ fn disconnect<'bound>(intf: &'bound usb::Interface<Core<'_>>, _data: Pin<&Self>) {
+ let dev: &device::Device<Core<'_>> = intf.as_ref();
dev_info!(dev, "Rust USB driver sample disconnected\n");
}
}
diff --git a/samples/rust/rust_i2c_client.rs b/samples/rust/rust_i2c_client.rs
index 8d2c12e535b0..2d876f4e3ee0 100644
--- a/samples/rust/rust_i2c_client.rs
+++ b/samples/rust/rust_i2c_client.rs
@@ -106,13 +106,14 @@ const BOARD_INFO: i2c::I2cBoardInfo =
impl platform::Driver for SampleDriver {
type IdInfo = ();
+ type Data<'bound> = Self;
const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);
const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);
- fn probe(
- pdev: &platform::Device<device::Core>,
- _info: Option<&Self::IdInfo>,
- ) -> impl PinInit<Self, Error> {
+ fn probe<'bound>(
+ pdev: &'bound platform::Device<device::Core<'_>>,
+ _info: Option<&'bound Self::IdInfo>,
+ ) -> impl PinInit<Self, Error> + 'bound {
dev_info!(
pdev.as_ref(),
"Probe Rust I2C Client registration sample.\n"
@@ -129,7 +130,10 @@ impl platform::Driver for SampleDriver {
})
}
- fn unbind(pdev: &platform::Device<device::Core>, _this: Pin<&Self>) {
+ fn unbind<'bound>(
+ pdev: &'bound platform::Device<device::Core<'_>>,
+ _this: Pin<&Self::Data<'bound>>,
+ ) {
dev_info!(
pdev.as_ref(),
"Unbind Rust I2C Client registration sample.\n"
diff --git a/samples/rust/rust_soc.rs b/samples/rust/rust_soc.rs
index 8079c1c48416..808d58200eb6 100644
--- a/samples/rust/rust_soc.rs
+++ b/samples/rust/rust_soc.rs
@@ -37,13 +37,14 @@ kernel::acpi_device_table!(
impl platform::Driver for SampleSocDriver {
type IdInfo = ();
+ type Data<'bound> = Self;
const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);
const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);
- fn probe(
- pdev: &platform::Device<Core>,
- _info: Option<&Self::IdInfo>,
- ) -> impl PinInit<Self, Error> {
+ fn probe<'bound>(
+ pdev: &'bound platform::Device<Core<'_>>,
+ _info: Option<&'bound Self::IdInfo>,
+ ) -> impl PinInit<Self, Error> + 'bound {
dev_dbg!(pdev, "Probe Rust SoC driver sample.\n");
let pdev = pdev.into();