From patchwork Tue Jan 16 16:01:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp353932dye; Tue, 16 Jan 2024 08:03:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFaBqzPRVhJ4BveHLWSJ0J5HzkOVjay8vaHP6ppdEaO3fCdRAGemw0f6nQIuc3/akadRqDf X-Received: by 2002:a05:620a:4606:b0:783:6c6c:a13d with SMTP id br6-20020a05620a460600b007836c6ca13dmr972425qkb.92.1705421023834; Tue, 16 Jan 2024 08:03:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705421023; cv=none; d=google.com; s=arc-20160816; b=r/gScT0/YIJdv7LxPtfKr20pACMNFmdtXW/khIUKNBRhtV98uPYp3lEyDqC5WZQGcn WEAtikYPwTf4lk/tBiPh1NY88TZpY/J316W45yR6uGaLf69VfmevpuvWi6+YWoHeIQZp S3BvYI4Ca+Ifp50a4AqMw42s4+JtQpOgeeD40xhdsp1TitE93LImXmMjSFEe5yosyNfq 0zHn9jDl+EnPpeIdKIz3GJdz75m5BLLA2z6i6X8o6EGLzEMfKgcSFOTYoJE06NnaCOyl EikFMIAbRA0v3mSiURS5XPeR9WIXFyIsGuVX3yAtjcXeW5aYEjqgVEzB0S6vUQUTfGSY q2aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=HiQ6PcRLXcYLtSyfVVELDJuQnMgxicU/SxRlX4CZr4Y=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=DCEzSmWT1czP0aGHl9DPx+LGfJZnNMEqgkajFNxWWNcexzS54RVGPjrdCtb9HKttTy 532JvQFRgeOk9COF91hDAIu5rMVDvoQIBZU+irxNraesp3fMgzgpNzAhexfS+WU58FQ5 o1a0ExxtmUgxsR3gokzaIZR42PrccCKwp67oQsDq+ip3daUaXq3qpVwKoHzClPeCJBfE nBfDPZEzsCTnYwo8Gl5MPAeVBATcJleMD1LO9k9K1h/EJu1w1K2CJUIpcwWP4Wokt6o6 de0OXVtnZ5ox1OZnwBf58u+HFb9cl26SziTRaGQFl0YDHtKEWBS4shT7LaCnfLFFaT8G n04g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27555-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27555-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pc4-20020a05620a840400b0078326fbd8dbsi9879209qkn.382.2024.01.16.08.03.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 08:03:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27555-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27555-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27555-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8F98F1C23701 for ; Tue, 16 Jan 2024 16:03:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C98F41CAB9; Tue, 16 Jan 2024 16:02:57 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) (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 4C5A31C68C; Tue, 16 Jan 2024 16:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mow4E-1qmZCE25Ne-00qV0H; Tue, 16 Jan 2024 17:02:36 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 01/13] rust: kernel: fix multiple typos in documentation Date: Tue, 16 Jan 2024 17:01:26 +0100 Message-ID: <20240116160141.165951-2-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:5a5kO99YMVZNCl/XnVf1l8Q43RLe84qbmVpAjJJUvblmFHUDQnc d2yrMIVdBjyqZ/ZdLoK+i7NLcTeVnZ+EsNQf5uB3TeVBpr/Tv0zVRId31su0SmtfRxYc3RP qlG1AV32/tSs0SuUPZIHW5hkr+Vyb+j6JS/orrQbASsWPShNVeMZ7IJ0I3BrcTQ/1CleH4G Li+OFgSa4baAGQIwcdt9g== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:U5M+o6PWla4=;xCZsCsV91GvI0tFrcS7Xo1Uz4my ebA6L5c6sqI5O/vBEzw3fxL6z80pNP6X7dKqHFMLI1H2o5x30RAJ4Sw5p/ar1bON01TyBIDCz O8CimUDHvWb7ngLVjZQznQLM/5zGwCe82qZFTNrFZD5pyX8WicIrWccd8iTR8GmCfnFzodEEh iDoCHerH7D7zhK7VWpgMUChY/cCprLf6q/ZU1eeEO/oXev0SVtWX971R1xiDElpD5CWQUPC29 xzAdm+Z3TxcQlQsc6AoYA5AoQSyEaidkn5LDpK8D0oI3MF9rkK7gWZFDeSviJUh/r4w0ATibE Rxi9Tct0hb+FvO7edkatUfVp+7FDB6VW0eY8CxWN/PRO66bAOJ7F0AVg+zgOBGs+CWHdAv0p4 myjbUM/PtRT8Bm2yPHl3cO70LIbSrFbkuxiwiAbgiD3YvgxSXJd26qQp+jEx3Ta7jocwC6Wpv bLxD7gPZOQQJGazRGjdXUDPs8HSjA21pe9lJuCRm3s4T8vyRBExbsrKQPn+HGBKEexLvNq0cn 7WBk1c8+bz855Zr3Op6NEF4/kdzyJ6an5iXbBPY7/xgxhxrreuUhEsrle9XX1ckdDRqaufjMI OdhlZqM/qqbEHBbkwArssfwVUVxN+7jBDYaoenidQBFWQW1R1Rx5c/Y/cO2kG++xczbhN4waK C5IPentpGMurez4JSMGH6N7+XOrXtw4YxaDoB38TO82fxyv+6ybxBEd7P9B775nov1cxSz5nz eRv6qge/dPkEsvHsx1IXx3FbZt03b+2BOYjtAq0TwMuc4y/FEL7sFQZ7pTD3oaKLGGd8qt+Pn qBK8tqrk1cL9heSNGfI68AYS/pybLYx/j0L3NHoU+brs+SFmfikCpxRv8aLxVTV8Il58UpYaI Wk2lE5mpT+7nwDA== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788263555682824384 X-GMAIL-MSGID: 1788263555682824384 Fixes multiple trivial typos in documentation and comments of the kernel crate. allocator: - Fix a trivial list item alignment issue in the last SAFETY comment of `krealloc_aligned`. init: - Replace 'type' with 'trait' in the doc comments of the `PinInit` and `Init` traits. - Add colons before starting lists. - Add spaces between the type and equal sign to respect the code formatting rules in example code. - End a sentence with a full stop instead of a colon. ioctl: - Replace 'an' with 'a' where appropriate. str: - Replace 'Return' with 'Returns' in the doc comment of `bytes_written` as the text describes what the function does. sync/lock/spinlock: - The code in this module operates on spinlocks, not mutexes. Thus, replace 'mutex' with 'spinlock' in the SAFETY comment of `unlock`. workqueue: - Replace "wont" with "won't" in the doc comment of `__enqueue`. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/allocator.rs | 2 +- rust/kernel/init.rs | 16 ++++++++-------- rust/kernel/ioctl.rs | 4 ++-- rust/kernel/str.rs | 2 +- rust/kernel/sync/lock/spinlock.rs | 2 +- rust/kernel/workqueue.rs | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/rust/kernel/allocator.rs b/rust/kernel/allocator.rs index 4b057e837358..01ad139e19bc 100644 --- a/rust/kernel/allocator.rs +++ b/rust/kernel/allocator.rs @@ -35,7 +35,7 @@ unsafe fn krealloc_aligned(ptr: *mut u8, new_layout: Layout, flags: bindings::gf // - `ptr` is either null or a pointer returned from a previous `k{re}alloc()` by the // function safety requirement. // - `size` is greater than 0 since it's either a `layout.size()` (which cannot be zero - // according to the function safety requirement) or a result from `next_power_of_two()`. + // according to the function safety requirement) or a result from `next_power_of_two()`. unsafe { bindings::krealloc(ptr as *const core::ffi::c_void, size, flags) as *mut u8 } } diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs index 65be9ae57b80..16a99984622c 100644 --- a/rust/kernel/init.rs +++ b/rust/kernel/init.rs @@ -751,10 +751,10 @@ macro_rules! try_init { /// /// # Safety /// -/// When implementing this type you will need to take great care. Also there are probably very few +/// When implementing this trait you will need to take great care. Also there are probably very few /// cases where a manual implementation is necessary. Use [`pin_init_from_closure`] where possible. /// -/// The [`PinInit::__pinned_init`] function +/// The [`PinInit::__pinned_init`] function: /// - returns `Ok(())` if it initialized every field of `slot`, /// - returns `Err(err)` if it encountered an error and then cleaned `slot`, this means: /// - `slot` can be deallocated without UB occurring, @@ -861,10 +861,10 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> { /// /// # Safety /// -/// When implementing this type you will need to take great care. Also there are probably very few +/// When implementing this trait you will need to take great care. Also there are probably very few /// cases where a manual implementation is necessary. Use [`init_from_closure`] where possible. /// -/// The [`Init::__init`] function +/// The [`Init::__init`] function: /// - returns `Ok(())` if it initialized every field of `slot`, /// - returns `Err(err)` if it encountered an error and then cleaned `slot`, this means: /// - `slot` can be deallocated without UB occurring, @@ -1013,7 +1013,7 @@ pub fn uninit() -> impl Init, E> { /// /// ```rust /// use kernel::{error::Error, init::init_array_from_fn}; -/// let array: Box<[usize; 1_000]>= Box::init::(init_array_from_fn(|i| i)).unwrap(); +/// let array: Box<[usize; 1_000]> = Box::init::(init_array_from_fn(|i| i)).unwrap(); /// assert_eq!(array.len(), 1_000); /// ``` pub fn init_array_from_fn( @@ -1027,7 +1027,7 @@ pub fn init_array_from_fn( // Counts the number of initialized elements and when dropped drops that many elements from // `slot`. let mut init_count = ScopeGuard::new_with_data(0, |i| { - // We now free every element that has been initialized before: + // We now free every element that has been initialized before. // SAFETY: The loop initialized exactly the values from 0..i and since we // return `Err` below, the caller will consider the memory at `slot` as // uninitialized. @@ -1056,7 +1056,7 @@ pub fn init_array_from_fn( /// /// ```rust /// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mutex}; -/// let array: Arc<[Mutex; 1_000]>= +/// let array: Arc<[Mutex; 1_000]> = /// Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i))).unwrap(); /// assert_eq!(array.len(), 1_000); /// ``` @@ -1071,7 +1071,7 @@ pub fn pin_init_array_from_fn( // Counts the number of initialized elements and when dropped drops that many elements from // `slot`. let mut init_count = ScopeGuard::new_with_data(0, |i| { - // We now free every element that has been initialized before: + // We now free every element that has been initialized before. // SAFETY: The loop initialized exactly the values from 0..i and since we // return `Err` below, the caller will consider the memory at `slot` as // uninitialized. diff --git a/rust/kernel/ioctl.rs b/rust/kernel/ioctl.rs index f1d42ab69972..59050e5f5a5a 100644 --- a/rust/kernel/ioctl.rs +++ b/rust/kernel/ioctl.rs @@ -28,13 +28,13 @@ pub const fn _IO(ty: u32, nr: u32) -> u32 { _IOC(uapi::_IOC_NONE, ty, nr, 0) } -/// Build an ioctl number for an read-only ioctl. +/// Build an ioctl number for a read-only ioctl. #[inline(always)] pub const fn _IOR(ty: u32, nr: u32) -> u32 { _IOC(uapi::_IOC_READ, ty, nr, core::mem::size_of::()) } -/// Build an ioctl number for an write-only ioctl. +/// Build an ioctl number for a write-only ioctl. #[inline(always)] pub const fn _IOW(ty: u32, nr: u32) -> u32 { _IOC(uapi::_IOC_WRITE, ty, nr, core::mem::size_of::()) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 7d848b83add4..0a8569594fc3 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -449,7 +449,7 @@ pub(crate) fn pos(&self) -> *mut u8 { self.pos as _ } - /// Return the number of bytes written to the formatter. + /// Returns the number of bytes written to the formatter. pub(crate) fn bytes_written(&self) -> usize { self.pos - self.beg } diff --git a/rust/kernel/sync/lock/spinlock.rs b/rust/kernel/sync/lock/spinlock.rs index 068535ce1b29..e5e0bf621988 100644 --- a/rust/kernel/sync/lock/spinlock.rs +++ b/rust/kernel/sync/lock/spinlock.rs @@ -112,7 +112,7 @@ unsafe fn lock(ptr: *mut Self::State) -> Self::GuardState { unsafe fn unlock(ptr: *mut Self::State, _guard_state: &Self::GuardState) { // SAFETY: The safety requirements of this function ensure that `ptr` is valid and that the - // caller is the owner of the mutex. + // caller is the owner of the spinlock. unsafe { bindings::spin_unlock(ptr) } } } diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index 498397877376..8775c34d12a5 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -253,7 +253,7 @@ fn run(mut this: Pin>) { /// actual value of the id is not important as long as you use different ids for different fields /// of the same struct. (Fields of different structs need not use different ids.) /// -/// Note that the id is used only to select the right method to call during compilation. It wont be +/// Note that the id is used only to select the right method to call during compilation. It won't be /// part of the final executable. /// /// # Safety From patchwork Tue Jan 16 16:01:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp353766dye; Tue, 16 Jan 2024 08:03:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IE75U3AOjld51vh2DM2fUgzkbIvT0+FiN+auLl3Gj4aoGupnwnClg8SDhB9NZv/4qmPp0zH X-Received: by 2002:a05:6871:d30c:b0:204:c0:5db3 with SMTP id pn12-20020a056871d30c00b0020400c05db3mr9786172oac.13.1705421012885; Tue, 16 Jan 2024 08:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705421012; cv=none; d=google.com; s=arc-20160816; b=GW0niaF3UXD0LUQ1wOObcJFr6+6eg6wJ/72f7jPxeeDB5RdltEtBYhvl/+MYfxfokc MWqXsTnuoV93fwuOIuv2ehSUbtxLYTBGFpkBQR7xOiQseXA+LbCZsZ3F/rHKbm7xuTyo AfLfgKwcwto6/+TqOwVZ423Q4f8fE1qMbYPqCdvdkV5En5/rCUiqkTZlowtbQ/HXk9x5 g5q4haF8NVfwhMlgknNO6ZUFGhszq9CxYf3CUJB3cC17PRs5DQbQQJGNFV1+cVgbXkPH +QrTLvOFWbs5ARIb46o6etx2wxMvIjxSKJdHlDn4n+LI7/IL0sWXDoc4K/qH/OYwZJ21 m+mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=Bb349fvwXSjnN4V0GLzjJRdZzoRZLmEwtKL7jY3CLSU=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=nbi02NyCZ3hOTjnVXFEep9RdpphxrkhLfVyltfdMkRolmf2pxuca6pU9QxTUwYjjzQ dmCvM0fQ6OGZQCTXNixgsuTWOlAJY988hLkiLDtqhwWVRhMfoKvY/iUu52c6y3ysIMT6 /fYCEKtSw7gU6gkRzeFjt17G4IFCbpycQjkdkYGm/dzuZhBh6dVBqXMMgTTFYJISAkCF xwys80cCnDEmvo9rXceCgoutiDmEqILucJ7HzqjF4GmeVKsircDIUJRGT9K40m/H8ZDt pzu1IdWRBHQOt28th/mK/xbThoUt2obE+69NkF5GpuighVs6Y58XKIFFfmWT1H4Fv0fs E/iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27554-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27554-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id js12-20020a056870bacc00b001fb4c57432csi3993365oab.185.2024.01.16.08.03.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 08:03:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27554-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27554-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27554-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9EA432836D1 for ; Tue, 16 Jan 2024 16:03:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 631F61CAA5; Tue, 16 Jan 2024 16:02:56 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (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 F025C1C686; Tue, 16 Jan 2024 16:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MeToK-1qpL9E40VY-00aWQh; Tue, 16 Jan 2024 17:02:37 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 02/13] rust: error: move unsafe block into function call Date: Tue, 16 Jan 2024 17:01:27 +0100 Message-ID: <20240116160141.165951-3-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:8YpdJM1GEeWDxH67CiH/gY2p2t5FekIWFaebx3JG/FApIvD6c+1 KA1ivQpbnXVGPZeHY18lF7JbGHwSuJRGTYFEfs4t8pO1LTRhw2gArE1+9Nghc4PRRgOns+U IQ+7ns++opvOiuh7FmD9yXxaLBMiDMRoWbO0ri95uXOGonyDeAeDsqBN8Oayq0vJd+rqdf9 Ni4CnrD/TGCtSaogYzKFQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:vfE4pxrJzRA=;T6tpxL0/72IvcsGh63L8yn0ff9A en6NnaOJkZzpWwHGTP1pOi+MM9TVMmCJpOz/NvS6h9DdGFy03ClTT+MorjaXDpdw6NIx4JVlP TOT+8ZY8pu/9PPwvsKOtMvzv72GjDAio2dYXQ4el/F+l1RVOnNbGbpWc5tAD8NpMrdW4+IjIw 98lJzIPkODHjOZ2GC1MflMf+YpcNBQsFQ1ruzzRIAHAC/rLjzXqSXMVCYXtnPeJKaVqIMX6K4 8xB5zdZHCBLm0cwUFufFVtQU1vWxpGUp1xr8a2CUsdVe6D+QqQVZDHupPYPXL/w9DrnKAHk2g eqyque/ZqUQBQ0Q4V26zxjcOW0Ct1nHDrY06SZJ7JhYEKaf7aCE/p9zdxNcywEzXq2p36UKVo ItqQa+MwHZbrG6AZreYne3g4JTtkAaC9M4sWMyiFWpKvXe9y54Ituvw3x29n5QZMtNll3Ezge aJmBY4XulN5wa+76YGhaXeLmsuU6plPyYWycoBgG8u2NuHmjoGBEVQLEzeZllweWrRSA7/BOq WbORVUU/pL461S8YUOrSbwTYqaMEdjPLDLvRQju7qDGf478O8XMC9LW5MPW6/yEJs+I5CuQp1 HJeax00F/Me8wooTp9AG24DEMVjBINVSxZy/Aco90gowOcNwjG/SAh4siOstSjALc98kIbG2h r419+NVaYPMCGcM6nSHcf/5OW59og0kk7HyruPO96KcCyDGy8PKbQIyg0SlDE8K8Fu1ACM5Rp vTTfk9dq2KJYjG/PeBxM3CAKHgOwJC9VWvsvujFS6bcPBZ2e19K3AfwqJBDd14XptY7Oiqinl OcOZS0NE1nLQe3YtVIbn/KkuaGkc7EqApKXYGscg9nzHTFd/FYGLNCo05DCBs5kw64+BGScW3 h6skzvWUQCoZaRPif6kgfLjDRyCZuQU5Jgd0= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788263543792379931 X-GMAIL-MSGID: 1788263543792379931 The `from_err_ptr` function is safe. There is no need for the call to it to be inside the unsafe block. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/error.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 4f0c1edd63b7..6f6676bc0eb9 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel/error.rs @@ -265,12 +265,7 @@ pub fn to_result(err: core::ffi::c_int) -> Result { /// index: u32, /// ) -> Result<*mut core::ffi::c_void> { /// // SAFETY: FFI call. -/// unsafe { -/// from_err_ptr(bindings::devm_platform_ioremap_resource( -/// pdev.to_ptr(), -/// index, -/// )) -/// } +/// from_err_ptr(unsafe { bindings::devm_platform_ioremap_resource(pdev.to_ptr(), index) }) /// } /// ``` // TODO: Remove `dead_code` marker once an in-kernel client is available. From patchwork Tue Jan 16 16:01:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188553 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp353519dye; Tue, 16 Jan 2024 08:03:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsmkR+3mEY7o9IvwdHK4QBP7ROfsVGENnM2/aGJBBdtE7fVdq5iCTgjFzn2jh5icoPnQ6c X-Received: by 2002:aa7:d0c2:0:b0:559:beb0:36e9 with SMTP id u2-20020aa7d0c2000000b00559beb036e9mr351184edo.10.1705420995382; Tue, 16 Jan 2024 08:03:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705420995; cv=none; d=google.com; s=arc-20160816; b=io+ZMzof0EZ09kgJFuQ7HLOq4fpMI8I5WaEc6X461p+dcMRlawURPRRThboI+kUHCP mqeVcbr25tK6MhASCzbMyjvL+Gxsq1bK3RMe0aNimuaixsyVRR7UNDQON6+CuDPiWILN /sob8xEj6vlT5aICj3J28HNfZlCywDl/ssU3/UN6th/iRWJs0YrEyv0eQXUEwT7te7m6 3hGR5CkchbszXi/73Rp6xfYwlZB7B1sDOdZ0kNMQZFINrH1VhNtQDof4BpxQNbm6S4Je 7Y6wcm4ZYO7utCfTryigIHDUvH5ywg1+B5kxNgNlPy7u9hccg6j1jQI8LZzE1wBIvIuT DBpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=kXz7FcZz9eznbjHJoubOEQdwcF4iVQr6ipdmeyxmw7A=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=TyOHDL12yamJI5mHpq1R0RhvJWeslGr+IxfnmHhyfxtDTd28WHpTcOcBzhD8IabFVc U4M5gi5ArZ32+9T2rotLi2dtoldSUH7rgJinUo2cSGNw3EC7uxXY3/sGNInYY40AJJZ+ LD91PyuX0xqwqWAbN9lZLjIUdkb06yWxiSV9VLzRfIrQfQeouBTccNKjUao4+qIQ5dhY +VQAGK5JHE/AFnymsXS5u2omieCjvRm3RQpKBFmhZJLdJ/u0VCdYmS20CM0RIQFcPx1c xqEI9ED8D4pSoVGuA1BCL33QnH4wHs7zW2L3hDNhC5958yg38QRb5v7IX4SVc3C/7TQW pBpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27553-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27553-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k18-20020aa7c392000000b00559ba177b2bsi389885edq.61.2024.01.16.08.03.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 08:03:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27553-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27553-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27553-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 037CD1F2224B for ; Tue, 16 Jan 2024 16:03:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 318C21C6BC; Tue, 16 Jan 2024 16:02:55 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (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 DD7EC1C2AF; Tue, 16 Jan 2024 16:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MCbVD-1rGfMM1ilP-009kbA; Tue, 16 Jan 2024 17:02:37 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 03/13] rust: ioctl: end top level module docs with full stop Date: Tue, 16 Jan 2024 17:01:28 +0100 Message-ID: <20240116160141.165951-4-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:Vl604ifirTqxSRb0VeZq6n9STXQC2equyytItghMfY5eTvyOnz2 uM88EOQgOFfBZV2pVFZWqVdFt2heBqC3+1onll4HVVvSWl0hq/Sgvj1co03zc4404udJ0XO V0lzfaOqs4OQtaSkc+RqPiTOq/er+938r++R2R/p3ctFexrPFTJyqXphq6FQdvSgGKW5J85 nUvnBocn8ivhaATyEjn9w== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:M8ewJpf3SNc=;6DkxcoBATZk9fCkhsgRqI9hD4de 97eMdKprz8PDEy7+1kgGahldajB3zz0kBfU477TFKBiWASXN3YHIczg4ufCS90nUVkTjLDFKD oBaqBowC8P8vESRyK6+q3XF3xdhiqO7eb3X+tBFPsusH/cUzZbAdFYgeu5zUCpcK+bWcduSCQ Gq7FCJ5oLOa6/YNeXKLqKi9n+X49JDuQ2v00ISAqr76zEhJuhNmFqwGbiRI9eYYe0upLuUq4g 1PnlbtQFDQgj98grVp4pGExl+txnDyXCOtayxSmJqUQQas9HyASK0udF0rhKb7DYyEfG+u68j HZCkRXZMZBEL/610uLcZNDzqzRngKWRs1zRakzCaMEWGr9d73UKrWyW4x3qQk8/roAdyUDe6v 1eAv1y5ifzpxO6DjIDjbMWjzSMxT3FeNagV/rIlq7U+xTkEgerrDscSuGkYnnXILzv/8le9Rs tHoee+FN5oCr52YX726iYwTDtb/FUe6Lvarfbv+c+g62CozwGlQbsXWD3vnHjGNqgnJr7Vsvr TTBYhZJwOrex3TyrKrImIAgw8PJS/GTtEUgftDiYXV+/V8ejUj7/bEU4OppS0NKTGpjmrz1ow asiEX25v56sRgxvhcHxiydFfIZDtL3fRo5MQCkOw0I3K/FisbQoTb9GfNvLiEUhApz4viL0V/ xiQuqITQXfFExAhimf53hjod/OAqqk/uS0q/8yyPd6I6n/hXGczCxhk7tDd21faL9OfCHXys5 UneRJXfZs9Qam1u4exGbAWNutykFCEU75MOJviyc85JazhAG9s3hkX6BP9qhBhjzHY8+VSl3b QrgU5B4XQ4cicDDTyF09avY9zhTS9bxMei0LUKY4P/+o5zYQF90tZGVeqNZOb4tvR7IS0AcPo OelptaDa0dTRYsQ== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788263525521188466 X-GMAIL-MSGID: 1788263525521188466 Every other module ends its first line of documentation with a full stop. Adapt the only outlier. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/ioctl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/ioctl.rs b/rust/kernel/ioctl.rs index 59050e5f5a5a..5987ad6d38a7 100644 --- a/rust/kernel/ioctl.rs +++ b/rust/kernel/ioctl.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 -//! ioctl() number definitions +//! ioctl() number definitions. //! //! C header: [`include/asm-generic/ioctl.h`](srctree/include/asm-generic/ioctl.h) From patchwork Tue Jan 16 22:04:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp563934dye; Tue, 16 Jan 2024 14:41:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHizCzSo40skMUBPfX7sn2o1+8BVmDU+mH3eLbnFTVpIVrLjvxj1HfscezTgHuKLBukzphQ X-Received: by 2002:a05:600c:4ed0:b0:40c:3664:aeaa with SMTP id g16-20020a05600c4ed000b0040c3664aeaamr2808805wmq.148.1705444887104; Tue, 16 Jan 2024 14:41:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705444887; cv=pass; d=google.com; s=arc-20160816; b=IlIvekHJV8SdezJxMTwXvk1APHEbwW2rSlOryvLDuDUfx1xuhmkaxlP8BMV3X36p6l QLc3Zvyf89bpdzMW3U/iSfTwicYnw2ARPFzbvJL8xP4WXqD1gHQ2RUnpbpQMgHZKIkFl TxVHBm8xq8sRFaokHPN/WeKNyNNqoeNiA8O1NE/+BpI5nt7GZEZTTwxsf61OjFOFSNf7 XSTCitlrhtniJJ5zG6MRhPSjQdx38ZCXsf8j3GMdBH5Rde8lt7jhLZ+tjHtdDLYDTK2n jtog9O/0ofwHZ6OPlHEw7LrsyalGizNSkDcFsBMxzCOPunHgMjRh7SfHDeCzg7WCVsPb s8Qw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=Tag1d2mssc0MHnZuaZ9wbBj71h2REcogo7VgQRwU7Z4=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=PQN+fuMoUhqAj4g2OIixi/qYEOYNCAkzrzEoR8h3uqAYIncNPMRrdhWwmwWS9cyxDu TLlYAiUyop+wcGrKY6Lp+aZmxjslCehPCJ5mBWSxr04o+jp2vtuJQ+1WaIQs8ztqiwIC yxLRkjaElHvmpAjFNwiZavfFJZ+Xl+E1evHtL8ceFP82gyg+XQkLxP3balVcYKIqyWZ4 OTOF2u4EFoLL1jxorU3oaMQ/5oxsVIMCSAn0t96TZ+XAnNR6c/ngHYMfxp571ow+VGGU HENS96IkULnXdqrVFF8AJ4tjSxG1JWUc+3OU0lo6OJCvKMGE9w+5ktGOoZxOoLBZ9TL7 NL7g== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28329-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28329-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id er26-20020a056402449a00b00559951ab95esi1017252edb.475.2024.01.16.14.41.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 14:41:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28329-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28329-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28329-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7B9EA1F2A7A7 for ; Tue, 16 Jan 2024 22:36:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D074F47A4C; Tue, 16 Jan 2024 22:05:36 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) (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 5AE7120B02; Tue, 16 Jan 2024 22:05:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.72.192.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442735; cv=none; b=uEttqz2Mv17plhfb5+D+6IkuMQAg4U09vCyfRRxRMApR+rwfv9ZRUd6eTBJX3C8O6jGMLSbfuOJNMKsMvjfC7WdeLzZfH6ABihelpvqDOB61PQZqjAx5MFjNBd9rTD4E4ScTtGMR/+a3ItP9y590NaXxHiFVThksJyoIQoJHrBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442735; c=relaxed/simple; bh=v3W324I3SJN5eST/f93Ey55QMVR0yTzOUMu2onl9OUo=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=QYmLgj2niyxc646i/ZbLp4CdddHgj/Ait9nsV2p7dK75xXvbrmjMNGzvhVAXLiMpmhJ6wn8KD941lDMnJ7dWrBXd6m6mIp6mdbWTDPpimG/4VyPV2JK95OSKjCJLFCkNhS+EbY9v4ivjSDEQ2hJPPcrvcntDyeo4+5A2hpBiROM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=217.72.192.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MTREY-1rZe9L2Zf2-00TjKy; Tue, 16 Jan 2024 23:05:11 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 04/13] rust: kernel: add srctree-relative doclinks Date: Tue, 16 Jan 2024 23:04:10 +0100 Message-ID: <20240116220411.168016-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:0M/3h7s7GfvVM/sxSkwa13j4UXMw4UFVXCpvMlk36g4VyCdY5Av OpuLrkYGR2CTa0uchs9tvp44C5cLONl9yZzzNKwRHjmSOVtWZWANmcrllTypzFRDeC9bYy5 njtvU/C/HW3BH0Qv97g5SubpLt62cTWKHLvOYrsj5G+USM8b5tZ0yZsfH0BPBMmGdTSLApM uc2SC1Dq7y+yHtEsN4IGw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:karToRGKwJs=;uQ8K1v7C/+Wu1/QtFmFaiddcSo0 7aM4nFV9VR1/HqQilEl5s21ew29uEuaIZfn72dP0+1Ql5lZ4O3pzFDwx55RG4hdMMqAMeNJlC pHuad1+d5GhhOdD6OCNEELTmfJ2e8BFceTWDV9IIc0K4ZZ0nV8MpUD4FV9lPVEH1XQBDvJWEt DE/UM2Gva7O2WiTuUkRE9BqHbC1K2PPgA63kCzOA0HX2JYLZglrGZTrF85lBBgKrKxqgHWpXE H7DQymgZoVRNeHTT4L4b5Uu46fFnGF3qRuDLCmCc/sel3RvWXltCilfu/3KziGC+X1mhBS4xZ 4SAMUd47/IWQRD/dJrMX5VvHUDMi6e0mubSrpLiBvvhZlyUmHVYZdqQfEsnxsvx76ydQgF+jc lZ1Khpr7rkdxyJcX5Ovf4j+52OBmADhGHtBgTcBoofLU9R6YzGnkhxAyXZ87EaSB02bgEPMcw /q/eTZv+FFGRqdh6zo517pW5ELsKzsVyLqmO7JqKD9FtpU/4sxDkd/r0hSV25iZYaptT5h/x+ SgBydIBhJ8fWxELgbDU94LtayPlJL3SkRkiiJ3mO4eZrK6CVCP69lXSZlojirpvrko2BrydUV iEMxOLo5kULu3dG5l2umGK0LJQY5bCk0Na+nF/4bYSP4XMTQGotvC1fQEMKNACRH4jLpKCkNw +jLPiuzsXC9Huq+bocJTiKQAFwpn9LMd3txpda2EgO1i/N20SbicY19TLE5M+FWHKnKxmTr3v PKUephOrwVcWwW8v6gaO+N+oUZy1FoAE1OIDwNWTkAGlOIjV65mb8eC6CF3Cr1CfytNEyL0/P Us/BhLxoyldPeH3Uto60ujLd7TBh45sfxLIGiwePrK2a0zkH8Y9QErSBahAEFDM7ZB+5CwKq+ NAewvcPu8JiJXiQ== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788288577960161705 X-GMAIL-MSGID: 1788288577960161705 Convert existing references to C header files to make use of Commit bc2e7d5c298a ("rust: support `srctree`-relative links"). Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/lib.rs | 2 +- rust/kernel/sync/condvar.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index e6aff80b521f..0d365c71cae2 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -75,7 +75,7 @@ pub trait Module: Sized + Sync { /// Equivalent to `THIS_MODULE` in the C API. /// -/// C header: `include/linux/export.h` +/// C header: [`include/linux/export.h`](srctree/include/linux/export.h) pub struct ThisModule(*mut bindings::module); // SAFETY: `THIS_MODULE` may be used from all threads within a module. diff --git a/rust/kernel/sync/condvar.rs b/rust/kernel/sync/condvar.rs index f65e19d5a37c..0bb76400efd9 100644 --- a/rust/kernel/sync/condvar.rs +++ b/rust/kernel/sync/condvar.rs @@ -77,6 +77,8 @@ pub struct CondVar { /// A condvar needs to be pinned because it contains a [`struct list_head`] that is /// self-referential, so it cannot be safely moved once it is initialised. + /// + /// [`struct list_head`]: srctree/include/linux/types.h #[pin] _pin: PhantomPinned, } From patchwork Tue Jan 16 22:05:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp567150dye; Tue, 16 Jan 2024 14:50:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IH57FQueycJG7FxV3g3JusK8ljynv/Z2m18oP6BpqCPL/7sgNuUMw4K5X9cSIsEbgjowveQ X-Received: by 2002:a05:6402:3124:b0:559:c35b:b489 with SMTP id dd4-20020a056402312400b00559c35bb489mr421188edb.31.1705445423038; Tue, 16 Jan 2024 14:50:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705445423; cv=pass; d=google.com; s=arc-20160816; b=U8GeUpig7CCCzV6roSSPYFX7mGj6qAtLIxx3310wZZQ9isU7pH9bhoEpk1du+ZPZ7v iu48kkjdBB9KQqRevY+hLslHNz9QcnD7HfB7rVDVH/4jWe9spWxyDiTeZc8RKNTWuH+n rixlbCJskdgHmDxOJ9yLekURrK1KZjqplp7UvEG3FA0zSfaEqbN8sMsq4K3Go+6Jlr/I GD2qAU6FpgQSFP483vV83N6D/h7Jl3PHlsEYnp36gfOJathTBLovToYBNHZxQuZb+edU tQdXKME5MbelREtKPUNUbCxwezhjcvw/NfXGKJ2Tz3xTX0HNKH2zOQEMIetv2Jhhy6ob fFJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=FZ2k6GkRrEG1XmdAxzwQEN8QJfzFgDivpujKraTWFuc=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=pJc9qv/3rf5MQgFL6PpYr8XOKQ3t6PHSH8PrE8TbQEB4Gs6wZyautJGk3FTIVJ6AzK p4Ixpy8gQuthvOP2zSTXk1NHJ3zoMDtl0ul7ZaknhvFTfzizh/Z4I6s5Q9Tz54JxzEdP sG8JX4nexkqmeB4IzEoCjESspx5y3Mj8YBVTy16Svmy4V+j5hQ0vCQ5J4eBaVYpoxhzW gID39gfDyEjnFk/ImkVGNHcoBdZkiALA6o6CY2TkhELI12GUx2MaLnoKyukv37DOUi7u NRAM+DPx2pAVvw1T0DRhf+QIzqiV15pFQGMNClJPp9bwEuMWmsyG/WztRP5r7GmDIu80 pTDA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28330-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28330-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f16-20020a056402195000b00553a5780085si5407323edz.295.2024.01.16.14.50.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 14:50:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28330-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28330-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28330-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 397281F2B1BF for ; Tue, 16 Jan 2024 22:36:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A4DE4B5D9; Tue, 16 Jan 2024 22:06:04 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.13]) (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 ED28520B06; Tue, 16 Jan 2024 22:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442763; cv=none; b=k/ilOKYBDnjkICxlvBi2psIWE7JHxjtxOSg9UaIaMQK/2xOsiSZEmbqpYpWlD0w7ydJQQL1qbNDe5PVrQKXcF/Vp5p41TIxi/kA0wDIWlHVEbBZHNE/6OVkyKQ1wGykj22yODixTNwZRzHhqgpehiEaztefbHmV0K/qQo5efLzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442763; c=relaxed/simple; bh=MvyFTKEIKMUi/DveRQH714RaRZQ4hMyEjMvMk9I2Kc4=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=nGyESQEZgCVCMydIQIu4G0Qy/EUmBbQYr0iu5IH+DdFfrfLv0FGJjIPFReRifPep4ECDxEQfsqLygmw42dk2cmkpzMjVKoRUWMzKKTD6z41vZz748EXmj9U1/2DeNzz1OXCeHpDPi7DPNLNqFu+OYCaY/hdCLsByMu/IHTK43KU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.17.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MQ5jC-1rlmA60xtI-00M2Ho; Tue, 16 Jan 2024 23:05:46 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 05/13] rust: str: use `NUL` instead of 0 in doc comments Date: Tue, 16 Jan 2024 23:05:37 +0100 Message-ID: <20240116220537.168057-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:fQ/n+K82znhGVU06WPCL16qfSsnfY7jriAWKz19BeTo/jchs9x2 jj2Cevp5lAEpIIYImIjab/lXFlPzmiQQUHAJZHW1o9INn06euHr+OuxP+pXxtVRpunF3ZVm qHD//ro97BAS9SRU5YNCi7MDgDu9/0ydJehlB4Oahb44L0aHjT9FP330/I/9lu2MXHvtsaB 9K2Y50PZaFM57fB1MjCDw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:v6zN5nHqZvI=;w2vTl94Fb9dj+FV+Lczts64wvK2 3P/qtnHf66kv75rVrJLkpnsDbDy4+rM+dwtc8S3+q9yn0Znzcd2uKsfT6DvTRU9nfDYRizYXR DhEdqYL/BeCiWDmnUpd+uE4Xmz2zkCw7Ky3lyOW+fBXcQDcz+sLNHJyq5c0LNXdvRyvuYkkmM f+18Tu52QFVD26ITkI/fN0pKlv38JmuPPiDvFZQaa3Si4wWYRcTV1IRJ7Sb4uox7bcQHZOb3J sJ0UqIEOqJDuSMZLDiTVnSIPa4GB7qiCx/Ouf/6dGmcK0gaaYqCCIZod48xx6rL0juJZLpAt9 EtxDasdoE8rINUWmjJ8g7wHFCOw8qkEHWQxPeyL+HvGPZpiS/uRMBh4uneyauNb/pGjvntUmk ArIiv6m5ffd6gJaHrbcOmZhKUmlcPnt9MTmmj0IcD2Twk6XTeP8/81bmGnWUDqJk0tKj/8BgY 56gt18Uu02UI662vLN0d3lU5ZT0SEuBlSjmYY78Q75eFVJsTieWPWwGVwGJgTt3aBj0Uar77V m6orRB3WglfXaOVSKovYX/BuslJcU5Qg/LmVVn2IhyKYOocIAIuWi0gyCzKxVc3MYeHWrMJQt 7pmoLWNRddfDOCoNJhfFw5ZW7lZ22yE8NWxrSIUwRR2VA87paKre5wmw8h7Z38/uq9m9U/Hq0 OXDdtnRmY2QPz9jz80yRUEzIxqKj/R1Ogo80K3zd8Db35psnxGjKZ/Do9O+qrxjfcrpnXTSx4 jR2TZshVhcmNDO12InKP6bv6ac0devVSIFsMQGLbU7SaPkybsn2R/U1PsCZ7Q/5YsmRoe5+/E qwYk7w5Y48I2btBYKCrulCPYTU8FTH1gvEjCVaQ43/0/pUDcHKQtDMYTfZjR3sgLKh+ytsIt5 60FBjwlj+lgjjjQ== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788289139670532284 X-GMAIL-MSGID: 1788289139670532284 Throughout the module, bytes with the value zero are referred to as `NUL` bytes. Adapt the only two outliers. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/str.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 0a8569594fc3..843ffeec9b3e 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -149,13 +149,13 @@ pub const fn as_char_ptr(&self) -> *const core::ffi::c_char { self.0.as_ptr() as _ } - /// Convert the string to a byte slice without the trailing 0 byte. + /// Convert the string to a byte slice without the trailing `NUL` byte. #[inline] pub fn as_bytes(&self) -> &[u8] { &self.0[..self.len()] } - /// Convert the string to a byte slice containing the trailing 0 byte. + /// Convert the string to a byte slice containing the trailing `NUL` byte. #[inline] pub const fn as_bytes_with_nul(&self) -> &[u8] { &self.0 From patchwork Tue Jan 16 22:06:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp567201dye; Tue, 16 Jan 2024 14:50:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxYu3ykAtzTBFVVOfGrcLb0yMS2jY+b8J7jw+UQ8vL7l+3lEihKFhcrt83R7KhCcxf5MGj X-Received: by 2002:aa7:c24b:0:b0:558:da41:df4c with SMTP id y11-20020aa7c24b000000b00558da41df4cmr3953113edo.69.1705445429969; Tue, 16 Jan 2024 14:50:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705445429; cv=pass; d=google.com; s=arc-20160816; b=qbtxYyfBOlkxuAWBFB3HbzmdAxZHX0AeXN2vLP+WQPX4RR7beVOtoX8YD6MLK9V5Rb uiLX4Yd3aeDqg+6/OubOu8023Zl3ZVVl/9XJ4tuUFskLY4jmTDsrySq2xytMxGLB1Tin z4L2XCj/b9NLrmFpWyM9I1FKyWdTy0yFQB97DSl/rejZuoUoT9cMFdxqft4OWXTWWP2x I67MSutO3R7wfpgaIcKIey4XZcJCS8F9ZHVJc9QjCKtisZnfo7rTIvA2PB+KHemvZ1Bh bflkmh1gEhWG11UTviwkyioZvB6YSoExxIwNjJXJHYAmbvZzz8EokVX8POIgnbto1Wh3 8UVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=ODp54UIm9/ahCWvjtdorJeiMkpcIRZRjhKT3hZ1PNKc=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=r/tKxgb6T4gbWcpPWI/k3n6WCJTMK1woFgiLNSNN7U/v/uEdxUgiBvCdjh2aBoYfTS 3Lgxh1K2y6fiHys6504n8IcXOLJ47YCiXJT/2VFxNlP011gZS++fHyPZhPxBhKeo8nrS vX29+YpIHYU0h1xetYxHP68qwpQLrnKhJmdUFCaDE32TW3z+AHHebgz3Yxe/QGtFkPvF X9rr4GD1pRkNy3VsPAe6R9b2++LH7qPm0SA/oO6Di+xm0qCtwBN5FwdDg8iyw10vLVlr w1p6Hj1GxiF3oecauePHPtakYjwE1soBnrXkJvob34WbhlU82Tvy5tx0BgH8E14wwkCA smmA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28332-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28332-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p13-20020a05640243cd00b005597811e947si1492065edc.234.2024.01.16.14.50.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 14:50:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28332-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28332-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28332-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3AC4C1F2B8D0 for ; Tue, 16 Jan 2024 22:36:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD16250242; Tue, 16 Jan 2024 22:06:39 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.135]) (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 6883C482C5; Tue, 16 Jan 2024 22:06:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442798; cv=none; b=ncLpNUDP6rVBA7je8M67ZQTVg8omVdLPoziGLSyX90r/VpwOWxt3s6mqvmgHzhp0h8/RkXKc/57DoI/OWjgTM/t0zLvvt0qDCRVuDXdF2s0xPt0p3BLH/tI8sd5OydaR7/oYC/0Kag4lytsj+VYUOEwh/8vZ8mbt3kJ/cBVFPlE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442798; c=relaxed/simple; bh=qk5bZBH+v41bJbF9eA7PUNh+z+ew2nxhcrsQeadaNNY=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding: X-Provags-ID:X-Spam-Flag:UI-OutboundReport; b=HxBuy0+K+r3q8eiBESNUBRDIZ60i7EYGZb4IIUpwsSyDiMDyxH+VUDFWwZU371urm5vaqqC+K2mrmuzZuMCWxNnjGE+plE6rQ8w7OP0PsnjDf0v2zQxaXk9NIdvQiwO8ciGgJXmqVwHBFA3WotFalX6FHkCQe+MEkssbwgrkROI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MTRAS-1rZe8B0H0e-00TkmV; Tue, 16 Jan 2024 23:06:23 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 06/13] rust: str: move SAFETY comment in front of unsafe block Date: Tue, 16 Jan 2024 23:06:08 +0100 Message-ID: <20240116220615.168083-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:92bNKdsjs75qSuvDF2FfcB++cPal267HLhMmtY/xJxJoC3ADGN1 Q0SezTBfAlV6TObTXq/zXit0+qvLYh5/dYlHlk1bPM2kICVcDSNmVON061S5cgGZpoknMuR a2yEumtbq/wshozvCHePnlTDJGeXEJGfhNEevVJRwW1ruSQWCtm32mt7xQq3WCo1NvzPaih rL/R6VUX7Dn8WKCH7eupQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:IDkEWhURD7c=;ReOjbrZ1lRUgApOj8G512ld2rTl aQs7HB5kgSZXS6lHwfPaeXaHxoZ2OpWlmXyb04o8nQo8QtRcdjzvERRCOyv6t2vpknYmWf/Rh z9cjszLazIMHfX4PE5pQssyfLVD5v4XaTzMazV2Voo9juG8U/oOATNg2uwGnvlGjlxo6YUR9K Hb9o53W2yCkumbzLM3gqrtGJZeJVO8cmcwwl28KDQBXh/YEWWWAtiWp41rHq2auHVAlVSyIZo YrHjJpgOa1g7+Qr06o4UMyHj3/SNxEe77QCwCrHy0FTttlRPh3fS1DLmW4P5ai83VHK2IOnRP YoB0iJ1eHGHwfgIvPfqrd/j6EJUm0aKjPlyXdY86kh+YUk6OZhYv7hLvUCoNxbAiDxu8zJeSM SQzQw1wPlP6Ktlpl4eCCw2yAoCk8POJN0lWSlPRFDxldxkzDiCHLXQ/V8Vay6S/kQRWz9mt6e ibwo6WzLSqYg4x4WxPAfZJhMUamd7ige1FWWYijTTUJazH0nJiSTVWfYipaul6+e1wPq/S6rv NUuT+PUF+cAKZlvqx5/pF1uad1auLfgdtawVH+4sAyT6TljbD6aBEJ8Whcbn37FyjjRH0T4XI Z0tjlVKjGzxAnFEClmooSG3Yrosh3gr26aA8nxichmw1Cbd3MppzpmSmZJc1P0mB5RZ4m7rmK JURAwDyOG/0fz/jgwCz6LaU7Op+TqtRNIk9byzpOz2o8eeOGVpECgUaUOIz0ANaLiWWHzRq6S 1pcMfC5HUmvEM/NY2UkCoN9rPpZwFAJ9Yr1E4O1RTClipec0ViW3v7qWABY1vbUSRcitcOx2n wvIt3M4HoHMTJxrcOS+j/f6nbFt1Q5rtZGR9er3yrixeDnKbelUM+SUYtu1z+qPzHV3sMnpqF r50BBcY5rmvXpBw== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788289147120170653 X-GMAIL-MSGID: 1788289147120170653 SAFETY comments should immediately precede the unsafe block they justify. Move assignment to `bar` past comment as it is safe. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/str.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 843ffeec9b3e..fec5c4314758 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -191,9 +191,9 @@ pub fn to_str(&self) -> Result<&str, core::str::Utf8Error> { /// ``` /// # use kernel::c_str; /// # use kernel::str::CStr; + /// let bar = c_str!("ツ"); /// // SAFETY: String literals are guaranteed to be valid UTF-8 /// // by the Rust compiler. - /// let bar = c_str!("ツ"); /// assert_eq!(unsafe { bar.as_str_unchecked() }, "ツ"); /// ``` #[inline] From patchwork Tue Jan 16 22:06:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp562350dye; Tue, 16 Jan 2024 14:37:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgm/i/HYCZxmIkhbCnzvFmsqvdnAgjCivUBYTdfBzEpdOmEjc0aRRE1x8aR59zysOiOxHA X-Received: by 2002:a05:620a:3908:b0:783:2261:dac3 with SMTP id qr8-20020a05620a390800b007832261dac3mr9935223qkn.36.1705444626392; Tue, 16 Jan 2024 14:37:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705444626; cv=pass; d=google.com; s=arc-20160816; b=RIi8WZkp50Bj//VOSKUJ9IqC0UwDlKlq69JgN5jFHCb5Zo95ZQUQ84Dj5uyfQRpIxw juQ7TJ9Y31lZgY5/ZLJbxGCz7gzLAg5Xdc2IOakklO5bh6SOKN7W8HI5eHk3+yhU7Qnh 2cba3+urIpQz8FmUhIDeObeUPjfrJpR5a10m2hsQpeuyUT/UmgefKcSZw5/qUA2Z1KEi IkUobVi0tk0uRLcZQXDhfksggzqKB5Az1OaS3A0K4Ns6K44JAlG0oXPwXVnip/CUcceH /b1PW+8EfKOijnTATtkW572L1t6Sq5F4JFUMxNdVeoe7Tk66cy0wQCjqcJTD9dF1mLvg ySVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=s6ObqvjXKGBn1FKdihATzQPYcjNRgRmmPoX87ciPJuw=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=y2pdM5sSGiLtyF+U2p3Icr5eFFL+MQemN4oQ1xV4xabhSjxgGnMhLR1pWvHb4sPNs8 ps1uQlyrc3qXqYqS2hpwILvMFqIvPknQ89o886toTZvr9hXh6ZOvhMZbMkI4kMsztrHG Mv7SXLE32IwIBD/TTSVTJUxbwn1zh8IRqOJwh4aDA4gvb0sb4yaYmVML5Na6ejMc2bzT cy/HAmA789d68RAOGKiJoJl71/YnCJjTM4wZjzfv4UAR34TKrIeey8IZ2fo9z2kXHow7 fZDXRKqGutpCjgeBPDK/QIoGU0TTSGe4U6CPYtdfYouaowheWhJ2zmotKKjy7IQwxCDC XNrg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28333-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28333-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j5-20020a05620a146500b007833d053697si10539225qkl.658.2024.01.16.14.37.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 14:37:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28333-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28333-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28333-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 33A141C23D82 for ; Tue, 16 Jan 2024 22:37:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A2DB604CA; Tue, 16 Jan 2024 22:07:02 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (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 A277C50257; Tue, 16 Jan 2024 22:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442820; cv=none; b=Pa2pDR8DIZwPkdeQRtUqNpoCYQEkbN0WZH43+rWD2r7K11ktUNCIvDcABHxokwNjJZSN8uI2qVrc8HSp2GIDbBFK2cSY69FJciwS4yaGgZRqVe5GzLn+ia2Q9TsZTnIsparGPWaXCkwWXs9+WJlEBylVBuIiQC4O3rsjyj5vJmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705442820; c=relaxed/simple; bh=j6+7rgEBCA/c/X5mKHo3VbMlssDcyBdbuCJWJNRxt8Y=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=XBc9f+D7lub7wMlqyrAllmU6s/1UEOYCQRR7ozyQu0EG3KYHSoHFS7NFzgrOmBLEtOtSVQHa2bscmiOTC5KFZJDqO72hg91Rku1TZo1pgOjxME8Qpkx0vdLYXVvz5X7vL/T5HO3YL4VjtdzAEbfAAiZ61p10sjB7qhZBeMPLFM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MaIvV-1rc6xa1LD3-00WIzb; Tue, 16 Jan 2024 23:06:43 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 07/13] rust: kernel: unify spelling of refcount in docs Date: Tue, 16 Jan 2024 23:06:34 +0100 Message-ID: <20240116220634.168103-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:LZw9oJjc57o5/lxghWGfTXEHpI9wO52N1Q7vBXUMuSrIikpUuFA /wRPeTCC2FC5I/fWxcg7HujN9BJ+9cfiyDvjerjofCYWK++qkNsZyn95dq7U3woXNxmTGEO I9HM7AYgD+VwsB3weGkdVoiOaZj99wNY/JsAqO3Wb5AmsQIsuznp679kqB5sOzqosRwkfmb X12P/4799wzyUNlPKdcGA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:B7paRzsauwk=;7Zg8OGMbyonRRdQLeSvE8EbvRuH DeuAgOrBxtUqEl++ypVX6kVQ42yPvKWxVh3lkhsKTLG4+5vxbEnD0htObVnBgt36h8eVG3byo n2TadqXG+CErGNXT0FtGoJ9RBDmoWvmcUvLxx5k8vcbhkQA8IsM3pTqDkNoor/LoTQqLVI/lu EJWbunYfwA6XLGkvfgR2KD7V9vz+KCD96d7XzvL6Xg3nOHlcpO0uX9M8oXMzz8xOitzFu3Aro Qw8yMkMjVpkQ9QrGeOoa2FhbJEl+db7cqc7DvoXmg0n/rpo3Y6ktWsKpOwnLh+zCZ2AagYH62 LqMEjwilo5mugSIspBAKutImXdlEJDrD3zYn4xdlpaf0JPsxNghUh5I/NdFRQMOb9b/6ImMXj FuZELfBjJrBxB6OakEpfZa7jO83kWJiVKUyWutSybzCPJKxtErGUvhzIsrVug/0A3tkKtkyJy qwMMLd15SBoskdXmlKgs2KySrFANzkr5IUsb8wgW6jZRBzrgpiszzN2MzhVGMJ6HlKeTV4/YH kklnuK+2JB3Uz4b+FQL+1RwWL0y+4NuFSMlmeRaFRiPqc90CeBXh6ZYWl3fXQNCckdv9VsVfA vTZRaQeJUxoqEffd3LJUG/vZTGlSMXOHy9EtQPpqLu5YKSJTp31hMqoc0AsVWUPfuM+YzrIp9 hNq4uIQliNqQ8SoOaHht2ZhgMbps9P9PTIDsU2dRUtDPw79H9qUxyNcP+EG0P37+7mDUxAkVv unIzN7nSuTm+LXfMClaBN/tY6CCUAFrRxD7QwClEPJ3c8p386XurE6YxeRqWuY8uLwTzxNsYr OX2jpxIiz9Wbw2cqQjlLNmHBqLVvskIoxZ9bh4zLCa4c3Lx2mP9+r+r8Es7vsUMSM5ZfqoOB0 Qrywc77cH789l9Q== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788288304315660298 X-GMAIL-MSGID: 1788288304315660298 Replace instances of 'ref-count[ed]' with 'refcount[ed]' to increase consistency within the Rust documentation. The latter form is used more widely in the rest of the kernel: ```console $ rg '(\*|//).*?\srefcount(|ed)[\s,.]' | wc -l 1605 $ rg '(\*|//).*?\sref-count(|ed)[\s,.]' | wc -l 43 ``` (numbers are for Commit 052d534373b7) Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/sync/arc.rs | 8 ++++---- rust/kernel/task.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs index 77cdbcf7bd2e..6c46b1affca5 100644 --- a/rust/kernel/sync/arc.rs +++ b/rust/kernel/sync/arc.rs @@ -56,7 +56,7 @@ /// b: u32, /// } /// -/// // Create a ref-counted instance of `Example`. +/// // Create a refcounted instance of `Example`. /// let obj = Arc::try_new(Example { a: 10, b: 20 })?; /// /// // Get a new pointer to `obj` and increment the refcount. @@ -510,7 +510,7 @@ fn deref(&self) -> &Self::Target { /// # test().unwrap(); /// ``` /// -/// In the following example we first allocate memory for a ref-counted `Example` but we don't +/// In the following example we first allocate memory for a refcounted `Example` but we don't /// initialise it on allocation. We do initialise it later with a call to [`UniqueArc::write`], /// followed by a conversion to `Arc`. This is particularly useful when allocation happens /// in one context (e.g., sleepable) and initialisation in another (e.g., atomic): @@ -560,7 +560,7 @@ impl UniqueArc { /// Tries to allocate a new [`UniqueArc`] instance. pub fn try_new(value: T) -> Result { Ok(Self { - // INVARIANT: The newly-created object has a ref-count of 1. + // INVARIANT: The newly-created object has a refcount of 1. inner: Arc::try_new(value)?, }) } @@ -574,7 +574,7 @@ pub fn try_new_uninit() -> Result>, AllocError> { data <- init::uninit::(), }? AllocError))?; Ok(UniqueArc { - // INVARIANT: The newly-created object has a ref-count of 1. + // INVARIANT: The newly-created object has a refcount of 1. // SAFETY: The pointer from the `Box` is valid. inner: unsafe { Arc::from_inner(Box::leak(inner).into()) }, }) diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index 9451932d5d86..818ac51b06b6 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -23,7 +23,7 @@ macro_rules! current { /// /// All instances are valid tasks created by the C portion of the kernel. /// -/// Instances of this type are always ref-counted, that is, a call to `get_task_struct` ensures +/// Instances of this type are always refcounted, that is, a call to `get_task_struct` ensures /// that the allocation remains valid at least until the matching call to `put_task_struct`. /// /// # Examples @@ -147,7 +147,7 @@ pub fn wake_up(&self) { } } -// SAFETY: The type invariants guarantee that `Task` is always ref-counted. +// SAFETY: The type invariants guarantee that `Task` is always refcounted. unsafe impl crate::types::AlwaysRefCounted for Task { fn inc_ref(&self) { // SAFETY: The existence of a shared reference means that the refcount is nonzero. From patchwork Tue Jan 16 23:09:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188644 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp576694dye; Tue, 16 Jan 2024 15:10:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPoLtgDDZogwjLb5mzO0OZsf1UUd4KfJwD5d5MQShDhn4TfgzdPZJ/xQsx2T++AtkYbtxS X-Received: by 2002:a05:620a:2413:b0:783:fae:e719 with SMTP id d19-20020a05620a241300b007830faee719mr11906568qkn.39.1705446638204; Tue, 16 Jan 2024 15:10:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705446638; cv=pass; d=google.com; s=arc-20160816; b=LcKcMgOWW6knDwJbeV/r/dJM/qDgzXnpBegGRJNZp3RgU1FAXBr72dHe3SuDrBSggP OtOKu0fTtYwKC5qzSR/mWZEvqpEATc+jG1R8tJQ2yUxtwZu7SPj/LHBdWmxFXvABWMSb 5Gp6Vl6lXft8tm8Ax5kiyw+Q9vBldN9nLDkRPJWnG/69+ti89VHjI67fJ62Px5sAx5h4 gpiVxABt6MlmLSZkynexi6vvhjFxU8IKzLwFxV3e02V2RK9/DZe+t+8RWkAPQDuBmrbL gNHBQfvELbdzpN3FMW+I/pEdI/2dyxkypqJligxlKPIHIz6uhWppq5RFoPxRY2EozYAb qflQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=5xR02sAOzAZTmBrwmZ2Kboyv0PFrBOGQ6Cmw3rGJClY=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=Z6Chj0ipiBSZj2UrU0cqxjJBPUdks1cmRyjyGS8OVwsusR8eRHlEFNAmDviXGhnkSd eqtMCLVCFNpJglY4BXhXVC/2cNUS1TVnskumS2uAoIDsKChA0kEh86mshKEkhtI/Q1Fk kzUPhpTQuMXHJJ4LEdgIpLrsmvHAuLjT7w6YtQC0D90T4lKsAOY/sxkJ8+sJExNm/rAI KCEXZ+/DaQzY16Gs4ZCCV6d46dBeZSSiFfoyaREooZbkvEhCUB8C/mQEkzQMkx6Nn9NE vHpqmJrlutILDJXLeWhXPnyoHZd1WGThmEMMnZ1Z1RFeq51a9pJYlOIOInXA9XKjTM/5 3M4w== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28366-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28366-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o22-20020a05620a0d5600b007834a2f5ef6si8613063qkl.369.2024.01.16.15.10.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 15:10:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28366-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28366-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28366-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 054C61C265F1 for ; Tue, 16 Jan 2024 23:10:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F1751D694; Tue, 16 Jan 2024 23:10:21 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (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 615AC747C; Tue, 16 Jan 2024 23:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446619; cv=none; b=S2IABM3eNLOPTMOjrOni9aPj/lKBu28mgV/6BiXAyL/LMaM4A1SdVp+guwSfMZcUWLRJVz7A7UNMA9YxBJuPBD/X646yuHxVKw9lJavzcGj/OJ1S/g+G6Oa24+2EapvJ+UzOJIOqstzk+MYJNrKpeLoludvhLG2OxXHnWmowGpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446619; c=relaxed/simple; bh=CZ7nKrqhhNF2pFJNM9siYB8MbfbW8gtSc1B3+Vk9ZE0=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=eAZC1Y1XuNzhHR14sbeQpKimzKgJdZd6SE/adrLpN/BuonSM02SGX5TzhMJ89RVNekRzMtKM9OWGEyD26KKbXC4QTTADCIHvc64REk5eHtvWUlj2agt30cbA7hLuI+2U5IjvOniXriZrv3ayuofD3vP3VZxiBLNPhnpYrrWD/Is= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mw9Dg-1r7Ni60Y9E-00s3Gk; Wed, 17 Jan 2024 00:09:58 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 08/13] rust: kernel: mark code fragments in docs with backticks Date: Wed, 17 Jan 2024 00:09:51 +0100 Message-ID: <20240116230951.168808-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:wsYRVP+9i0BrZ6my14LK0meIR1rCYBN7Lm9fbdVaOsY7zBcTIGO EEFNqthbwPz3ogMXHrVS8MRzcfsxnVkRhe468aOJoxMUd1PtiS5IAZiCMa8UMwdlcXBMz5H sK7qy8DuRGD8kSpw3ZPXgIwEtpD/gS0XzUalEeM4GRcD29oDz0DHd3RJPsvoNpCV9XlJNs1 OcVgL9xGHIi/iCz2q6TNg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:W30ecyRewBo=;wvY9r0144BnswLQcU8dj4le0K03 R5Ny7mbnEZ+eixrRf90+qoXDEoBwnMQ3W7DRtaPl1h4zuyixGJAENMhGplPQXg4aLoLagylmh 1BZmH79O+ILgG2pSQwnVBu8jgDFrClRKThjO/NmbcFwST34CAA2hgOM5//+DZZhp37LXIsm50 MLDtaPYCNfUiUKBUaoq8KycM9vgbSykaW6O/U8n73YDcG9HnhF2Xo+vZWso4rDSguvssUUY7M iXO14mX52V+9QhDBKQzzXhfr0LInsiZTrxFZLaHwihsHR4y8wJkE5xQDgSNE/8a+rKJHpMCLw PhAnSbuXzuWOVv8jOhX5UjE3Yo5BnRPDWW2biQBnA4Cbz/+sCABxDGvZPTyaahOMVdUOqWcLw u0lctsoy/+Bf+y0lbYpieZOh76LaQ1og8v4TaKV+WU8zc4zUjvOCWT/YLV4Nic0kgrke/FBWg relULteLJ++pCQN7vdKA0jXILwCYXxHG+ClV8mVL8HX6V4XwjWsASVJRjrMOd4ZuutPv7m7vW CYyaT3Bd2KfeMk+W+u7RU0x3ORpdoSsKo2I4kyqOIH8jTO1e9ledk6QKJuXnaZhFqtFX0Jh+c hi8EeQDjjoSqADJ4y+UTWJnSa2YpaQK8E5Fe+GvmkkIgHjgq7HbzJAtFDow8S5XTnQFa2Ej8o OnWXvNejIUXpGfkwjVuDpPdI1UJLvzdDqBuu9zCzTtew2GFl5OylxIKEhwszXN1frL/pFpoI0 7unrsr46/CvPqUUw76YJZkJA/Dye3xj4adJzhZDzdNi7tpUt/kF2fwXJNTUAAu2ZHbi7tlMpb ldtJcXj+6mlw9MMdMMvQ/AAIlpsaZmA99FZv6jduo/CJ5Uyk1oO6rL50dCfwmn6WR7YAyIUd7 WtKSDg+2rWStQoA== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788290414090175070 X-GMAIL-MSGID: 1788290414090175070 Fix places where comments include code fragments that are not enclosed in backticks. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/ioctl.rs | 2 +- rust/kernel/sync/lock.rs | 2 +- rust/kernel/task.rs | 2 +- rust/kernel/workqueue.rs | 9 +++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/rust/kernel/ioctl.rs b/rust/kernel/ioctl.rs index 5987ad6d38a7..cfa7d080b531 100644 --- a/rust/kernel/ioctl.rs +++ b/rust/kernel/ioctl.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 -//! ioctl() number definitions. +//! `ioctl()` number definitions. //! //! C header: [`include/asm-generic/ioctl.h`](srctree/include/asm-generic/ioctl.h) diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs index f12a684bc957..467249b39f71 100644 --- a/rust/kernel/sync/lock.rs +++ b/rust/kernel/sync/lock.rs @@ -28,7 +28,7 @@ pub unsafe trait Backend { /// The state required by the lock. type State; - /// The state required to be kept between lock and unlock. + /// The state required to be kept between `lock` and `unlock`. type GuardState; /// Initialises the lock. diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index 818ac51b06b6..d4b0d232480d 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -116,7 +116,7 @@ fn deref(&self) -> &Self::Target { /// Returns the group leader of the given task. pub fn group_leader(&self) -> &Task { // SAFETY: By the type invariant, we know that `self.0` is a valid task. Valid tasks always - // have a valid group_leader. + // have a valid `group_leader`. let ptr = unsafe { *ptr::addr_of!((*self.0.get()).group_leader) }; // SAFETY: The lifetime of the returned task reference is tied to the lifetime of `self`, diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index 8775c34d12a5..d900dc911149 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -168,7 +168,7 @@ impl Queue { /// # Safety /// /// The caller must ensure that the provided raw pointer is not dangling, that it points at a - /// valid workqueue, and that it remains valid until the end of 'a. + /// valid workqueue, and that it remains valid until the end of `'a`. pub unsafe fn from_raw<'a>(ptr: *const bindings::workqueue_struct) -> &'a Queue { // SAFETY: The `Queue` type is `#[repr(transparent)]`, so the pointer cast is valid. The // caller promises that the pointer is not dangling. @@ -414,8 +414,8 @@ pub unsafe fn raw_get(ptr: *const Self) -> *mut bindings::work_struct { /// /// # Safety /// -/// The [`OFFSET`] constant must be the offset of a field in Self of type [`Work`]. The methods on -/// this trait must have exactly the behavior that the definitions given below have. +/// The [`OFFSET`] constant must be the offset of a field in `Self` of type [`Work`]. The +/// methods on this trait must have exactly the behavior that the definitions given below have. /// /// [`Work`]: Work /// [`impl_has_work!`]: crate::impl_has_work @@ -428,7 +428,8 @@ pub unsafe trait HasWork { /// Returns the offset of the [`Work`] field. /// - /// This method exists because the [`OFFSET`] constant cannot be accessed if the type is not Sized. + /// This method exists because the [`OFFSET`] constant cannot be accessed if the type is not + /// `Sized`. /// /// [`Work`]: Work /// [`OFFSET`]: HasWork::OFFSET From patchwork Tue Jan 16 23:10:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp577025dye; Tue, 16 Jan 2024 15:11:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGI/PnkyiO68q8PCy0cAL7bFFI+Tl0oEyrprORBUTpbRH177Q/3JUTYyPL92lAXtkwK8sj3 X-Received: by 2002:a17:906:5204:b0:a27:a258:f340 with SMTP id g4-20020a170906520400b00a27a258f340mr3594298ejm.65.1705446685885; Tue, 16 Jan 2024 15:11:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705446685; cv=pass; d=google.com; s=arc-20160816; b=j+xMqopgTxzG73RChISD5TrdbHxzhEwRxqVrbVG7QtwtiBqFvFzrz3H+nr3ojPJc2q cTRhM8X0QZMZGYDYd8lWkWITyginxAbJyfuGSaNFB2vtP0gImq0ahCQR1aNRyXM9pJvI Wt9mQOFO8aAj5e32Rtg6jGaRWl4zZpsSdyrpNP88YukCEmPZKRG5UamBgdRp4ralQxvz Sq3XFlsHV/8XKp2f4EFHtKmL72oFOqWGusnC9j7/cgfJVOpkWUrC+Xem6hqmZBkvHO8T pNHM13XqKItHxv9o/qXFUlFqpt1PBys33JhOyRxIPPHS593N1CjZTQRqhHtNnbKFyNYz Nicg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=K0JIdirf5hV8AGpcvpJwIO1C5Npe6h2gQCWIHZGNVGA=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=egKcGn5EYE5P5bf5hJOXjcyCRp8vPixHpFzNMy2ThDibQBIfFqwiUPIKx/PfJDAs8M zP1uiYUUYkzwX0tAD25vqxYFiyM6uelV4ndcQc0XvosU7L5B0ZEGnOlrqHFSY/cdJWZT etiObidgIZX270av2+1FV9A2/fCLEAhdOkQ7+gZ/FFOr+a5q1t97LFc+mcPiQEiniBKl w3DGD392XRaK5YbGl0K7gwsQnDgyBEEeuxp3lBBPl5QFfDmjABFJ9gdtNasevpSlsFUj BLOp0e1exvShPhCe8tajS6/6NhLOFJmUYgDSs1BGClHtso99OocETNo6ZrfkarzK9LLs puNg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28367-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28367-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id x7-20020a1709064bc700b00a2d183431acsi3618985ejv.991.2024.01.16.15.11.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 15:11:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28367-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28367-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28367-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B55D21F25BE0 for ; Tue, 16 Jan 2024 23:11:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED5EA1D6B1; Tue, 16 Jan 2024 23:11:01 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (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 90671154A6; Tue, 16 Jan 2024 23:10:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446660; cv=none; b=rkkkdxT9h7M2JNGsZRPAt9FHmHBG/kMbhO5NM+tlTCfoxGV+PUCSE+nN/xiIIBY0h1BoprVKUlkLGMBHfAN0YeorufIFpeUCr/PZNx4Fl4k64VcCkywQlc/MDc7ntEJ4x46iV/UeIbDxn9wq4l5H5VaClxkzme7HwKyRhPhNT3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446660; c=relaxed/simple; bh=6kMEVkUtpENf3uILfGmx7CwIEW3QhLIKQG8D4rvGCJA=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=YgE3FkzvVPDFHruHXl+UFWB+fOmyWSgqTvP28zJu/QgxUDxjup+8m9upOGDCeOrykZn40ypDaZDyWUUXxXcmWSM2RoGkY9ykPBKwg4WuDM4Q/JTFvQIpkCO4AvvYA0s9SZqr21fXrr7oKzd1zAIyLf5t6qrPitGWyRDfQCFh3kE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MfpGL-1qx9X32FpJ-00gF75; Wed, 17 Jan 2024 00:10:44 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 09/13] rust: kernel: add blank lines in front of code blocks Date: Wed, 17 Jan 2024 00:10:35 +0100 Message-ID: <20240116231035.168838-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:GExkHjC2m4S4YEdTb4SLROcE6xv0Z0T/xFkMhp5M6sKfwUta1y0 1giNkzmUSLAcASxRgRoxVyGEv1FggmrU2BmMeXd5Vfq2Ly6YBRRXTqHtkmXEpcFtYQMze98 02rRZFRDA31TwayVtpH676fkJHqGVtE2P9wnQKZKNJ/qLTwII9DWqs/tN/5Mt6VPyNnxOqO i4ltBknD5pM9WpO5bcRDg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:3227nHjRX/A=;k5khFr9FsqthzRRubZhi++CxcZI jH4DDASQY7CRx9oNVgdSN2l8eXsrZegC/jMq6BwCDHzVGII0P4VEOtsg62d3H/sR6b5Z/lUp6 hQDZm2A/MZDSwpc7sdt42v69jbJFGa9W+A9RiB6vIUs7T0QO6MRqaW1lf5gPAAxK3PC5zKCFN 2A3h39pmnNp4cc1UFIZjWAwCrH5yuV5oJw8dGgSYDQK9F1cclVw2DbxbBPm40QGEVL8sZpXqv VkARNvwCto75dplhtA3QEVVYCIDk6YGPy+05xvQ/jVtYzZivtF7GpWe/82U/i7TUuqnRDJNTA 7oolEiBEw4vObu163oN04U7QUWOBenFlO3eabzMbkvyE0mEjN8KvLA8/d4mSXUIdd0gF7c8ok pfXLw1cmrx4OyHrCcJvW+edZWnVVA004PzrYZmrJsZmZQmxHAAvI8UA87hDDV8WY4ySr0PGGC LxYPrFdwwcjwqpxObP/ly6dW+pok8sLe2tO/1opRI56FuNxgePMJXTW6x/hPgVOjsWxVadi99 BcDHcW7qVF5fzdfe2F5+ZMHaZUmQ+yOEHNHB9EQi1Q6+VE5TbNodByMZ5wmgcVUYd9jCdYdxn NPqWxax8pulkCShmX53JWXoT5TkLiBSWaRZ6n5Ec4QC+eAM+F70J4AqAbV6XMxQ9CU8+mDktX pWZy1OYXe+f5rPjM5Ky6ZD5b1eHSKIjpAQQr0LRFQNDaM6K7H0y31CbMl66Z1HjgEgDL18RFq QAq5O+tGh1xEBG2vCyt0RWnVrZTZfZ9RGBa1D4qEIdnJezbTcEsveFI4PyoPecD95jF2ubKmV U60dcEOoKY3Hsb8AMj7yHVslk0NP2uyjBTtYULObfzg0/R2fhvA3pg7V+4/g91p2oDLcTaVjd 4rqbsgGOkgJm0Og== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788290464233627204 X-GMAIL-MSGID: 1788290464233627204 Throughout the code base, blank lines are used before starting a code block. Adapt outliers to improve consistency within the kernel crate. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/types.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs index fdb778e65d79..8aabe348b194 100644 --- a/rust/kernel/types.rs +++ b/rust/kernel/types.rs @@ -90,6 +90,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Self {} /// /// In the example below, we have multiple exit paths and we want to log regardless of which one is /// taken: +/// /// ``` /// # use kernel::types::ScopeGuard; /// fn example1(arg: bool) { @@ -108,6 +109,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Self {} /// /// In the example below, we want to log the same message on all early exits but a different one on /// the main exit path: +/// /// ``` /// # use kernel::types::ScopeGuard; /// fn example2(arg: bool) { @@ -129,6 +131,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Self {} /// /// In the example below, we need a mutable object (the vector) to be accessible within the log /// function, so we wrap it in the [`ScopeGuard`]: +/// /// ``` /// # use kernel::types::ScopeGuard; /// fn example3(arg: bool) -> Result { From patchwork Tue Jan 16 23:11:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp577139dye; Tue, 16 Jan 2024 15:11:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUOTVhv4hP/a1CbCZlClAPCSsdttkB7zK6bOcFGzmyWJhT0px6YoLg3FaZNE7nyMxvoKcD X-Received: by 2002:ae9:e108:0:b0:783:24c2:3e4b with SMTP id g8-20020ae9e108000000b0078324c23e4bmr9029209qkm.43.1705446705516; Tue, 16 Jan 2024 15:11:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705446705; cv=pass; d=google.com; s=arc-20160816; b=cGij+r98mNMOdPgjNVXhfw1x+lLdVJ7n8IxAgr+bAB4VWi1yI5LQ0qqxmy/4zMlgcM dfS4ThviJZzv0HQvERlpDZEpHjHxAIVTct7JBBARpyg6v6RQG5UV2/YcKcfegcWVRLX5 yM3yn5W0Wd81VxguaZ/sWCKkbpL2Ewh167s9kgo1DXGh9wEGLPetTTBK+20Q3ntNM4jx PFCisOUaI1bq0GrmMNLg5VvRYvzLzuopR+6FT5m6T1Qr4HAtfF5v+hSzdqlHJ4WCZhxW 4bCrE7jMQQ2o2y4RNea0DS6xJMFsLVZTObAyX5C+g50xa2Fs2pnnhrFnPjzhcU01i/iH j9Zg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=BS6oor4M1b6KTZQ/xAElwbEC1KmGVeKtvjG/IfvfKPE=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=jHQhFxEvBcao+R0yWGSZNCKBB+thLBT0/lkeo01986LqM6jbpyEnY1kVX5qZf2P88H gXlitpnZMitPeqfuQ338iong5wHimu9Z6DrhqAA7k3gy3X9Kjd2iIX82Ea8nnkfIM3xS A2bZLq1+pzUnUuPM9zx9htWdzSkLiJvzdLdxuxfyNMZ4bPRFEVODOpl3SckOABQq0QmV M4A73ovnBupGx/zZnUBnU2T/Zi/m+uiF8wsA//eOTf9QFlvcsEejG1nO/+51fO74qvpJ r5St00cU1dcwWJN4Igz2M5c0ICWr8hp1GxsPmciEveWRpqj1FQlkwzIl3BGQVzZfAqIf 1Xyg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28368-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28368-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u27-20020a05620a121b00b0077f0c19e400si10705235qkj.610.2024.01.16.15.11.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 15:11:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28368-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28368-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28368-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 43F921C26784 for ; Tue, 16 Jan 2024 23:11:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D7A71DA36; Tue, 16 Jan 2024 23:11:28 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) (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 A13231CFBF; Tue, 16 Jan 2024 23:11:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446685; cv=none; b=Ncu/BSXxBq2D4wGnPLedFI+omQRjvgJ8gITh2ggCTrmSZKc55h4aiwi+R1ZeJ3K3+rJmP+ywECxPLp2vHXWN8QT4M9YdOnB/4iL3kJQW3mb6RUOSXXOAYwdlFIL98VpNMiAcriCe7FM1n3kzK2t8KGQyxoCDPG/f8JZumo8HjTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446685; c=relaxed/simple; bh=7MiaAc6W5AQRrrlOnAKaPlcWyVIYgzIpHuf2rLOhyAM=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=sUbpgn8NEVcu4dQn5sPrRddv20GrDMluQabpuMsRo/pOCtGt7euZz+i8baXCIvxvyGvXxkdsFmkwkgnxCQYyOHZXvGkKzFyPXneJVPSOTheTrcm4wCvK2Boqxmhes6RsC/DTq0ZDz2WR2AZChqYiqwxkYYmtfvPGV730Iuwh1Ds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mtf39-1r8kba2vOh-00v5AO; Wed, 17 Jan 2024 00:11:09 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 10/13] rust: kernel: add doclinks Date: Wed, 17 Jan 2024 00:11:06 +0100 Message-ID: <20240116231106.168864-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:Z1CAg3hR5eUEZFAbmCMyk8n31l1hu3iGDoGIyb2TOJ9BQ6oZ66N xgh7g1pKxzlAf0WUIFDUKP6K/0/NaQU5EdLwvuiu82vHVUx/nWQVi7tTrEjqXbfEavV1qSq HrR7fNDf5NZEFnuJhaCpZnyoeNIhDAKWSzglIR75OwVbgo339n6EqHSswFeEYMbblYfusVm 74H2GunGWWkBY49egjj0A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:JXSp30eQ2Vw=;J/G1TkfLaA88yilc2Ul0f19oerM eaVn2VYzWEyaVDNjswDND3Sg+cPLdiaIvpcHAGh0B0O/0TG3NrFW6pYG7WVLF9pTLsOTEtYul 4Hw+Di5Fx/4HRpJe0f71AnukTzancGUDaRdCOb7cTvJKI1j0GZuA1voIp6mKXunWnoBEOFR1C 9TPfdxc1ye9TTZb1xvbx9ppe4V4X0zan3jFJ2xIl2PxwgDCTL9f6sN81Bi182naEKhQ+qWs5e jj3WiPAsKOfxPInmfGLuihc4tQzGCpxuVrcqzkQoa/dktCSCnM45L0clZQyZKCDCQZISiVYoi h8mGL+tRfuV0z2cNzlq179xNC6C1G/p2MN2ywDR3se14Jiq5R+lGB7biUVlFsy5nCqrsdnsi0 6jCOzPoOF8i9Eu6Epul8OUrwkhTg1KN7NbsXw0pkzTMRl7EVpgXgDL6SxDHV2tMaU90VMYpMd RWdnpeTOGmv137kNwdJF6GK6jWduZEBl8BTmd65z+CA4FCQGVryHPJLK99trx1U3UV4fRNwuu DlvCUq9BeN9CpNjK1S0zlK+iG4LpnWefkshVw/rNSf8hHNGMcgQ3exSbFqwLwWCOadZuBIqcY RPskhAnNRaBr9DHLgWJDg70DoEZfE1JoCV/lqh0akdfvzCZrKuSBLHSakldF8XiyPXejt0skj /ta1coK7kGwz9wAXiVEBtZo+vOgKunEFMZXGBgxwgKHTYdcSQjPfT7EQaGT1330USsvtECsvt P8bJHL/b0EU2c2L6Q4j2KeVm7L9xCq2NuYdtI4UrGVV2PGkuHqp8NZ2J2bEqm/iDGi5xXeHIN hqe6I7kFUUoNMFRKgrRrcNbMDc4iUvsyLfEZUaWgZ1QF7XikFcOlDhLD+kmP4L5TWgsCofrM2 vqZIJquE0icTWfg== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788290484351883006 X-GMAIL-MSGID: 1788290484351883006 Add doclinks to existing documentation. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/sync/arc.rs | 6 +++--- rust/kernel/sync/lock.rs | 13 +++++++++--- rust/kernel/workqueue.rs | 45 ++++++++++++++++++++++++---------------- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs index 6c46b1affca5..936bc549a082 100644 --- a/rust/kernel/sync/arc.rs +++ b/rust/kernel/sync/arc.rs @@ -365,12 +365,12 @@ fn from(item: Pin>) -> Self { /// A borrowed reference to an [`Arc`] instance. /// /// For cases when one doesn't ever need to increment the refcount on the allocation, it is simpler -/// to use just `&T`, which we can trivially get from an `Arc` instance. +/// to use just `&T`, which we can trivially get from an [`Arc`] instance. /// /// However, when one may need to increment the refcount, it is preferable to use an `ArcBorrow` /// over `&Arc` because the latter results in a double-indirection: a pointer (shared reference) -/// to a pointer (`Arc`) to the object (`T`). An [`ArcBorrow`] eliminates this double -/// indirection while still allowing one to increment the refcount and getting an `Arc` when/if +/// to a pointer ([`Arc`]) to the object (`T`). An [`ArcBorrow`] eliminates this double +/// indirection while still allowing one to increment the refcount and getting an [`Arc`] when/if /// needed. /// /// # Invariants diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs index 467249b39f71..f14179d19d4e 100644 --- a/rust/kernel/sync/lock.rs +++ b/rust/kernel/sync/lock.rs @@ -21,14 +21,21 @@ /// # Safety /// /// - Implementers must ensure that only one thread/CPU may access the protected data once the lock -/// is owned, that is, between calls to `lock` and `unlock`. -/// - Implementers must also ensure that `relock` uses the same locking method as the original +/// is owned, that is, between calls to [`lock`] and [`unlock`]. +/// - Implementers must also ensure that [`relock`] uses the same locking method as the original /// lock operation. +/// +/// [`lock`]: Backend::lock +/// [`unlock`]: Backend::unlock +/// [`relock`]: Backend::relock pub unsafe trait Backend { /// The state required by the lock. type State; - /// The state required to be kept between `lock` and `unlock`. + /// The state required to be kept between [`lock`] and [`unlock`]. + /// + /// [`lock`]: Backend::lock + /// [`unlock`]: Backend::unlock type GuardState; /// Initialises the lock. diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index d900dc911149..ed3af3491b47 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -12,19 +12,19 @@ //! //! # The raw API //! -//! The raw API consists of the `RawWorkItem` trait, where the work item needs to provide an +//! The raw API consists of the [`RawWorkItem`] trait, where the work item needs to provide an //! arbitrary function that knows how to enqueue the work item. It should usually not be used //! directly, but if you want to, you can use it without using the pieces from the safe API. //! //! # The safe API //! -//! The safe API is used via the `Work` struct and `WorkItem` traits. Furthermore, it also includes -//! a trait called `WorkItemPointer`, which is usually not used directly by the user. +//! The safe API is used via the [`Work`] struct and [`WorkItem`] traits. Furthermore, it also +//! includes a trait called [`WorkItemPointer`], which is usually not used directly by the user. //! -//! * The `Work` struct is the Rust wrapper for the C `work_struct` type. -//! * The `WorkItem` trait is implemented for structs that can be enqueued to a workqueue. -//! * The `WorkItemPointer` trait is implemented for the pointer type that points at a something -//! that implements `WorkItem`. +//! * The [`Work`] struct is the Rust wrapper for the C `work_struct` type. +//! * The [`WorkItem`] trait is implemented for structs that can be enqueued to a workqueue. +//! * The [`WorkItemPointer`] trait is implemented for the pointer type that points at a something +//! that implements [`WorkItem`]. //! //! ## Example //! @@ -218,7 +218,9 @@ pub fn try_spawn(&self, func: T) -> Result<(), All } } -/// A helper type used in `try_spawn`. +/// A helper type used in [`try_spawn`]. +/// +/// [`try_spawn`]: Queue::try_spawn #[pin_data] struct ClosureWork { #[pin] @@ -258,9 +260,11 @@ fn run(mut this: Pin>) { /// /// # Safety /// -/// Implementers must ensure that any pointers passed to a `queue_work_on` closure by `__enqueue` +/// Implementers must ensure that any pointers passed to a `queue_work_on` closure by [`__enqueue`] /// remain valid for the duration specified in the guarantees section of the documentation for -/// `__enqueue`. +/// [`__enqueue`]. +/// +/// [`__enqueue`]: RawWorkItem::__enqueue pub unsafe trait RawWorkItem { /// The return type of [`Queue::enqueue`]. type EnqueueOutput; @@ -290,10 +294,11 @@ unsafe fn __enqueue(self, queue_work_on: F) -> Self::EnqueueOutput /// Defines the method that should be called directly when a work item is executed. /// -/// This trait is implemented by `Pin>` and `Arc`, and is mainly intended to be +/// This trait is implemented by `Pin>` and [`Arc`], and is mainly intended to be /// implemented for smart pointer types. For your own structs, you would implement [`WorkItem`] -/// instead. The `run` method on this trait will usually just perform the appropriate -/// `container_of` translation and then call into the `run` method from the [`WorkItem`] trait. +/// instead. The [`run`] method on this trait will usually just perform the appropriate +/// `container_of` translation and then call into the [`run`][WorkItem::run] method from the +/// [`WorkItem`] trait. /// /// This trait is used when the `work_struct` field is defined using the [`Work`] helper. /// @@ -309,8 +314,10 @@ pub unsafe trait WorkItemPointer: RawWorkItem { /// /// # Safety /// - /// The provided `work_struct` pointer must originate from a previous call to `__enqueue` where - /// the `queue_work_on` closure returned true, and the pointer must still be valid. + /// The provided `work_struct` pointer must originate from a previous call to [`__enqueue`] + /// where the `queue_work_on` closure returned true, and the pointer must still be valid. + /// + /// [`__enqueue`]: RawWorkItem::__enqueue unsafe extern "C" fn run(ptr: *mut bindings::work_struct); } @@ -328,12 +335,14 @@ pub trait WorkItem { /// Links for a work item. /// -/// This struct contains a function pointer to the `run` function from the [`WorkItemPointer`] +/// This struct contains a function pointer to the [`run`] function from the [`WorkItemPointer`] /// trait, and defines the linked list pointers necessary to enqueue a work item in a workqueue. /// /// Wraps the kernel's C `struct work_struct`. /// /// This is a helper type used to associate a `work_struct` with the [`WorkItem`] that uses it. +/// +/// [`run`]: WorkItemPointer::run #[repr(transparent)] pub struct Work { work: Opaque, @@ -409,7 +418,7 @@ pub unsafe fn raw_get(ptr: *const Self) -> *mut bindings::work_struct { /// } /// ``` /// -/// Note that since the `Work` type is annotated with an id, you can have several `work_struct` +/// Note that since the [`Work`] type is annotated with an id, you can have several `work_struct` /// fields by using a different id for each one. /// /// # Safety @@ -429,7 +438,7 @@ pub unsafe trait HasWork { /// Returns the offset of the [`Work`] field. /// /// This method exists because the [`OFFSET`] constant cannot be accessed if the type is not - /// `Sized`. + /// [`Sized`]. /// /// [`Work`]: Work /// [`OFFSET`]: HasWork::OFFSET From patchwork Tue Jan 16 23:11:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp577292dye; Tue, 16 Jan 2024 15:12:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1J4qPOxCbR/GXFY38ZZFCXGpAP6ay9OCgEH1VpPAk3b6KV6EizWYZYvh11lx92Yxs0RzP X-Received: by 2002:a17:907:31c5:b0:a28:c80e:1d1a with SMTP id xf5-20020a17090731c500b00a28c80e1d1amr2586143ejb.190.1705446725211; Tue, 16 Jan 2024 15:12:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705446725; cv=pass; d=google.com; s=arc-20160816; b=sqQfqpO7zZ7l00G+atTLA03m3w2Rawx8FetKz5rOKnb+XTV+G1VwuXWO4MGDfxRmZf tu8WBaSdEbtrYKPt1v5TgkknBQCcuqVkRWWSlI6fZIcO93m9rSsZwPs9dIMN+FSgh8BE Imephwp0a3Yl6WzA/BW7h3KFgskL9mrE8VwqgAWIw0m7aX9brRAXwiGHC7YCIUChI8B1 +svAD/Q576ctvGIlHoMW5I11kigga9/bOwQGi26L41TKlXHnpKWVA0Sv+lOZEoc8fajY 4WMKy7QfRnz16s2lNsVK5/XZ0MCgOtvBmLrW2m1TgUBDMalwv7Ks4bJXlOUA3NSoZvIN D2Dg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=v2+3Jo/pUjwRlGx2am3nqtNqB8XzanOFuMnZZDxwYHM=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=GF/APWCk56oxJ5ITAbgJCobIRp8Rxjbk6p2Sm3+jnFDxlqvOLh5oL0anCVg9XI4dLY 1PNorOKmB8C1QNFtJ1jOos0QzFviNk9+R46CyQ54pH1iY0ZRl/RUt9jxZ8BaoIhhAda2 Q5RD/dMBcBS2G71iK4JJ+ZlboMhLrIb/jl+40Halzi5Xamqcm8scyAEz4U1ZkOevj6mE 7IPka0JL69W9G0vc276FdRt1vlB56LQwWaztQbF7tYY2paVt0fTz2TVB+/5V7fxHNgn3 f8AjxWhF58e3c4Pf4Zt5wIwmpfEuSJ/diPtkrSaE75ygmQcMD+JvWsA9jxNCJE2A6ExG XbCA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28369-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28369-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j7-20020a170906050700b00a28ebb569f2si5004724eja.763.2024.01.16.15.12.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 15:12:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28369-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28369-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28369-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A4A711F260CA for ; Tue, 16 Jan 2024 23:12:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9FD11E874; Tue, 16 Jan 2024 23:11:39 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (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 965A61DA2C; Tue, 16 Jan 2024 23:11:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446697; cv=none; b=gOpulVKLC9e+wl0plkDFr2CnoZMCulnvR8v+Fa9ULL/NmCv1gd5mA1zyvspYRyVY8WmjWjIA3ERiVWwgwF5VisgKbSvlIqzMVk9xnwT+5UJu8fmt1Jh6IN1ucP9BcF+ENIQUQyBC/T5BC1hKi8uzA1VFpp27DM9XQJhdzqHFjPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705446697; c=relaxed/simple; bh=MGssKXKFpJmMR/MBNNgGqevsBNhT1o85Az3TxIhlZAM=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=Nw9WMs2vAMRh//pqLFcRY4rGUe5S/rrgNPZ8W4JY2BSlIIQwVUiOM6jV3oKp0/TKEKK2uesUn2bQdVU5/qOky50cK7N27P3SecB3FbdA6hMUjWVpvUFdh+N8SFtIbgpRVHqW/SeZmHK0LMnVjTaRUsh6tgyEqhOsRP5K3XvAvec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MWAjC-1reqJ90vEo-00XaJ8; Wed, 17 Jan 2024 00:11:21 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 11/13] rust: kernel: add doclinks with html tags Date: Wed, 17 Jan 2024 00:11:18 +0100 Message-ID: <20240116231118.168882-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:7HDVl5ICHcjvu8IpxbaBi4RT96IEY2WzS7HNpagrRLMKzjKGrrp HNDQsDnObQM5UfrcYAKFPKwKCa5nfWzXvBIhcQwMJ9ILV9sF0MGkg7zqBWx5GBG/DFKg4br w6eGrh4MfDydzwKak28EhlPwcRYRAEDzgEpaXfBiZvigBZhg7xTY6oby3zkYbHY8xe5FyRR EZsHCecWfOGzI74G8BReA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:5/VYKVZVSV4=;5l1Im1o2v77FVLbOqnVkHhisSp0 k7AS8oXGuUvRGhQthNOkF/ZLN3ir5LJulRiGMeaQCTZ8BdgQ6/YkrwDFPI4w+e1AWm9BOaata OwdzxKXhi6TEGb6SXsDir/NhL+ssLJIGSCMeDs0Cy1JrZKM+Qm66e1TeY9I5wggc4oHl2fYJa cFCv87mieIxot1SuDI3up88/WIJ8ZMGdHF5VTMTR2uydvg3Nh4zyKpdEyCMW5CSInX6gGUB+Q 0owTLgdWQlMzEzG7XN1S+fSLi3fBSalsGUE68KI3+KAfs566BsmTMHbF0sq4vscw9to+P3oG/ tHyydKRGmstfuTZqjYX9hPSTBb7BZUiXJsIQEnRtnLB4wDob8znUlmqwAaMYxT2d9osf+Dvdm rolqsi7ke/u/R6L5Ni8OC4HPwMoqAgqOgHs6rzxPIUS7drdvwqQRCPUPYoNodytJxSuBWPYzE Tvet71iNl/dLwjI6KmFwlyU6uAJeGy+49vGe9Zyf8tm9EXn2ixIGjpoTtx7vRiS9v32AZuY2d f/c2lCYKh5BqYnWCO+Hv2v3jQiuTaqGidN2N9kFlV4f3zwsttmUVgb+VNkttlMUnCfIwg+3ky gdRVX69LvhRifswlpnEQHDxbF+dKnlp3XefUiCXRDUkJgWkog8W/yAE1NPRrTVstsGDyo3zNH 9eeik+58hxfoJSf7shMMg2+rtDNoum2MQvMYWKHq8b3oEGuP2XNOLgMDUyu1+e+USqehxJBeT dHigE4RXSqu63/wzgmF1N6GY7poSDkVloE0wyzT3W7EkcnP/glVszmjoG0nBAGtK52wfBnuu2 omZd/jRq5030D5HlJxGpHiv3MHJIG5kurtqQZq2QuE2idwkoTJ7noDkiHxDtD/D4vYz11ub+h Gz4TCR8aGjt+yTw9Mq4WffazeSk724w8ufBM= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788290505695460583 X-GMAIL-MSGID: 1788290505695460583 Add doclinks to existing documentation. Use html 'code' tags to add links to items that cannot be linked with the normal syntax. The use of html tags is a tradeoff between the readability of the documentation's source code and the ergonomics of the generated content. Signed-off-by: Valentin Obst --- rust/kernel/str.rs | 7 ++++--- rust/kernel/sync/arc.rs | 24 +++++++++++++----------- rust/kernel/workqueue.rs | 10 +++++----- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index fec5c4314758..f95fd2ba19fb 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -14,7 +14,8 @@ /// Byte string without UTF-8 validity guarantee. /// -/// `BStr` is simply an alias to `[u8]`, but has a more evident semantical meaning. +/// `BStr` is simply an alias to [[u8]], but has a more evident +/// semantical meaning. pub type BStr = [u8]; /// Creates a new [`BStr`] from a string literal. @@ -106,7 +107,7 @@ pub unsafe fn from_char_ptr<'a>(ptr: *const core::ffi::c_char) -> &'a Self { unsafe { Self::from_bytes_with_nul_unchecked(bytes) } } - /// Creates a [`CStr`] from a `[u8]`. + /// Creates a [`CStr`] from a [[u8]]. /// /// The provided slice must be `NUL`-terminated, does not contain any /// interior `NUL` bytes. @@ -130,7 +131,7 @@ pub const fn from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, CStrConvertError Ok(unsafe { Self::from_bytes_with_nul_unchecked(bytes) }) } - /// Creates a [`CStr`] from a `[u8]` without performing any additional + /// Creates a [`CStr`] from a [[u8]] without performing any additional /// checks. /// /// # Safety diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs index 936bc549a082..5fcd4b0fd84b 100644 --- a/rust/kernel/sync/arc.rs +++ b/rust/kernel/sync/arc.rs @@ -368,10 +368,10 @@ fn from(item: Pin>) -> Self { /// to use just `&T`, which we can trivially get from an [`Arc`] instance. /// /// However, when one may need to increment the refcount, it is preferable to use an `ArcBorrow` -/// over `&Arc` because the latter results in a double-indirection: a pointer (shared reference) -/// to a pointer ([`Arc`]) to the object (`T`). An [`ArcBorrow`] eliminates this double -/// indirection while still allowing one to increment the refcount and getting an [`Arc`] when/if -/// needed. +/// over &[`Arc`] because the latter results in a double-indirection: a pointer +/// (shared reference) to a pointer ([`Arc`]) to the object (`T`). An [`ArcBorrow`] eliminates +/// this double indirection while still allowing one to increment the refcount and getting an +/// [`Arc`] when/if needed. /// /// # Invariants /// @@ -489,8 +489,8 @@ fn deref(&self) -> &Self::Target { /// # Examples /// /// In the following example, we make changes to the inner object before turning it into an -/// `Arc` object (after which point, it cannot be mutated directly). Note that `x.into()` -/// cannot fail. +/// [Arc]\ object (after which point, it cannot be mutated directly). +/// Note that `x.into()` cannot fail. /// /// ``` /// use kernel::sync::{Arc, UniqueArc}; @@ -512,8 +512,9 @@ fn deref(&self) -> &Self::Target { /// /// In the following example we first allocate memory for a refcounted `Example` but we don't /// initialise it on allocation. We do initialise it later with a call to [`UniqueArc::write`], -/// followed by a conversion to `Arc`. This is particularly useful when allocation happens -/// in one context (e.g., sleepable) and initialisation in another (e.g., atomic): +/// followed by a conversion to [Arc]\. This is particularly useful when +/// allocation happens in one context (e.g., sleepable) and initialisation in another +/// (e.g., atomic): /// /// ``` /// use kernel::sync::{Arc, UniqueArc}; @@ -532,8 +533,8 @@ fn deref(&self) -> &Self::Target { /// ``` /// /// In the last example below, the caller gets a pinned instance of `Example` while converting to -/// `Arc`; this is useful in scenarios where one needs a pinned reference during -/// initialisation, for example, when initialising fields that are wrapped in locks. +/// [Arc]\; this is useful in scenarios where one needs a pinned reference +/// during initialisation, for example, when initialising fields that are wrapped in locks. /// /// ``` /// use kernel::sync::{Arc, UniqueArc}; @@ -582,7 +583,8 @@ pub fn try_new_uninit() -> Result>, AllocError> { } impl UniqueArc> { - /// Converts a `UniqueArc>` into a `UniqueArc` by writing a value into it. + /// Converts a UniqueArc<[`MaybeUninit`]> into a `UniqueArc` + /// by writing a value into it. pub fn write(mut self, value: T) -> UniqueArc { self.deref_mut().write(value); // SAFETY: We just wrote the value to be initialized. diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index ed3af3491b47..aedf47f258bd 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -294,9 +294,9 @@ unsafe fn __enqueue(self, queue_work_on: F) -> Self::EnqueueOutput /// Defines the method that should be called directly when a work item is executed. /// -/// This trait is implemented by `Pin>` and [`Arc`], and is mainly intended to be -/// implemented for smart pointer types. For your own structs, you would implement [`WorkItem`] -/// instead. The [`run`] method on this trait will usually just perform the appropriate +/// This trait is implemented by [Pin]<[`Box`]> and [`Arc`], and is mainly +/// intended to be implemented for smart pointer types. For your own structs, you would implement +/// [`WorkItem`] instead. The [`run`] method on this trait will usually just perform the appropriate /// `container_of` translation and then call into the [`run`][WorkItem::run] method from the /// [`WorkItem`] trait. /// @@ -325,8 +325,8 @@ pub unsafe trait WorkItemPointer: RawWorkItem { /// /// This trait is used when the `work_struct` field is defined using the [`Work`] helper. pub trait WorkItem { - /// The pointer type that this struct is wrapped in. This will typically be `Arc` or - /// `Pin>`. + /// The pointer type that this struct is wrapped in. This will typically be + /// [Arc]\ or [Pin]<[Box]\>. type Pointer: WorkItemPointer; /// The method that should be called when this work item is executed. From patchwork Wed Jan 17 00:15:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp603800dye; Tue, 16 Jan 2024 16:16:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IE14Oaa0miXuQN7LhT87dfNqf9idd9s8HkCvXS24XcJTvnNgsHQOkbBXHYuULUj8j50fSBl X-Received: by 2002:a05:6214:f2c:b0:680:c6be:d728 with SMTP id iw12-20020a0562140f2c00b00680c6bed728mr8934555qvb.77.1705450612615; Tue, 16 Jan 2024 16:16:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705450612; cv=pass; d=google.com; s=arc-20160816; b=i5wQNWXrFdaX74roalQJq6+aXkxv7y2woVU0+0js0XiiI4wb0WQvqTD+pos0L+w/YT XIwk7z0db8w+7fjN8YBcpg7HqMs3EBIWqEq4v37yAW6lLBjhJsysdTyk4JAFNdsq+Xi3 6fp7m9j8AXgnquZIdRg1q6n5vKtmrkDGk86cwGhsnvbFSHfuDAaNvZPrt2ac5SIrMGpC ee8zngCPO+Phi9REoiG04okeCQrABrfEO39/qaWWT877ntXZ3eTgj+tdwdBEg0vJMhzt 7JVtXsWOe/GkyH7zwzdEFa4i5cJPvtjirUJoKpOMU5Lw216PHh8kZli5p7OJmOSDrN3M m5Pg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=koZ/omgcAWPmX+qMKIMuWUdAWHdv83qx7zqquGY5qlo=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=BHaIGHlFCDFmkZRwNDuHfUslXbUgf8fUNFeWA06JMI83A22Mxc6MdE9O21MDh108Ge b3gFEsxpAxyxuCBHRNttaBtdAm8dcF8mE2CqeUn9LijRBXH3yVOCUhMwmYIJ1p5ERV/d b8NzIn9Do+yeXfZMH26w+rnc2taLdrMXY8+TSJzX/4TkYtE5TJAm4bFbAc2v7ONbF3lS 3htM9ie7GqU4okhJDFBWinjp4b8pmOrKxAHwXQJk3pxucUuud8KkJa4g6t76X3wYj2GF VRauowMGiGghnYDkREN3eR1Iy97xCza08TP0H4nzfx6wU8x9gXPqWI4fWxGf84TQd0i9 yNwQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28392-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28392-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y10-20020a056214016a00b006816d1e04b2si2101731qvs.129.2024.01.16.16.16.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 16:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28392-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28392-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28392-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 687CF1C24B11 for ; Wed, 17 Jan 2024 00:16:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DEA2079C2; Wed, 17 Jan 2024 00:16:21 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (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 46C1210EB; Wed, 17 Jan 2024 00:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705450579; cv=none; b=hPKlkagP6CspIGiOf819QTawQBc9kS7/XvmZJtShOnKKkgPAkExysm8w3hW+vdT17r4I9Xva62wJhyZPFDPhLOvFEblfobCSj8aLhruNnoyX0TGteaqZ56z3eBks3pkadEM/jp0znRxaUCmOojzJ7KS9Mksb2om37Cb+HCI7xSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705450579; c=relaxed/simple; bh=29I8vQfcBLV9mwZoRiepEOKD8CS2T7TWmyPwGLAV5PM=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=rf+0Yc6A+iMBpywfkuvvFA0ZMAx0ZVj4N7nWvoovex3D7PNEYEV1fujNTk3tnS17U8jqaGa/pJ7pUmB+q+1ndYDbAJFy6DawodEQHXywTdyKomRRW+Ap4G/ZXuw4ullBl/yUG3TfgQOjfTbTAmUhk7+MxeulXy4+eLIfFlEHBiw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=212.227.126.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue012 [213.165.67.97]) with ESMTPSA (Nemesis) id 1M8Syu-1rUHJq0QJE-004Wpr; Wed, 17 Jan 2024 01:16:02 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 12/13] rust: kernel: remove unneeded doclink targets Date: Wed, 17 Jan 2024 01:15:49 +0100 Message-ID: <20240117001549.169160-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:vKGsVDD4K4O8G0nQOnjmofp4+nIqOjtImagczD6YhwgfOa9ZS0K rV8quU1oxXtmNfI51VhLGnGngF55lx7+qIxTZLaYsSg3hjPOu4jdtXD3cCoqjNH+406CRDA Wgyvd6R06NJKSDsvdRJmyJReq3nixPvkDwGgwbJrSvOeYDwnM4ld3s1pEzILJH24wIHFAlB D1n2qF/b8uNVv4bKpxiZg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:3OczPoTzmTE=;S9W2oLrRDxGvXikdidPbco6b49/ iSusBm28Kp+2/S9krGAq/FWrQGGIs20nsXeQlDr+QvLPy1tZRtCQ5Yfg5adWgUi+BsVyM1+UH qotwLO6DsBzpuIlpHX7Ah0zYRgEk7H+qseieip9BYHgI7T2jg2T3OGrxXLok3IS+8qpSq6c1a t7oLfGyznK8sBC7we2kIcU9X/dKYmPJjTXstM+IZMvruddlJ2QuVe0IXHXIuKF9E03bMBw3Mv BRRA4TG9ZrbwIxJaZi2xE5zGytxJbw/Lcxvd/AZ+XHPqyoZN8KNnuQe2C/kgs86wUT1yBqBgu D3kDbVyzV38PhJiCvO/HE1+RxH6ONae2YXx1miUdl2UrSBi06jejPskoAhAr+CtlnYP8v9fAs PVdZyhCpdqHn681TZjqsRMAcwxYhD2nPpxGBtHitHa9KWUnwgUQYcWVcbaetJbeH6uDYabLmp 1otc6pYhxA+H6cGBRCGOVqw86hFssHkGUaI3cSpGz2L3qhDLkMZ0DxhLuW+f3MX4fYyfOGt0O eqAbIGmsgFo3/3J99SWk+6X8XU46Ir0F04QADjJgm0ADyrOviWzi/AALS4ObAiK20FxAEPFkV KubovKd639u8kp+sxkd4C3+oBb4XEc+ii5D8V4mIn9abVGdc//vzxaf2joOHtZieV1mH7yDEH lzNsQuRTFNu5DXn0HexkjqjBjy+p2Z57i5tlmi70hSk0O2Rq5HIFYbJU1rm6bCKxqwYFUvQSK V8Sn5s6bNkv8nFpwpgOWdBNTn2Qx7cfWbxMFVJ29MmPIGSZRuaVGg8+bpXDpBEpAiV+OBaaL8 CBZ5Kpp4WVEZSsUJZD3Oz3f/Yj3IFTpNrtVhZjbmfVhBjhbRmQ0c0TQwiV0O1+Q9HE2z5Dj0M /yYE8HCuQPWuAcQ== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788294581295437025 X-GMAIL-MSGID: 1788294581295437025 Remove explicit targets for doclinks in cases where rustdoc can determine the correct target by itself. The goal is to reduce verbosity in the source code. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/workqueue.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index aedf47f258bd..f63190b563d8 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -426,13 +426,10 @@ pub unsafe fn raw_get(ptr: *const Self) -> *mut bindings::work_struct { /// The [`OFFSET`] constant must be the offset of a field in `Self` of type [`Work`]. The /// methods on this trait must have exactly the behavior that the definitions given below have. /// -/// [`Work`]: Work /// [`impl_has_work!`]: crate::impl_has_work /// [`OFFSET`]: HasWork::OFFSET pub unsafe trait HasWork { /// The offset of the [`Work`] field. - /// - /// [`Work`]: Work const OFFSET: usize; /// Returns the offset of the [`Work`] field. @@ -440,7 +437,6 @@ pub unsafe trait HasWork { /// This method exists because the [`OFFSET`] constant cannot be accessed if the type is not /// [`Sized`]. /// - /// [`Work`]: Work /// [`OFFSET`]: HasWork::OFFSET #[inline] fn get_work_offset(&self) -> usize { @@ -452,8 +448,6 @@ fn get_work_offset(&self) -> usize { /// # Safety /// /// The provided pointer must point at a valid struct of type `Self`. - /// - /// [`Work`]: Work #[inline] unsafe fn raw_get_work(ptr: *mut Self) -> *mut Work { // SAFETY: The caller promises that the pointer is valid. @@ -465,8 +459,6 @@ unsafe fn raw_get_work(ptr: *mut Self) -> *mut Work { /// # Safety /// /// The pointer must point at a [`Work`] field in a struct of type `Self`. - /// - /// [`Work`]: Work #[inline] unsafe fn work_container_of(ptr: *mut Work) -> *mut Self where @@ -495,8 +487,6 @@ unsafe fn work_container_of(ptr: *mut Work) -> *mut Self /// impl HasWork for MyStruct { self.work_field } /// } /// ``` -/// -/// [`HasWork`]: HasWork #[macro_export] macro_rules! impl_has_work { ($(impl$(<$($implarg:ident),*>)? From patchwork Wed Jan 17 00:16:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 188652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp603925dye; Tue, 16 Jan 2024 16:17:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgQ4OxbuxwEhK5/C2PJKqtrvVP9aqS0p8zDEPWl9RgB9PN6f9+Yhyr424kMcl8njquNPnI X-Received: by 2002:a9d:6c83:0:b0:6dd:ee09:8da4 with SMTP id c3-20020a9d6c83000000b006ddee098da4mr6315716otr.72.1705450630833; Tue, 16 Jan 2024 16:17:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705450630; cv=pass; d=google.com; s=arc-20160816; b=UGMWseNDLcDYLJgVNBCfYPDqKb+XvHkUVzizIAjFjMLHpGofYe/3GkBNinYoRzv8W3 ItJX4zLDEiOOERSYxSTQqOkLkPNHu1LNk/2Vl4nvcDzadf01bc3kicW3Hz0PicfvPFSs AiAeNOODEgTEqIjkHB2JtYAJv5DGG/1iNOhbhq78SUH3vWuxo2utWwduZiZky37ZBQ91 W02DFUF/Tb/dsu1fUC7zTphHBAvjUH6G5GAf5g7nvGL96mxVaDTe7PFr1KjZfZAYq0D/ hXx/Uf1g80cdbnx3R14Hc4pGDMhvvAL/J6fmIRt14Mr0ntUG1Xuo5z+bgR0KluzDnfCP v4Xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=eAafLrZMt+IX39xANKceA5pnEILMFrr5Zc9jCJc5ejU=; fh=mB5qiQ7ps5IWvjuQS9+zcxjK3ZInVolb8UwIN1mvAmg=; b=hdThQ/Twyl7Gu1SjuRm8f38jYKopoZxDXJyo91svJ9ApO4sUrq5ImdJJVzSNLfbi8y Pc6gr/eLFTkJ8XELmF2Zfb/vsR+ZBeG3XgfdrGBDq8I6H8M6Mgi3LxhV1zW8paQImIed Q+viDocbSTmChqnhVWJre1fimiNo30J30aPoiJic6nlpRpaLoL6LBBWKGv6ZPWcG8p3C 1vgDu+hyx0GvVQQnRH8EzBeoIVpq4kAWqbEvE2i3ZDTIapsDXGwvGbLQSu4jWLBruSt8 z9s5K2sMUNZpxJolbTnxAmHUnAJ0XF1VKX4h+nku1UTpnMrC9MySyye5SBQp8lzr/IQX rfig== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28393-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28393-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id p1-20020a0c8c81000000b0067f69d54b26si10380922qvb.572.2024.01.16.16.17.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 16:17:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28393-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-28393-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28393-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9B7D71C24B0D for ; Wed, 17 Jan 2024 00:17:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A49E8F5F; Wed, 17 Jan 2024 00:16:48 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) (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 B653B8468; Wed, 17 Jan 2024 00:16:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.72.192.75 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705450606; cv=none; b=c24HrX3yuz4SofgVTMt9E8GhRSSuayoJuicx2GnYfa3kuusn8u0jJNKyydHGxsvJf05cYtXGCS2UdDWpMQGvwA0abf4ldKBqt32uQJ+AoiWeAv3fVPWVY5ZjNn7ao/4h/ysIf85I2cjMky9SdAqtFFKRGYqKp6SNIk5j5AQUl6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705450606; c=relaxed/simple; bh=hvWv/gsA+1XA5/ae14NG4bJ38X5ybqAzDv+NJAAUJFs=; h=Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:X-Provags-ID: X-Spam-Flag:UI-OutboundReport; b=cwvrSLSkY4nSdNvt7ugnaTLNycZ8DOd6k79Dr/oUEs8cJYzUeCmT0xEAYOfIPFiLn9j3KAPdhAo0GZ1+vHh+HlTWLWf2Qis+VAE9rX/K4qoz9yGz3o4JxPwAB2e+R9y7g73DDT/dtzkmBNaEA4c5hK61LRNWceBfmgPLhpCldRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de; spf=pass smtp.mailfrom=valentinobst.de; arc=none smtp.client-ip=217.72.192.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=valentinobst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=valentinobst.de Received: from localhost.localdomain ([217.245.156.100]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MQdI8-1rkIGR0kJ4-00NlUi; Wed, 17 Jan 2024 01:16:21 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst Subject: [PATCH 13/13] rust: locked_by: shorten doclink preview Date: Wed, 17 Jan 2024 01:16:13 +0100 Message-ID: <20240117001613.169177-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116160141.165951-1-kernel@valentinobst.de> References: <20240116160141.165951-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:P+Wtzs9yqXIZYrvFo9hsAvAB2lek5+pAfAMb7c47Q2gbxEq9JQw tZqu5SlmeG69/pBfzK+Ywt2boBTUKjUq/8PDGTdyMbiXg7r7cNU6ZlQYUgSA14R7lUTSVu7 hvLtW6AuECZTB4xDT0D01Iln4xKsWVEeEQdehN6p2+XAupqh0LTaHEGs5tUYWCLq95yMFBh Coc/vrsct7Ow/R0/4SM/A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:dsSEASkNAtk=;LD2yuxK41OjMV0sSEd4SU39P4y/ OxIG8uPb5vZNU/rpA/U6b+YJw2QI4njvG3acQ47b3Kl3hidgYYuftWvO8hJoBkLSvzQlSMq9k 27EBcoOAShXtSGuMFynffFK8rNZRX5KYOlmraaO/1J8/YOteBQeHimF7mz9quakj9pD7nGkYN KpQLL/gY5mOXnugxEVfRif3JGdPyZl/TcIfl2ogvURVcRGGBNDRFY9eqCARwoAIlKHtdMxHkb dY/rBbo3o4U+wuMADJT2VS5VWXzXqDL70WMl37D1BBMAjEKuA22vB0rUUsnM85lqrISmQuOaq ML9houAAZMW0il42Zw54SmVRMVtqP2o5qXLv+DbR6mx/GLdDnobhXtCaNzLKrIcUwtS7vZVRp QoG41zntmEaKBgkgt19gukKYKQcM/vphyLpPCi9F9dmbK4ivUGIK5mIGYyTYc7D9QotRtUjEj 49EGuYOVFj107ooTaGyiqmvaUYvUmja82EnryQua2nuIbqWC3gHdoIYeQ3IwCMGUm/y2biEMS gl8jzHy+KSPyPPzb6pjS+BUGNncGzELzItuP7F1yJKcTJXpXIQLcJUzn1YhULqbdeRPn7ZvmF oHtDu6hw5aSK2bB+Sjwm9dlHuCjguH2gEniBoyWC9uhOK6X2fyA1qV3NkjhkKO/vEecOrM/XQ gZ3IReFIBCcnGNzorz8EfgQAcpkj1JUrh3z3sqNEI7mjBXr/i99ErjQoSOs9LA78YlH4tvd22 Lk1SAoFl7BrZZFOrCLgZxZckzNcD64Syma1EAmgRK5KyQKMuVM9xo6oX+4wSkfP1JO9IwJkcl pwP5rt3eo4i1326GkspBxuCDsVFPNzyQ1fW6S4+kl6DIe6eW9FD2aFo6zkWagwlqqZIybHiog 0HYV/lU0w7ra7jA== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788294600532611482 X-GMAIL-MSGID: 1788294600532611482 Increases readability by removing `super::` from the link preview text. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross --- rust/kernel/sync/locked_by.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust/kernel/sync/locked_by.rs b/rust/kernel/sync/locked_by.rs index b17ee5cd98f3..22c38993bf63 100644 --- a/rust/kernel/sync/locked_by.rs +++ b/rust/kernel/sync/locked_by.rs @@ -9,7 +9,7 @@ /// Allows access to some data to be serialised by a lock that does not wrap it. /// /// In most cases, data protected by a lock is wrapped by the appropriate lock type, e.g., -/// [`super::Mutex`] or [`super::SpinLock`]. [`LockedBy`] is meant for cases when this is not +/// [`Mutex`] or [`SpinLock`]. [`LockedBy`] is meant for cases when this is not /// possible. For example, if a container has a lock and some data in the contained elements needs /// to be protected by the same lock. /// @@ -17,6 +17,9 @@ /// when the caller shows evidence that the 'external' lock is locked. It panics if the evidence /// refers to the wrong instance of the lock. /// +/// [`Mutex`]: super::Mutex +/// [`SpinLock`]: super::SpinLock +/// /// # Examples /// /// The following is an example for illustrative purposes: `InnerDirectory::bytes_used` is an