Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229252/?format=api
{ "id": 2229252, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229252/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260427221155.2144848-16-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-16-dakr@kernel.org>", "date": "2026-04-27T22:11:13", "name": "[15/24] samples: rust: rust_driver_auxiliary: showcase lifetime-bound registration data", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "fd2c3e20de1023317248762a06bb667a62c86a15", "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-16-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/2229252/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229252/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pci+bounces-53283-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=bQGkmtrf;\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-53283-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=\"bQGkmtrf\"", "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 4g4J2c4pYbz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 08:22:00 +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 C113830B3122\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 22:14:16 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 172193AF665;\n\tMon, 27 Apr 2026 22:13:43 +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 E58853AC0FB;\n\tMon, 27 Apr 2026 22:13:42 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id EA442C19425;\n\tMon, 27 Apr 2026 22:13:36 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777328023; cv=none;\n b=fJ8fw+/C34HBqOmBFpYleI6RD1nNzE6uElZDsKBwKgCxlJS9EM+UEUsZIiTzXmJDpX32MbRiuxpQMN+BfwQRM3zKPQCB6np5iPEIWxUdIQEE1E0AR7tYxrFrOB+UrUGTXCZRa0MxMx0ZBtaQejw4SA0vw/Ji64xA4ILNkV+VB1g=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777328023; c=relaxed/simple;\n\tbh=2wRXyoiGYh3N2MxiZpU0KF0q9rWzHw+tYKK7qMjArxI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=XUtQ/LpuHQDpAulOw0wjA6UL49pDxH8dTTEWrxc+ILv1DWyG+di8EMRy52My61fI9Ns1N8Oo4iCwNUsaBfaqYtf0aS3wTpSGpu/wQm/UOh1zdH88IUm5s7u3UeuE6+8Amh+HWpbk83rCFF+wRtXkfFuAHZa/7uhOsXJTGVO0KJo=", "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=bQGkmtrf; 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=1777328022;\n\tbh=2wRXyoiGYh3N2MxiZpU0KF0q9rWzHw+tYKK7qMjArxI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=bQGkmtrfaOtuV8b1phg4BUOsZwWTo2RGRcZLJkJvxY84H0cAgrv0s1WFxR7FvnQPj\n\t ZyV6+O/clFd90kJOW/a6ltyel9t5FglZoFE7lOoOvdCaPUhymgXpKBERhilzisUgqC\n\t q9PSC0MCU0EbI2JsqE/QK8UpsIl6OsePWv8QIPYrjpQH3CnHf/CqbVmSR62Y8L7paX\n\t ikOJQb763jtz56W4bgS+DdXbeJSEIgbEf6wkWgGB1AiVQvPgusJYtdMLrk/X6at2sT\n\t DhlAAhBweOysTvimZ87GnzvOYsJzx5XiFgU+j03r4Jcmf2ueM6wTgzwbUFClsoJp/C\n\t nz1bJk/e+RWJQ==", "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 15/24] samples: rust: rust_driver_auxiliary: showcase\n lifetime-bound registration data", "Date": "Tue, 28 Apr 2026 00:11:13 +0200", "Message-ID": "<20260427221155.2144848-16-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 the Data struct lifetime-parameterized, storing a reference to the\nparent pci::Device<Bound>. This demonstrates that registration data can\nhold device resources tied to the parent driver's lifetime.\n\nIn connect(), retrieve the parent PCI device from the registration data\nrather than casting through adev.parent().\n\nSigned-off-by: Danilo Krummrich <dakr@kernel.org>\n---\n samples/rust/rust_driver_auxiliary.rs | 27 ++++++++++++++++-----------\n 1 file changed, 16 insertions(+), 11 deletions(-)", "diff": "diff --git a/samples/rust/rust_driver_auxiliary.rs b/samples/rust/rust_driver_auxiliary.rs\nindex 4ad619c5731e..010ec2201a69 100644\n--- a/samples/rust/rust_driver_auxiliary.rs\n+++ b/samples/rust/rust_driver_auxiliary.rs\n@@ -51,14 +51,15 @@ fn probe(\n }\n }\n \n-struct Data {\n+struct Data<'a> {\n index: u32,\n+ parent: &'a pci::Device<Bound>,\n }\n \n #[allow(clippy::type_complexity)]\n struct ParentDriver {\n- _reg0: Devres<auxiliary::Registration<ForLt!(Data)>>,\n- _reg1: Devres<auxiliary::Registration<ForLt!(Data)>>,\n+ _reg0: Devres<auxiliary::Registration<ForLt!(Data<'_>)>>,\n+ _reg1: Devres<auxiliary::Registration<ForLt!(Data<'_>)>>,\n }\n \n kernel::pci_device_table!(\n@@ -83,14 +84,20 @@ fn probe(\n AUXILIARY_NAME,\n 0,\n MODULE_NAME,\n- Data { index: 0 },\n+ Data {\n+ index: 0,\n+ parent: pdev,\n+ },\n )?,\n _reg1: auxiliary::Registration::new(\n pdev.as_ref(),\n AUXILIARY_NAME,\n 1,\n MODULE_NAME,\n- Data { index: 1 },\n+ Data {\n+ index: 1,\n+ parent: pdev,\n+ },\n )?,\n })\n }\n@@ -98,13 +105,11 @@ fn probe(\n \n impl ParentDriver {\n fn connect(adev: &auxiliary::Device<Bound>) -> Result {\n- let dev = adev.parent();\n- let pdev: &pci::Device<Bound> = dev.try_into()?;\n-\n- let data = adev.registration_data::<ForLt!(Data)>()?;\n+ let data = adev.registration_data::<ForLt!(Data<'_>)>()?;\n+ let pdev = data.parent;\n \n dev_info!(\n- dev,\n+ pdev,\n \"Connect auxiliary {} with parent: VendorID={}, DeviceID={:#x}\\n\",\n adev.id(),\n pdev.vendor_id(),\n@@ -112,7 +117,7 @@ fn connect(adev: &auxiliary::Device<Bound>) -> Result {\n );\n \n dev_info!(\n- dev,\n+ pdev,\n \"Connected to auxiliary device with index {}.\\n\",\n data.index\n );\n", "prefixes": [ "15/24" ] }