From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-08.mail-europe.com (mail-08.mail-europe.com [57.129.93.249]) (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 C99EB285C84; Mon, 17 Nov 2025 10:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.129.93.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763374111; cv=none; b=kw0qGFvD/k9gNgH7fOx7NIlsvLHgiMicfPO5oF5AFCN409YU1CvqwuL2uYLjSN2YjMmc5KFSWCc92lstSSc6ErapJwFeLH7aDVgRe/PrMmtZ+/KfHO7z0gFhR8zYpORtcgJRvUkm0gHmhg0MFT0LYxhSY1j6V60aXmcHjbU2CIw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763374111; c=relaxed/simple; bh=OYsM4vO3meD+5z0XRo00Gz9vV6LiGD6zwGJ5e/wNA6k=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tKa7Zp3A3nqg3tHh3QoY1QvJwtoeKDyjQn+/91C0Vvi+tDxENfhHQRiYyjWP8ssxOUwEf46Pw45LYRBnrG7qTuU16J1nZewjcojhvE2+F5pz310AO2+CfUPtNTDLTB2I/hvPp77sBwAjq6F378heh6S1KDHGI6ZyWEUgMVsvxeo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b=qfqQACR3; arc=none smtp.client-ip=57.129.93.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="qfqQACR3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1763374098; x=1763633298; bh=pb28HdCGm3MdNVkZGIzE5Ia1bSAczOh9PTgSydObUhU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=qfqQACR3EMQ/VXj7DdMIeOQSJBOKwkz0YVM7Rh7/Aqt7XHToWwDO5+5h8e9p71Od8 fww+ZzgZ5yh+Athct4PLzqZwBrywuoLA5ytS1Bj97PrO5su4sMCq60gBj2NV3e9txR PkIdmBHcyF5l6sGl8PPxLA2X2Mdz/s26w1btXKgC2SjWy2GdCmxzQ/mwAgPfdPktJg PK8MflXGO4dO2gl2DdF0z7CFNgxrSNMIw4wcXDrk1cxZ+I28dm9SYACznAajqXCckt XZ+//7HDASX1RKh6xtp6IUA97jHNNk91dqbzJxt4iwCjYx4tD3nfpn5/Z9N5sdEdEP NF26T+J6OGmtw== Date: Mon, 17 Nov 2025 10:08:10 +0000 To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , Benno Lossin , Danilo Krummrich , Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , "Rafael J. Wysocki" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Alexander Viro , Christian Brauner , Jan Kara , Lorenzo Stoakes , "Liam R. Howlett" , Viresh Kumar , Nishanth Menon , Stephen Boyd , Bjorn Helgaas , =?utf-8?Q?Krzysztof_Wilczy=C5=84ski?= , Paul Moore , Serge Hallyn , Asahi Lina From: Oliver Mangold Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org, linux-pci@vger.kernel.org, linux-security-module@vger.kernel.org, Oliver Mangold Subject: [PATCH v13 3/4] rust: Add missing SAFETY documentation for `ARef` example Message-ID: <20251117-unique-ref-v13-3-b5b243df1250@pm.me> In-Reply-To: <20251117-unique-ref-v13-0-b5b243df1250@pm.me> References: <20251117-unique-ref-v13-0-b5b243df1250@pm.me> Feedback-ID: 31808448:user:proton X-Pm-Message-ID: ae16d73f393bc00b39a87ca6f2993d137d719ee7 Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable SAFETY comment in rustdoc example was just 'TODO'. Fixed. Signed-off-by: Oliver Mangold Co-developed-by: Andreas Hindborg Signed-off-by: Andreas Hindborg --- rust/kernel/sync/aref.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rust/kernel/sync/aref.rs b/rust/kernel/sync/aref.rs index 4226119d5ac9..937dcf6ed5de 100644 --- a/rust/kernel/sync/aref.rs +++ b/rust/kernel/sync/aref.rs @@ -129,12 +129,14 @@ pub unsafe fn from_raw(ptr: NonNull) -> Self { /// # Examples /// /// ``` - /// use core::ptr::NonNull; - /// use kernel::sync::aref::{ARef, RefCounted}; + /// # use core::ptr::NonNull; + /// # use kernel::sync::aref::{ARef, RefCounted}; /// /// struct Empty {} /// - /// # // SAFETY: TODO. + /// // SAFETY: The `RefCounted` implementation for `Empty` does not co= unt references and + /// // never frees the underlying object. Thus we can act as having a = refcount on the object + /// // that we pass to the newly created `ARef`. /// unsafe impl RefCounted for Empty { /// fn inc_ref(&self) {} /// unsafe fn dec_ref(_obj: NonNull) {} @@ -142,7 +144,7 @@ pub unsafe fn from_raw(ptr: NonNull) -> Self { /// /// let mut data =3D Empty {}; /// let ptr =3D NonNull::::new(&mut data).unwrap(); - /// # // SAFETY: TODO. + /// // SAFETY: We keep `data` around longer than the `ARef`. /// let data_ref: ARef =3D unsafe { ARef::from_raw(ptr) }; /// let raw_ptr: NonNull =3D ARef::into_raw(data_ref); /// --=20 2.51.2