Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229245/?format=api
{ "id": 2229245, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229245/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260427221155.2144848-21-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-21-dakr@kernel.org>", "date": "2026-04-27T22:11:18", "name": "[20/24] samples: rust: rust_driver_pci: use HRT lifetime for Bar", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "9a00419cee95ddf00075db505e85d647cd237135", "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-21-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/2229245/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229245/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pci+bounces-53288-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=e5a52eLG;\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-53288-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=\"e5a52eLG\"", "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 4g4J0j64tBz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 08:20:21 +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 B683E318ED3D\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 22:15:09 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id C85993AEF57;\n\tMon, 27 Apr 2026 22:14:14 +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 A2DEE3AD50D;\n\tMon, 27 Apr 2026 22:14:14 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 7A906C2BCB6;\n\tMon, 27 Apr 2026 22:14:08 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777328054; cv=none;\n b=uq09KvAQoe3c0q9VFakLWUh7qO3DopYDLnsHeH2OxPQHeQGP42X0wruRMehspKJJNp3QAs82kxuGKxX+T8mHKrLUW4uDhZ3fpMqpkWgd2BEVaAMDH3INVJSvTECjr3zU0dLkty3I1q8AZRlxT3fPXqV+YJgez+E3sUP1D/mrrag=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777328054; c=relaxed/simple;\n\tbh=XiapHwreBkWCEuUnKNcDw0jpNWgyfgymZLeXPuHxqy0=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=Kn0u5Qqabc4u9CBHPB7Y+yx2nvBksLsBbJlgVT8xrw6ORLbJILMR0hznvFK1PnbdcpUYz6fXvGkeZGNZX3zWvLIu496sNuDvft9ibqdbULJfxIy5dx0dt9a7PRWzjjHXCfNOjNkEFxfQfUWs76HUnADWZtj7lSxk73GmaIYF0hs=", "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=e5a52eLG; 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=1777328054;\n\tbh=XiapHwreBkWCEuUnKNcDw0jpNWgyfgymZLeXPuHxqy0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=e5a52eLGli+O/acn0H7GNgrRvd2gsA94IDJ2pALf9WnLRw6E3MYqHMbmR2XMKX8Im\n\t SzMhCHVZiY9d9ALBdRxcor0owOPvX0R9KtpwuOhy+o1bTQOCmS/vLXwLZzizJO+i4J\n\t v7gRIwkHzDIsbar07FDbu4IuSvnxpJTDrPp1spnf/XsKL76ECGGg7GKhB8GbYhjrQC\n\t 9KNa16Md94CMpWFalQN3aNSj682XSMCeLjyixpPWnCLaK/8N82y9M6KSzcQ8qBHfpm\n\t 6vV+m/9qa0lu7OJRQCD3UfwHNBM10wB676tBWV0CIcoSx/y6wXMmD7BNRR9e5cItKb\n\t 5jQiGFny0S3LQ==", "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 20/24] samples: rust: rust_driver_pci: use HRT lifetime for\n Bar", "Date": "Tue, 28 Apr 2026 00:11:18 +0200", "Message-ID": "<20260427221155.2144848-21-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": "Convert the sample driver to SampleDriver<'a>, taking advantage of the\nlifetime-parameterized Driver trait.\n\nThe driver struct holds &'a pci::Device directly instead of\nARef<pci::Device>, and pci::Bar<'a> directly instead of\nDevres<pci::Bar>. This removes PinnedDrop, pin_init_scope, and runtime\nrevocation checks on BAR access.\n\nSigned-off-by: Danilo Krummrich <dakr@kernel.org>\n---\n samples/rust/rust_driver_pci.rs | 89 +++++++++++++++------------------\n 1 file changed, 39 insertions(+), 50 deletions(-)", "diff": "diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs\nindex 38d639731229..7f763f43a38d 100644\n--- a/samples/rust/rust_driver_pci.rs\n+++ b/samples/rust/rust_driver_pci.rs\n@@ -9,7 +9,6 @@\n Bound,\n Core, //\n },\n- devres::Devres,\n io::{\n register,\n register::Array,\n@@ -17,8 +16,7 @@\n },\n num::Bounded,\n pci,\n- prelude::*,\n- sync::aref::ARef, //\n+ prelude::*, //\n };\n \n mod regs {\n@@ -45,7 +43,7 @@ mod regs {\n pub(super) const END: usize = 0x10;\n }\n \n-type Bar0 = pci::Bar<'static, { regs::END }>;\n+type Bar0<'a> = pci::Bar<'a, { regs::END }>;\n \n #[derive(Copy, Clone, Debug)]\n struct TestIndex(u8);\n@@ -66,26 +64,24 @@ impl TestIndex {\n const NO_EVENTFD: Self = Self(0);\n }\n \n-#[pin_data(PinnedDrop)]\n-struct SampleDriver {\n- pdev: ARef<pci::Device>,\n- #[pin]\n- bar: Devres<Bar0>,\n+struct SampleDriver<'a> {\n+ pdev: &'a pci::Device,\n+ bar: Bar0<'a>,\n index: TestIndex,\n }\n \n kernel::pci_device_table!(\n PCI_TABLE,\n MODULE_PCI_TABLE,\n- <SampleDriver as pci::Driver<'_>>::IdInfo,\n+ <SampleDriver<'_> as pci::Driver<'_>>::IdInfo,\n [(\n pci::DeviceId::from_id(pci::Vendor::REDHAT, 0x5),\n TestIndex::NO_EVENTFD\n )]\n );\n \n-impl SampleDriver {\n- fn testdev(index: &TestIndex, bar: &Bar0) -> Result<u32> {\n+impl SampleDriver<'_> {\n+ fn testdev(index: &TestIndex, bar: &Bar0<'_>) -> Result<u32> {\n // Select the test.\n bar.write_reg(regs::TEST::zeroed().with_index(*index));\n \n@@ -138,7 +134,7 @@ fn config_space(pdev: &pci::Device<Bound>) {\n }\n }\n \n-impl<'a> pci::Driver<'a> for SampleDriver {\n+impl<'a> pci::Driver<'a> for SampleDriver<'a> {\n type IdInfo = TestIndex;\n \n const ID_TABLE: pci::IdTable<Self::IdInfo> = &PCI_TABLE;\n@@ -147,54 +143,47 @@ fn probe(\n pdev: &'a pci::Device<Core>,\n info: &'a Self::IdInfo,\n ) -> impl PinInit<Self, Error> + 'a {\n- pin_init::pin_init_scope(move || {\n- let vendor = pdev.vendor_id();\n- dev_dbg!(\n- pdev,\n- \"Probe Rust PCI driver sample (PCI ID: {}, 0x{:x}).\\n\",\n- vendor,\n- pdev.device_id()\n- );\n-\n- pdev.enable_device_mem()?;\n- pdev.set_master();\n-\n- Ok(try_pin_init!(Self {\n- bar: pdev.iomap_region_sized::<{ regs::END }>(0, c\"rust_driver_pci\")?\n- .into_devres()?,\n- index: *info,\n- _: {\n- let bar = bar.access(pdev.as_ref())?;\n-\n- dev_info!(\n- pdev,\n- \"pci-testdev data-match count: {}\\n\",\n- Self::testdev(info, bar)?\n- );\n- Self::config_space(pdev);\n- },\n- pdev: pdev.into(),\n- }))\n+ let vendor = pdev.vendor_id();\n+ dev_dbg!(\n+ pdev,\n+ \"Probe Rust PCI driver sample (PCI ID: {}, 0x{:x}).\\n\",\n+ vendor,\n+ pdev.device_id()\n+ );\n+\n+ pdev.enable_device_mem()?;\n+ pdev.set_master();\n+\n+ let bar = pdev.iomap_region_sized::<{ regs::END }>(0, c\"rust_driver_pci\")?;\n+\n+ dev_info!(\n+ pdev,\n+ \"pci-testdev data-match count: {}\\n\",\n+ Self::testdev(info, &bar)?\n+ );\n+ Self::config_space(pdev);\n+\n+ Ok(Self {\n+ pdev,\n+ bar,\n+ index: *info,\n })\n }\n \n- fn unbind(pdev: &'a pci::Device<Core>, this: Pin<&'a Self>) {\n- if let Ok(bar) = this.bar.access(pdev.as_ref()) {\n- // Reset pci-testdev by writing a new test index.\n- bar.write_reg(regs::TEST::zeroed().with_index(this.index));\n- }\n+ fn unbind(_pdev: &'a pci::Device<Core>, this: Pin<&'a Self>) {\n+ this.bar\n+ .write_reg(regs::TEST::zeroed().with_index(this.index));\n }\n }\n \n-#[pinned_drop]\n-impl PinnedDrop for SampleDriver {\n- fn drop(self: Pin<&mut Self>) {\n+impl Drop for SampleDriver<'_> {\n+ fn drop(&mut self) {\n dev_dbg!(self.pdev, \"Remove Rust PCI driver sample.\\n\");\n }\n }\n \n kernel::module_pci_driver! {\n- type: SampleDriver,\n+ type: SampleDriver<'_>,\n name: \"rust_driver_pci\",\n authors: [\"Danilo Krummrich\"],\n description: \"Rust PCI driver\",\n", "prefixes": [ "20/24" ] }