Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229213/?format=api
{ "id": 2229213, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229213/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260427221155.2144848-4-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-4-dakr@kernel.org>", "date": "2026-04-27T22:11:01", "name": "[03/24] rust: devres: add ForLt support to Devres", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "fec0b43e7e8ad8c74286e465f7e992345c135c77", "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-4-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/2229213/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229213/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pci+bounces-53271-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=dJLRKLjR;\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-53271-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=\"dJLRKLjR\"", "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 4g4Hsf618sz1xrS\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 08:14:14 +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 30A2030B1525\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 22:12:28 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 76E973A9625;\n\tMon, 27 Apr 2026 22:12:27 +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 521123793BB;\n\tMon, 27 Apr 2026 22:12:27 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 19B69C19425;\n\tMon, 27 Apr 2026 22:12:20 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777327947; cv=none;\n b=NqmsxIXdEaMWKEx/IR6Y4qX0tZaMbQfh12F6J5+s9wx+0n9gMM/McARG8qsYwGiVUcovK62v+exCD9Y92YnAJXYPcBfY6UjJ59TT55UD3eGk2GCnTX0kA33GP6Pz71HW5rclNwYxD4c+adFFo1GHDUY3Ask93nFL3JzHA8PeEek=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777327947; c=relaxed/simple;\n\tbh=bM12jT1hv0K0oENDCBepC4nrrQUDFCBN7Pb+KzPNmtA=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=d7Njre9t3l84FCi5jlTIN+64UsEDKaVVvdLoS1Tz/jD/N5mS8d4F6Px2RFTRTYdiSrW/q8h2h0POWBPwlCsoBIq246AV04hIbxoKWYU+it8oYPBK862Og7vO6WkoVsqnkq4cIa+Pw1p4z7+jA37LcHGODxJ35xJ6Pk5yqOjwuvA=", "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=dJLRKLjR; 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=1777327947;\n\tbh=bM12jT1hv0K0oENDCBepC4nrrQUDFCBN7Pb+KzPNmtA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=dJLRKLjRm9qlfsoANY2fNN4UtrsSDSd7D+xH5aB4COfjRw7n/QHDm96SJn7XnB4PX\n\t J9hzk1e+EKPC4SU2TmXraGD3g7QAFijLpGK7VwvpCZY4ESZ/f0uFK0aJDyqpijdU40\n\t SX7nSiNxoSYnjx5aLu0tPAJ7i2IVobXsM5ozDYjWyezcCSt8Yx+nuchuAw/SN/bOCi\n\t Y8/H55/J5Ws2Do3nbhGYPCG+GMSMnQ2UYLlpLrDyMgZj4hfcdtx6j4m41uyUnJqB27\n\t SueqprNZm0gboHo8WVABYI87am+945g0j3AP+XWmIuTrWVTVs7osXRTUz+fN57rzFs\n\t qaCQ2uP3eegzw==", "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 03/24] rust: devres: add ForLt support to Devres", "Date": "Tue, 28 Apr 2026 00:11:01 +0200", "Message-ID": "<20260427221155.2144848-4-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": "Use ForLt::cast_ref() in Devres access methods, enabling lifetime\nshortening for types that are covariant over their lifetime parameter.\n\nThis is a no-op for 'static types, but prepares Devres for use with\nlifetime-parameterized types such as pci::Bar<'_, SIZE>.\n\nAdd DevresGuard as a wrapper around RevocableGuard that applies\nForLt::cast_ref() on deref().\n\nSigned-off-by: Danilo Krummrich <dakr@kernel.org>\n---\n rust/kernel/devres.rs | 29 ++++++++++++++++++++++++-----\n 1 file changed, 24 insertions(+), 5 deletions(-)", "diff": "diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs\nindex 9e5f93aed20c..7baabcdb1ad3 100644\n--- a/rust/kernel/devres.rs\n+++ b/rust/kernel/devres.rs\n@@ -24,6 +24,7 @@\n Arc, //\n },\n types::{\n+ ForLt,\n ForeignOwnable,\n Opaque, //\n },\n@@ -324,22 +325,26 @@ pub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a T> {\n // SAFETY: `dev` being the same device as the device this `Devres` has been created for\n // proves that `self.data` hasn't been revoked and is guaranteed to not be revoked as long\n // as `dev` lives; `dev` lives at least as long as `self`.\n- Ok(unsafe { self.data().access() })\n+ Ok(<ForLt!(T)>::cast_ref(unsafe { self.data().access() }))\n }\n \n /// [`Devres`] accessor for [`Revocable::try_access`].\n- pub fn try_access(&self) -> Option<RevocableGuard<'_, T>> {\n- self.data().try_access()\n+ #[allow(clippy::type_complexity)]\n+ pub fn try_access(&self) -> Option<DevresGuard<'_, ForLt!(T)>> {\n+ self.data().try_access().map(DevresGuard)\n }\n \n /// [`Devres`] accessor for [`Revocable::try_access_with`].\n pub fn try_access_with<R, F: FnOnce(&T) -> R>(&self, f: F) -> Option<R> {\n- self.data().try_access_with(f)\n+ self.data()\n+ .try_access_with(|data| f(<ForLt!(T)>::cast_ref(data)))\n }\n \n /// [`Devres`] accessor for [`Revocable::try_access_with_guard`].\n pub fn try_access_with_guard<'a>(&'a self, guard: &'a rcu::Guard) -> Option<&'a T> {\n- self.data().try_access_with_guard(guard)\n+ self.data()\n+ .try_access_with_guard(guard)\n+ .map(<ForLt!(T)>::cast_ref)\n }\n }\n \n@@ -365,6 +370,20 @@ fn drop(&mut self) {\n }\n }\n \n+/// Guard returned by [`Devres::try_access`].\n+///\n+/// Dereferences to `F::Of<'a>`, applying [`ForLt::cast_ref`] to shorten the lifetime of the\n+/// stored data to the guard's borrow lifetime.\n+pub struct DevresGuard<'a, F: ForLt>(RevocableGuard<'a, F::Of<'static>>);\n+\n+impl<'a, F: ForLt> core::ops::Deref for DevresGuard<'a, F> {\n+ type Target = F::Of<'a>;\n+\n+ fn deref(&self) -> &Self::Target {\n+ F::cast_ref(&*self.0)\n+ }\n+}\n+\n /// Consume `data` and [`Drop::drop`] `data` once `dev` is unbound.\n fn register_foreign<P>(dev: &Device<Bound>, data: P) -> Result\n where\n", "prefixes": [ "03/24" ] }