From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAE8964; Tue, 1 Sep 2026 16:09:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788278956; cv=none; b=j2kcYCJIQ25/sAH4D8omsUHT2HlHE2o3uJ7lHavPsN+t4zQ7xWtAJwVtjVpUKGfCmNy9S/ghT+fRZ2EIzYA9fDhXBoj6qShQprlbFHtyTBHZENIxWveGhPXA2wIQAyAiWnwL8ixEyDkD/SBhp9a8E5/37amoTxlVzaHO578a6vs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788278956; c=relaxed/simple; bh=zA9tgWKf4SBtTBAhJRzDALR4sj2TbJPjvzc1j0kLi+0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dBGLTJGu4jmSqPQsEr+Ak8ClfnAFbL1SmPanY8eCpB0qGNRp46PKXZ96ELrPeF5jUziWUeAaiaU6TD901N3ErZEi7aKTUlNa1snKApUgF4SsgF8ckh90KKoXz4KGzEAKzn0TJdXKGUEkFvKKlYSNdyoew3RqMQFx1iWGdKhQBfw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cU3Cnl1/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cU3Cnl1/" Received: by smtp.kernel.org (Postfix) with ESMTPS id 72EBDC2BD04; Tue, 1 Sep 2026 16:09:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1788278956; bh=zA9tgWKf4SBtTBAhJRzDALR4sj2TbJPjvzc1j0kLi+0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=cU3Cnl1/XCHcPDdhbKsQkf8GKY7v5T2PGtfYkY15wwAgVlsUwjuwf8UHtvcLZoGrG do4N21kgV/k8mi+Wj6+GuNQC/oCEsDZjBoW12KcptuskpQ5kTzPXWwgFffzF4DQNIO thGQFCK6baOliEawFl1G8wR2yZ+SUkAW/dL1tKw0sdF5+nYuLyeKxCfRLPSwk3RoNP RMJHZtU26V2LljAZTejFiCmkQAoReIlgEmMylujcu+gxJuwScyZQbTmrsiUDjJCkw7 ZpuunTc9CAL/2h7eQyXEN+MURonSafxnbjjoAK9ToK9cnnW06rnSY2S/SkaZpKixSm 6/QXbxuc54kiA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 545D1C624D3; Tue, 1 Sep 2026 16:09:16 +0000 (UTC) From: Ke Sun via B4 Relay Date: Wed, 02 Sep 2026 00:09:02 +0800 Subject: [PATCH 3/9] rust: sync: arc: relax `ForeignOwnable` for `Arc` Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260902-tyr-ioctls-v1-3-e0fdbf8bd108@kylinos.cn> References: <20260902-tyr-ioctls-v1-0-e0fdbf8bd108@kylinos.cn> In-Reply-To: <20260902-tyr-ioctls-v1-0-e0fdbf8bd108@kylinos.cn> To: rust-for-linux@vger.kernel.org Cc: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , Lorenzo Stoakes , "Liam R. Howlett" , Lyude Paul , David Airlie , Simona Vetter , linux-kernel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org, Ke Sun , Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788278954; l=1287; i=sunke@kylinos.cn; s=20260317; h=from:subject:message-id; bh=VpFApDEE0ShMOm5bITUkvBMmnsmsJS6eNADKklXNSp4=; b=uHDTxFGNUx1spLlyFI1jfXtWSsQ4Kct+pqNbd2CyQ94I8hDhvntBrOhaGdYAsbGexhRYLJ6WZ 8/XubxirktGCH9ARwXTL8UZSFEUKMVeukuaBmnBA2/hj0TMY6/ZHIWS X-Developer-Key: i=sunke@kylinos.cn; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for sunke@kylinos.cn/20260317 with auth_id=950 X-Original-From: Ke Sun Reply-To: sunke@kylinos.cn From: Alvin Sun Drop the `'static` bound so that refcounted values borrowing from a driver registration scope can be foreign-owned by the XArray abstraction. Signed-off-by: Alvin Sun --- rust/kernel/sync/arc.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs index 5ac4961b7cd20..cd6faba84ffcb 100644 --- a/rust/kernel/sync/arc.rs +++ b/rust/kernel/sync/arc.rs @@ -363,11 +363,17 @@ pub fn into_unique_or_drop(this: Self) -> Option>> { // SAFETY: The pointer returned by `into_foreign` was originally allocated as an // `KBox>`, so that type is what determines the alignment. -unsafe impl ForeignOwnable for Arc { +unsafe impl ForeignOwnable for Arc { const FOREIGN_ALIGN: usize = > as ForeignOwnable>::FOREIGN_ALIGN; - type Borrowed<'a> = ArcBorrow<'a, T>; - type BorrowedMut<'a> = Self::Borrowed<'a>; + type Borrowed<'a> + = ArcBorrow<'a, T> + where + T: 'a; + type BorrowedMut<'a> + = Self::Borrowed<'a> + where + T: 'a; fn into_foreign(self) -> *mut c_void { ManuallyDrop::new(self).ptr.as_ptr().cast() -- 2.43.0