Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229243/?format=api
{ "id": 2229243, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229243/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260427221155.2144848-18-dakr@kernel.org/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.1/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260427221155.2144848-18-dakr@kernel.org>", "date": "2026-04-27T22:11:15", "name": "[17/24] rust: i2c: make Driver trait lifetime-parameterized", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "70a07abec74b03e78dca7fce9bd57c57c69dfe2c", "submitter": { "id": 89037, "url": "http://patchwork.ozlabs.org/api/1.1/people/89037/?format=api", "name": "Danilo Krummrich", "email": "dakr@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260427221155.2144848-18-dakr@kernel.org/mbox/", "series": [ { "id": 501733, "url": "http://patchwork.ozlabs.org/api/1.1/series/501733/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=501733", "date": "2026-04-27T22:10:58", "name": "rust: device: Higher-Ranked Lifetime Types for device drivers", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501733/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229243/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229243/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pci+bounces-53285-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=ttiwFdWh;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-53285-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"ttiwFdWh\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4J0F0h6Kz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 08:19:57 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id DB0DB316F6E7\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 22:14:38 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id ABDFC3B27CD;\n\tMon, 27 Apr 2026 22:13:55 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 871993ACF1F;\n\tMon, 27 Apr 2026 22:13:55 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 8C975C19425;\n\tMon, 27 Apr 2026 22:13:49 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777328035; cv=none;\n b=V/sYwupkKaQ6PZvf6cosQ+3B2JGESY6erwE060Lypj0Cx6mBtLe/lhWMq3rboU8LIxZn+nsqOkGwHgBybjyfAb1vQL22SAxMzHqeBmPXuidDFYlQOE6igSNuhTXGO/ulZINvEI6KCzkJT5s4RA/vLijbjG1uekAwagKIoWNhmo8=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777328035; c=relaxed/simple;\n\tbh=ru1OCYUc534Gm2mrQq6Ir697MoQdZy8URoT3Gukyl0E=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=bXgB9rx9RyktYFbxqOfz5fjt8sNGXtfj1+agbP4sxcMa6ouaTS6w3KTHK8h3ox4oZD7dnTjvQWKjKtBCC7jQOhTicuhBPQHaCRl1wa0GO9u5C+tlem8MMUkuLfxyXWyQCqEg2sv1S7P35N7UtzkygWj43WlKO/9UMlmL696RUXU=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=ttiwFdWh; arc=none smtp.client-ip=10.30.226.201", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777328035;\n\tbh=ru1OCYUc534Gm2mrQq6Ir697MoQdZy8URoT3Gukyl0E=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ttiwFdWhBUqiITT4H2ptesCXtBZTLIOSXkOjqkaUNBpnmX8TqAYnDHnqcZrKB6jSF\n\t 6xSXWLRRNxVcSsdt8ejTnt5ElHsaZj2QoMCQtpGFxR5liHzQwWB6n3IMDkBzuV/Wti\n\t VN+CX3lBD76TrQWyEoVstqX5j0Qsiol1zUUYNcQChQACz8OxAhmMR/6bW54GSHCVxf\n\t 1nq8mr9aJM0hHV1qmEko9OZZvI15cCtBGIo+4G4lME5WHmlFk3g9G7JFigXbchE1WY\n\t LMiJNhgS2trG7+e66OuphvwmYqNSZKdEg7aukBv2DbNcIqN2PuGBtLH0F0NOhVHngW\n\t OaIXqKg/qb5fg==", "From": "Danilo Krummrich <dakr@kernel.org>", "To": "gregkh@linuxfoundation.org,\n\trafael@kernel.org,\n\tacourbot@nvidia.com,\n\taliceryhl@google.com,\n\tdavid.m.ertman@intel.com,\n\tira.weiny@intel.com,\n\tleon@kernel.org,\n\tviresh.kumar@linaro.org,\n\tm.wilczynski@samsung.com,\n\tukleinek@kernel.org,\n\tbhelgaas@google.com,\n\tkwilczynski@kernel.org,\n\tabdiel.janulgue@gmail.com,\n\trobin.murphy@arm.com,\n\tmarkus.probst@posteo.de,\n\tojeda@kernel.org,\n\tboqun@kernel.org,\n\tgary@garyguo.net,\n\tbjorn3_gh@protonmail.com,\n\tlossin@kernel.org,\n\ta.hindborg@kernel.org,\n\ttmgross@umich.edu", "Cc": "driver-core@lists.linux.dev,\n\tlinux-kernel@vger.kernel.org,\n\tnova-gpu@lists.linux.dev,\n\tdri-devel@lists.freedesktop.org,\n\tlinux-pm@vger.kernel.org,\n\tlinux-pwm@vger.kernel.org,\n\tlinux-pci@vger.kernel.org,\n\trust-for-linux@vger.kernel.org,\n\tDanilo Krummrich <dakr@kernel.org>", "Subject": "[PATCH 17/24] rust: i2c: make Driver trait lifetime-parameterized", "Date": "Tue, 28 Apr 2026 00:11:15 +0200", "Message-ID": "<20260427221155.2144848-18-dakr@kernel.org>", "X-Mailer": "git-send-email 2.54.0", "In-Reply-To": "<20260427221155.2144848-1-dakr@kernel.org>", "References": "<20260427221155.2144848-1-dakr@kernel.org>", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "Make i2c::Driver take a lifetime parameter 'a that ties device resources\nto the binding scope.\n\nInternally, Adapter<T: Driver> becomes Adapter<F: ForLt> with a bound\nfor<'a> F::Of<'a>: Driver<'a>; module_i2c_driver! wraps the driver type\nin ForLt!() so drivers don't have to.\n\nSigned-off-by: Danilo Krummrich <dakr@kernel.org>\n---\n rust/kernel/i2c.rs | 116 +++++++++++++++++++-------------\n samples/rust/rust_driver_i2c.rs | 18 ++---\n 2 files changed, 78 insertions(+), 56 deletions(-)", "diff": "diff --git a/rust/kernel/i2c.rs b/rust/kernel/i2c.rs\nindex 08d310aa9d6b..4464146d6c4d 100644\n--- a/rust/kernel/i2c.rs\n+++ b/rust/kernel/i2c.rs\n@@ -92,43 +92,57 @@ macro_rules! i2c_device_table {\n }\n \n /// An adapter for the registration of I2C drivers.\n-pub struct Adapter<T: Driver>(T);\n+///\n+/// `F` is a [`ForLt`](trait@ForLt) type that maps lifetimes to the driver's device\n+/// private data type, i.e. `F::Of<'a>` is the driver struct parameterized by `'a`. The macro\n+/// `module_i2c_driver!` generates this automatically via `ForLt!()`.\n+pub struct Adapter<F>(PhantomData<F>);\n \n // SAFETY:\n // - `bindings::i2c_driver` is a C type declared as `repr(C)`.\n-// - `T` is the type of the driver's device private data.\n+// - `F::Of<'static>` is the stored type of the driver's device private data.\n // - `struct i2c_driver` embeds a `struct device_driver`.\n // - `DEVICE_DRIVER_OFFSET` is the correct byte offset to the embedded `struct device_driver`.\n-unsafe impl<T: Driver + 'static> driver::DriverLayout for Adapter<T> {\n+unsafe impl<F> driver::DriverLayout for Adapter<F>\n+where\n+ F: ForLt + 'static,\n+ for<'a> F::Of<'a>: Driver<'a>,\n+{\n type DriverType = bindings::i2c_driver;\n- type DriverData = ForLt!(T);\n+ type DriverData = F;\n const DEVICE_DRIVER_OFFSET: usize = core::mem::offset_of!(Self::DriverType, driver);\n }\n \n // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if\n // a preceding call to `register` has been successful.\n-unsafe impl<T: Driver + 'static> driver::RegistrationOps for Adapter<T> {\n+unsafe impl<F> driver::RegistrationOps for Adapter<F>\n+where\n+ F: ForLt + 'static,\n+ for<'a> F::Of<'a>: Driver<'a>,\n+{\n unsafe fn register(\n idrv: &Opaque<Self::DriverType>,\n name: &'static CStr,\n module: &'static ThisModule,\n ) -> Result {\n build_assert!(\n- T::ACPI_ID_TABLE.is_some() || T::OF_ID_TABLE.is_some() || T::I2C_ID_TABLE.is_some(),\n+ <F::Of<'static> as Driver<'static>>::ACPI_ID_TABLE.is_some()\n+ || <F::Of<'static> as Driver<'static>>::OF_ID_TABLE.is_some()\n+ || <F::Of<'static> as Driver<'static>>::I2C_ID_TABLE.is_some(),\n \"At least one of ACPI/OF/Legacy tables must be present when registering an i2c driver\"\n );\n \n- let i2c_table = match T::I2C_ID_TABLE {\n+ let i2c_table = match <F::Of<'static> as Driver<'static>>::I2C_ID_TABLE {\n Some(table) => table.as_ptr(),\n None => core::ptr::null(),\n };\n \n- let of_table = match T::OF_ID_TABLE {\n+ let of_table = match <F::Of<'static> as Driver<'static>>::OF_ID_TABLE {\n Some(table) => table.as_ptr(),\n None => core::ptr::null(),\n };\n \n- let acpi_table = match T::ACPI_ID_TABLE {\n+ let acpi_table = match <F::Of<'static> as Driver<'static>>::ACPI_ID_TABLE {\n Some(table) => table.as_ptr(),\n None => core::ptr::null(),\n };\n@@ -154,7 +168,11 @@ unsafe fn unregister(idrv: &Opaque<Self::DriverType>) {\n }\n }\n \n-impl<T: Driver + 'static> Adapter<T> {\n+impl<F> Adapter<F>\n+where\n+ F: ForLt + 'static,\n+ for<'a> F::Of<'a>: Driver<'a>,\n+{\n extern \"C\" fn probe_callback(idev: *mut bindings::i2c_client) -> kernel::ffi::c_int {\n // SAFETY: The I2C bus only ever calls the probe callback with a valid pointer to a\n // `struct i2c_client`.\n@@ -162,13 +180,12 @@ extern \"C\" fn probe_callback(idev: *mut bindings::i2c_client) -> kernel::ffi::c_\n // INVARIANT: `idev` is valid for the duration of `probe_callback()`.\n let idev = unsafe { &*idev.cast::<I2cClient<device::CoreInternal>>() };\n \n- let info = Self::i2c_id_info(idev)\n- .or_else(|| <Self as driver::Adapter<'_>>::id_info(idev.as_ref()));\n-\n from_result(|| {\n- let data = T::probe(idev, info);\n+ let info = Self::i2c_id_info(idev)\n+ .or_else(|| <Self as driver::Adapter<'_>>::id_info(idev.as_ref()));\n+ let data = <F::Of<'_> as Driver<'_>>::probe(idev, info);\n \n- idev.as_ref().set_drvdata::<ForLt!(T)>(data)?;\n+ idev.as_ref().set_drvdata::<F>(data)?;\n Ok(0)\n })\n }\n@@ -178,11 +195,10 @@ extern \"C\" fn remove_callback(idev: *mut bindings::i2c_client) {\n let idev = unsafe { &*idev.cast::<I2cClient<device::CoreInternal>>() };\n \n // SAFETY: `remove_callback` is only ever called after a successful call to\n- // `probe_callback`, hence it's guaranteed that `I2cClient::set_drvdata()` has been called\n- // and stored a `Pin<KBox<T>>`.\n- let data = unsafe { idev.as_ref().drvdata_borrow::<ForLt!(T)>() };\n+ // `probe_callback`, hence it's guaranteed that drvdata has been set.\n+ let data = unsafe { idev.as_ref().drvdata_borrow::<F>() };\n \n- T::unbind(idev, data);\n+ <F::Of<'_> as Driver<'_>>::unbind(idev, data);\n }\n \n extern \"C\" fn shutdown_callback(idev: *mut bindings::i2c_client) {\n@@ -190,23 +206,22 @@ extern \"C\" fn shutdown_callback(idev: *mut bindings::i2c_client) {\n let idev = unsafe { &*idev.cast::<I2cClient<device::CoreInternal>>() };\n \n // SAFETY: `shutdown_callback` is only ever called after a successful call to\n- // `probe_callback`, hence it's guaranteed that `Device::set_drvdata()` has been called\n- // and stored a `Pin<KBox<T>>`.\n- let data = unsafe { idev.as_ref().drvdata_borrow::<ForLt!(T)>() };\n+ // `probe_callback`, hence it's guaranteed that drvdata has been set.\n+ let data = unsafe { idev.as_ref().drvdata_borrow::<F>() };\n \n- T::shutdown(idev, data);\n+ <F::Of<'_> as Driver<'_>>::shutdown(idev, data);\n }\n \n /// The [`i2c::IdTable`] of the corresponding driver.\n- fn i2c_id_table() -> Option<IdTable<<Self as driver::Adapter<'static>>::IdInfo>> {\n- T::I2C_ID_TABLE\n+ fn i2c_id_table<'a>() -> Option<IdTable<<F::Of<'a> as Driver<'a>>::IdInfo>> {\n+ <F::Of<'a> as Driver<'a>>::I2C_ID_TABLE\n }\n \n /// Returns the driver's private data from the matching entry in the [`i2c::IdTable`], if any.\n ///\n /// If this returns `None`, it means there is no match with an entry in the [`i2c::IdTable`].\n- fn i2c_id_info(dev: &I2cClient) -> Option<&'static <Self as driver::Adapter<'static>>::IdInfo> {\n- let table = Self::i2c_id_table()?;\n+ fn i2c_id_info<'a>(dev: &I2cClient) -> Option<&'a <F::Of<'a> as Driver<'a>>::IdInfo> {\n+ let table = Self::i2c_id_table::<'a>()?;\n \n // SAFETY:\n // - `table` has static lifetime, hence it's valid for reads\n@@ -225,15 +240,19 @@ fn i2c_id_info(dev: &I2cClient) -> Option<&'static <Self as driver::Adapter<'sta\n }\n }\n \n-impl<'a, T: Driver + 'static> driver::Adapter<'a> for Adapter<T> {\n- type IdInfo = T::IdInfo;\n+impl<'a, F> driver::Adapter<'a> for Adapter<F>\n+where\n+ F: ForLt + 'static,\n+ F::Of<'a>: Driver<'a>,\n+{\n+ type IdInfo = <F::Of<'a> as Driver<'a>>::IdInfo;\n \n fn of_id_table() -> Option<of::IdTable<Self::IdInfo>> {\n- T::OF_ID_TABLE\n+ <F::Of<'a> as Driver<'a>>::OF_ID_TABLE\n }\n \n fn acpi_id_table() -> Option<acpi::IdTable<Self::IdInfo>> {\n- T::ACPI_ID_TABLE\n+ <F::Of<'a> as Driver<'a>>::ACPI_ID_TABLE\n }\n }\n \n@@ -252,8 +271,11 @@ fn acpi_id_table() -> Option<acpi::IdTable<Self::IdInfo>> {\n /// ```\n #[macro_export]\n macro_rules! module_i2c_driver {\n- ($($f:tt)*) => {\n- $crate::module_driver!(<T>, $crate::i2c::Adapter<T>, { $($f)* });\n+ (type: $type:ty, $($rest:tt)*) => {\n+ $crate::module_driver!(<T>, $crate::i2c::Adapter<T>, {\n+ type: $crate::types::ForLt!($type),\n+ $($rest)*\n+ });\n };\n }\n \n@@ -271,7 +293,7 @@ macro_rules! module_i2c_driver {\n /// kernel::acpi_device_table!(\n /// ACPI_TABLE,\n /// MODULE_ACPI_TABLE,\n-/// <MyDriver as i2c::Driver>::IdInfo,\n+/// <MyDriver as i2c::Driver<'_>>::IdInfo,\n /// [\n /// (acpi::DeviceId::new(c\"LNUXBEEF\"), ())\n /// ]\n@@ -280,7 +302,7 @@ macro_rules! module_i2c_driver {\n /// kernel::i2c_device_table!(\n /// I2C_TABLE,\n /// MODULE_I2C_TABLE,\n-/// <MyDriver as i2c::Driver>::IdInfo,\n+/// <MyDriver as i2c::Driver<'_>>::IdInfo,\n /// [\n /// (i2c::DeviceId::new(c\"rust_driver_i2c\"), ())\n /// ]\n@@ -289,30 +311,30 @@ macro_rules! module_i2c_driver {\n /// kernel::of_device_table!(\n /// OF_TABLE,\n /// MODULE_OF_TABLE,\n-/// <MyDriver as i2c::Driver>::IdInfo,\n+/// <MyDriver as i2c::Driver<'_>>::IdInfo,\n /// [\n /// (of::DeviceId::new(c\"test,device\"), ())\n /// ]\n /// );\n ///\n-/// impl i2c::Driver for MyDriver {\n+/// impl<'a> i2c::Driver<'a> for MyDriver {\n /// type IdInfo = ();\n /// const I2C_ID_TABLE: Option<i2c::IdTable<Self::IdInfo>> = Some(&I2C_TABLE);\n /// const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);\n /// const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);\n ///\n /// fn probe(\n-/// _idev: &i2c::I2cClient<Core>,\n-/// _id_info: Option<&Self::IdInfo>,\n-/// ) -> impl PinInit<Self, Error> {\n+/// _idev: &'a i2c::I2cClient<Core>,\n+/// _id_info: Option<&'a Self::IdInfo>,\n+/// ) -> impl PinInit<Self, Error> + 'a {\n /// Err(ENODEV)\n /// }\n ///\n-/// fn shutdown(_idev: &i2c::I2cClient<Core>, this: Pin<&Self>) {\n+/// fn shutdown(_idev: &'a i2c::I2cClient<Core>, _this: Pin<&'a Self>) {\n /// }\n /// }\n ///```\n-pub trait Driver: Send {\n+pub trait Driver<'a>: Send {\n /// The type holding information about each device id supported by the driver.\n // TODO: Use `associated_type_defaults` once stabilized:\n //\n@@ -335,9 +357,9 @@ pub trait Driver: Send {\n /// Called when a new i2c client is added or discovered.\n /// Implementers should attempt to initialize the client here.\n fn probe(\n- dev: &I2cClient<device::Core>,\n- id_info: Option<&Self::IdInfo>,\n- ) -> impl PinInit<Self, Error>;\n+ dev: &'a I2cClient<device::Core>,\n+ id_info: Option<&'a Self::IdInfo>,\n+ ) -> impl PinInit<Self, Error> + 'a;\n \n /// I2C driver shutdown.\n ///\n@@ -350,7 +372,7 @@ fn probe(\n /// This callback is distinct from final resource cleanup, as the driver instance remains valid\n /// after it returns. Any deallocation or teardown of driver-owned resources should instead be\n /// handled in `Self::drop`.\n- fn shutdown(dev: &I2cClient<device::Core>, this: Pin<&Self>) {\n+ fn shutdown(dev: &'a I2cClient<device::Core>, this: Pin<&'a Self>) {\n let _ = (dev, this);\n }\n \n@@ -364,7 +386,7 @@ fn shutdown(dev: &I2cClient<device::Core>, this: Pin<&Self>) {\n /// operations to gracefully tear down the device.\n ///\n /// Otherwise, release operations for driver resources should be performed in `Self::drop`.\n- fn unbind(dev: &I2cClient<device::Core>, this: Pin<&Self>) {\n+ fn unbind(dev: &'a I2cClient<device::Core>, this: Pin<&'a Self>) {\n let _ = (dev, this);\n }\n }\ndiff --git a/samples/rust/rust_driver_i2c.rs b/samples/rust/rust_driver_i2c.rs\nindex 6be79f9e9fb5..f86c1cf7c786 100644\n--- a/samples/rust/rust_driver_i2c.rs\n+++ b/samples/rust/rust_driver_i2c.rs\n@@ -15,25 +15,25 @@\n kernel::acpi_device_table! {\n ACPI_TABLE,\n MODULE_ACPI_TABLE,\n- <SampleDriver as i2c::Driver>::IdInfo,\n+ <SampleDriver as i2c::Driver<'_>>::IdInfo,\n [(acpi::DeviceId::new(c\"LNUXBEEF\"), 0)]\n }\n \n kernel::i2c_device_table! {\n I2C_TABLE,\n MODULE_I2C_TABLE,\n- <SampleDriver as i2c::Driver>::IdInfo,\n+ <SampleDriver as i2c::Driver<'_>>::IdInfo,\n [(i2c::DeviceId::new(c\"rust_driver_i2c\"), 0)]\n }\n \n kernel::of_device_table! {\n OF_TABLE,\n MODULE_OF_TABLE,\n- <SampleDriver as i2c::Driver>::IdInfo,\n+ <SampleDriver as i2c::Driver<'_>>::IdInfo,\n [(of::DeviceId::new(c\"test,rust_driver_i2c\"), 0)]\n }\n \n-impl i2c::Driver for SampleDriver {\n+impl<'a> i2c::Driver<'a> for SampleDriver {\n type IdInfo = u32;\n \n const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);\n@@ -41,9 +41,9 @@ impl i2c::Driver for SampleDriver {\n const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);\n \n fn probe(\n- idev: &i2c::I2cClient<Core>,\n- info: Option<&Self::IdInfo>,\n- ) -> impl PinInit<Self, Error> {\n+ idev: &'a i2c::I2cClient<Core>,\n+ info: Option<&'a Self::IdInfo>,\n+ ) -> impl PinInit<Self, Error> + 'a {\n let dev = idev.as_ref();\n \n dev_info!(dev, \"Probe Rust I2C driver sample.\\n\");\n@@ -55,11 +55,11 @@ fn probe(\n Ok(Self)\n }\n \n- fn shutdown(idev: &i2c::I2cClient<Core>, _this: Pin<&Self>) {\n+ fn shutdown(idev: &'a i2c::I2cClient<Core>, _this: Pin<&'a Self>) {\n dev_info!(idev.as_ref(), \"Shutdown Rust I2C driver sample.\\n\");\n }\n \n- fn unbind(idev: &i2c::I2cClient<Core>, _this: Pin<&Self>) {\n+ fn unbind(idev: &'a i2c::I2cClient<Core>, _this: Pin<&'a Self>) {\n dev_info!(idev.as_ref(), \"Unbind Rust I2C driver sample.\\n\");\n }\n }\n", "prefixes": [ "17/24" ] }