From nobody Wed Dec 24 21:30:36 2025 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 DAAB112E5F; Tue, 23 Jan 2024 15:01:33 +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=1706022096; cv=none; b=hA2mXDbFSliBWuYO1NDaF/KQRmmSas+OMZTa5Gb9aOIVw2KX1IUWpJ9YU6oB5ft2wxSrafPP9QIaaGligTDAHI4td74DmXxTPclxF92tZVZsJb2JyOq1xLiKpJ7y482t3a4VeYgxL1E6Nz9IQEQMQred4tq1Dy6Tzg0KnstXDNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022096; c=relaxed/simple; bh=aS66R/O5x9YNSVV4RmvE68N8cZ4eNwOcTYx8xWcTcYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Js3wZw53/kdJkJ2u6h352wQICA+MNw7CW3FnNGIXREBZcL2gwAoF/0mlRvfm/VXzX/hCF06zWn6YDBoTkKMNJhruZcnL6z/n2bQV0uLddrHieL+aTlpL4nPN8z5QWv1G5MAudva04p5E5B6v/zk2Kh1k1StMX/fSYYuOzKvwTYU= 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MRnXY-1rYJtL3piE-00TDhk; Tue, 23 Jan 2024 16:01:14 +0100 From: Valentin Obst To: Valentin Obst , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Trevor Gross , Martin Rodriguez Reboredo Subject: [PATCH v2 01/12] rust: kernel: fix multiple typos in documentation Date: Tue, 23 Jan 2024 16:00:55 +0100 Message-ID: <20240123150112.124084-2-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:qYzLBBnAeNINpVPZ5qptSa+mZHr3wYD6F/tVTzjxUqW+HAXk1le 7kbSUqopDsgxmqF59ZfobvP+1riUqZBqpAVRcf321Ac16WDctrV7HHlUkuRNEqkGcBl5nVI 5CmilrZ5wP1TPt7ClX/RsioomXMOVXXNtwimSZ5Md1EhiqiWLRRAKfRnuDEtSdNOtww4jxL TQX57rD+b2496XcqMFUvg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:dPExryj3cg4=;73XglDwUupDIG0mgSkIH67B/gTy O/WyR/0CL60PxoPhevjK0MyftV8SV3ayWUt/sP5K9PBwHs5U45ad/Z0+buZcJKRL0x4na+DFZ fVcEpf0n8kdl4DyI00mTsaki0sEkXZPpazb1O0iQtffgCEv/x9J3I1d6+1SA1V/4MNZTMfs9d eXxhvZEPOeBJi8hfgoaLiPeZSs/thQlSZTfxIokjKWsEMChf2QuQlcewit0sNqgc6gP4Jq62S 3a9Gh75ePu/zqnFf77sVsRB88RsXkW54+dgQ8ph/3zGnnBD/JQ1xcHWbcl1LnlqOHG50CU/my TgZWx+K02lZcJn134PiRWxk54hWy+D+DFxPVeODMffHAphLdSue3NrbqLci5iZTL8mIy9vNdO lvre/YqFf4OUV4QFRSUvZjIpcwBhs0XGdQyf5XzRsq7K/RbG8bZ8LNaRo6Px3TV6FkD/2arFh c5qlwHe6RGG/Sr2yUOemoX9KVEn4V7cih0GQJJQ6deHX8jslDKYouqifn1Ss8z1AB9expeJ+X Mwj1GPhZ0RS78PoTRIrcXWr5Z3fy4BU8p5cxrKydOR3ExqyUvygYkrgvu6NvkS3l/dIjE8MS8 w6rWKUnj2dJtpxZb5xiH2Suwmp/u0FArgnvraFgfjSnlomil88OCLwfo5HMCC/6xCscqbm6D+ Yd9qSLY6RqySrR7L6GrnQN+jCDZa5/dyY2zTrRhWmR3H+5u8SfhgJDpryQODqYHLe/KV4XTu0 RLAQWVxkK/x9T6PmPI9lDKNnP3N5EKqFFuf8UWPxP+cJySgYDH1Un9VobA5hD/Ts+4cV5xhvJ N3rJundIYq4N+AbAM3l7EbH6CIFYFcN3C4Y8pC1afW7d4UqNeL87APocnZvF6AvvZYyLevtUD PVsl34NVKETKduA== Content-Type: text/plain; charset="utf-8" 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: - Fix a trivial list item alignment issue in the Safety section of the `Backend` trait's description. 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 Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- rust/kernel/allocator.rs | 2 +- rust/kernel/init.rs | 16 ++++++++-------- rust/kernel/ioctl.rs | 4 ++-- rust/kernel/str.rs | 2 +- rust/kernel/sync/lock.rs | 4 ++-- rust/kernel/sync/lock/spinlock.rs | 2 +- rust/kernel/workqueue.rs | 2 +- 7 files changed, 16 insertions(+), 16 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: Layo= ut, 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()` (whi= ch 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 `n= ext_power_of_two()`. unsafe { bindings::krealloc(ptr as *const core::ffi::c_void, size, fla= gs) as *mut u8 } } =20 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 the= re are probably very few +/// When implementing this trait you will need to take great care. Also th= ere 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 the= re are probably very few +/// When implementing this trait you will need to take great care. Also th= ere are probably very few /// cases where a manual implementation is necessary. Use [`init_from_clos= ure`] 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]>=3D Box::init::(init_array_from_f= n(|i| i)).unwrap(); +/// let array: Box<[usize; 1_000]> =3D 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 drop= s that many elements from // `slot`. let mut init_count =3D 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 a= nd 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_mut= ex}; -/// let array: Arc<[Mutex; 1_000]>=3D +/// let array: Arc<[Mutex; 1_000]> =3D /// 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 drop= s that many elements from // `slot`. let mut init_count =3D 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 a= nd 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) } =20 -/// 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::()) } =20 -/// 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 _ } =20 - /// 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.rs b/rust/kernel/sync/lock.rs index f12a684bc957..87e111c0da17 100644 --- a/rust/kernel/sync/lock.rs +++ b/rust/kernel/sync/lock.rs @@ -21,9 +21,9 @@ /// # Safety /// /// - Implementers must ensure that only one thread/CPU may access the pro= tected data once the lock -/// is owned, that is, between calls to `lock` and `unlock`. +/// is owned, that is, between calls to `lock` and `unlock`. /// - Implementers must also ensure that `relock` uses the same locking me= thod as the original -/// lock operation. +/// lock operation. pub unsafe trait Backend { /// The state required by the lock. type State; diff --git a/rust/kernel/sync/lock/spinlock.rs b/rust/kernel/sync/lock/spin= lock.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::GuardSta= te { =20 unsafe fn unlock(ptr: *mut Self::State, _guard_state: &Self::GuardStat= e) { // SAFETY: The safety requirements of this function ensure that `p= tr` 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 i= ds for different fields /// of the same struct. (Fields of different structs need not use differen= t ids.) /// -/// Note that the id is used only to select the right method to call durin= g compilation. It wont be +/// Note that the id is used only to select the right method to call durin= g compilation. It won't be /// part of the final executable. /// /// # Safety --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 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 4181A12E5F; Tue, 23 Jan 2024 15:06:46 +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=1706022409; cv=none; b=uTklm1Xt6HWjJLTX5oWZTaIT3FA/FgLmMYJSCFl0dkZpSLPof2SHg2OYEIo16hza+c4BZFheAnB1UI8EDFS+N4mwUjSBTWUExk1b97w7oW88w6uVvMUdYeLArIB5kHN5UCzBJ7e7aTDW/ry2KjEpQzXKJZUTuL9eE1o4mb+6+d8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022409; c=relaxed/simple; bh=GJpHxUZgsNOhfmPXN34zV/Q98aBhZ3HJz6NyPTVit38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FkXuRXvImUebQZ6n42eebEJNsFYRTrM2GK0i9Ce/mf3GwIErZST4ZIA0ab16I/pltSVHrdvy1BxDaPljxcdC8VJrWFKt5RHx+3dXdpoDaU6mWMhAvETvWDQrXf29uaLq1oVfbvsjKeYpL6TlF3LSC1hYYzZPThwy0ngQlOKhk6w= 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1M58SY-1rRBoU0iHs-0019EA; Tue, 23 Jan 2024 16:01:14 +0100 From: Valentin Obst To: Valentin Obst , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 02/12] rust: error: improve unsafe code in example Date: Tue, 23 Jan 2024 16:00:56 +0100 Message-ID: <20240123150112.124084-3-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Q+PbWlm7KEzwAudMeK/POSxJ0Gg1YImwqbrj7gPCT82nZXIj3fG 7AfXr+IptD0Cih9eO5OzAntJyQIZgBwtDaJCuRzPjMpsXmTWNjeXf8Fs2+rYCTnHmWxZzD+ FTHZ1Yuqo/2KmNQxlVQ0X8T72noWnsC0uUR9D4xk2zB7Tda3wxwCg/svSWAPw1KseRtN+F6 X5bdASho0EGGX1Ixtvf+g== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:nZMX7QKu8RM=;9wg1LjzrIzOfvtQl6NTqB5t+lrV gnjeJjD4gZJCPDuJQeVBuJrQBtA9H41Tk4bE9JB0E/o1PwDUzyGuWZCzv0nnIR9ZN6Iq9yL1m 31mZ3WuRKfSjBs/jtwUXPhMeg55BEfFAoaO1ehsRxI3v+nZ8aa9KEP9sMvuP8hwHl6NaXBIsI ZYCHWmdyh8xX8bUNuKqeIcErqriGfaB3zByDrOxQOWkirbDw1KeP1KGApqq86LFgzVKxcmbqg cJAvG2INIV9Y0BRGGnGGcM6PNUfSKumr49w2lMxNSyRLxGthcv5Zj8bfo2hpsHhgZ23lgeH2E V38a2lEdv/DcqIz8xilIqWGqFrdyz8v7pI8d4+Ut4p7QNaCDhER8Lo/xomz+5kK1i5chDo6Vj qDnp38VP4Hsa/w3ozeY2+gj1EDcs0qUiSxxq0FiMWkzyJSy/NHeKWHpNsy+e3A27KNFYt97Vl dTu6sWqv1JmFbzBoJsXE3etHdtQOA9gD6qt3D3VK6o1ED4seIHAXLYNmheeannXgDuFLa/yCH 3spWjbVo1qgglqi+2CvNf18f5t65o0wDMj5rR8FW0eRAGfqXaSCj2CqW7qeeJkYjXeVtVdS5t TlYz55bnuajLjCM6Df2Gzj5Dt9gU9PQjU6Ar0TQSWwiDV83MSEDvd+a2rNzL1TNxoK3HD4LZe w+KPhA9PZP2n/yNP3x93wGbAGsIqoIGP1A8ur0MoJTt7p2QpakEGidfEoqGYFlc9yaXqyysuC 8ZEGHiU3PecJ2lZapfZi8i/bQqRa+3AOg/zHYi3UltuLGSTauHpfn7dlb5c0SB+duc9Fd+mEK s2C/e0/H1ReFSISRe78mEIyrXbU1wZj0wVxSpcVSBsaloNN4XilijjeO2Bctzdtva2Z8p0wUS ArN1lES3KKjg3rQE+EbPLyEGISKvQ+0mNFyo= Content-Type: text/plain; charset="utf-8" The `from_err_ptr` function is safe. There is no need for the call to it to be inside the unsafe block. Reword the SAFETY comment to provide a better justification of why the FFI call is safe. Signed-off-by: Valentin Obst Reviewed-by: Alice Ryhl Reviewed-by: Martin Rodriguez Reboredo --- rust/kernel/error.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 4f0c1edd63b7..4786d3ee1e92 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel/error.rs @@ -264,13 +264,9 @@ pub fn to_result(err: core::ffi::c_int) -> Result { /// pdev: &mut PlatformDevice, /// index: u32, /// ) -> Result<*mut core::ffi::c_void> { -/// // SAFETY: FFI call. -/// unsafe { -/// from_err_ptr(bindings::devm_platform_ioremap_resource( -/// pdev.to_ptr(), -/// index, -/// )) -/// } +/// // SAFETY: `pdev` points to a valid platform device. There are no = safety requirements +/// // on `index`. +/// from_err_ptr(unsafe { bindings::devm_platform_ioremap_resource(pde= v.to_ptr(), index) }) /// } /// ``` // TODO: Remove `dead_code` marker once an in-kernel client is available. --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 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 AD46760245; Tue, 23 Jan 2024 15:01:39 +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=1706022101; cv=none; b=uCMDAoEf9yenPE5n2/tAtL52NZ72fkXvDZHKJHZBsYH1fW29hRPttrZcnygOE06D8EQB15FKipkw9GW8aJyL0p0VnqBf6rLUf8K4tqKYR3Wl1v9Ec+ZV9L0XJUrpizQmFjqUATj/W+oqmj689D6SLtxfguAcCiZVjnxlEOjfj34= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022101; c=relaxed/simple; bh=LF/Zv34rP0TE5uHznHjOOjgOXrdxlJsgqn+hUNEhMoI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SRxKshKnEsUOP07fnkcaf4ruzu14F0RU5PEuo+Y4QmZP5OTjUdXLMgB2Ip7NfP1F7X9DU9JDCoWifnbZoXVTNvtOJILXJodsiVcu8gLqyNRzzsj2i6NltI6ItS5+Ru80K6jeyKzXx0qlJcxQpKK81Xr27dqJsTmAesg//xX//2s= 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MN4qp-1riRiR27oT-00J5cR; Tue, 23 Jan 2024 16:01:14 +0100 From: Valentin Obst To: Valentin Obst , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Trevor Gross , Martin Rodriguez Reboredo Subject: [PATCH v2 03/12] rust: ioctl: end top-level module docs with full stop Date: Tue, 23 Jan 2024 16:00:57 +0100 Message-ID: <20240123150112.124084-4-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:LS8V/WWp0eE5kmG//AQ+zgNdRy47Aut6zKjHjLeqmqCGTjC8pGr suiRKm3UGQBBTU9SwUO80B+kkBoQo2RxOjHPRPO60Wb9RkOwZeIuCmwaOCEVXQ1U3HMthJh NkLEG+4wUd9g1Y+Jq7IwOxx9yGZXYl0on+HSZD2lniaxZ2W0LmexF9+2ucDjIKwe3h7rWMr joKZbs7exEFVR1g6XP/gQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:IVt1gdfbCUw=;D7Cdf2hPORWC49VRD1JKimfhVyw XdoPcv/c627eVnruDfSUv/Zkbi/3UM+OxLOe6AUXPx8zuBBcgR2cKx9fcGZhRM1BajAozi21i c5c5lc7GYW237lwlosyeaBx5iz+tEM39wuR+gLBtUTiUHgOK56EDzUO+Hc5q9AaPWZ1OAMv6j gdw5FDLDP5rmYhMvwS2uOgfeaVzF9whg006GGRJzDq1OnkVN2Fg7JF4rkTeXgHbAo+yh8BhoH p40f0noPJf48EbwYnX3c25wA0U+Dp7f3JTErg1+ChbCh1bTa1TzHRPd2HRxZrx0yJ72gGBJy+ NTG6znYp3ehfBq60RXWp8IlDvGW63YZKkrWT2+YAoSIrdKczo2/PPgZZOIZQQhvQMvAZ7SVtO Xfnochw1vd+6/bDw/eJuNK+1AT0aTPcYXmQ9RivGLcE0OdTqlrRmzkfI/8613thK+ssFvwWkr MfozngybxNS8+wMEKkW5gWSALd3e96XYs+58dcraU/VNULJyVpzUA6EOvPzpV8SNF5GfBSzmv kCu6pu5yyHvWppZ3MkA4C+qkbjYTjmiuoweeXN5N6n3nqmTMTT32uR5eKkatYrM9gTLyoFmC6 /x7rj4id2dRW2s9x8F4S1h7TJzKkx0IqmOJ0/h36hxEPjDkuXA9wl9kwbQh+aWODs7mPztT/X TbwlHpGp46g4huZGXvCzMJUmnjbwC83TtZfBd+2IRjyHBtmMoA28qaPGIcMXL0ochSlNfdhSI vsILYt/eOZwJ3eZv4wGknIN7PGTpRiPe8q715Xfap/5EbhPre0Cbj57YALgN4c9y9Cq8J1Qel 2bDfpMwe4/9rQX+lvWj9k+Th8do/2Bf7++wFQyfGwD9q240YpfLoRiS5iqicR6zfEs5V5f2ls x4chgwrcxUFR0gQ== Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- 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 =20 -//! ioctl() number definitions +//! ioctl() number definitions. //! //! C header: [`include/asm-generic/ioctl.h`](srctree/include/asm-generic/= ioctl.h) =20 --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) (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 85E605FF19; Tue, 23 Jan 2024 15:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022101; cv=none; b=eg/dGrIu7UyIX1uDIeSrcNXr5mRAByKNv544xITWypEI5ghAeuY3Oh15lod6/XWObizTxi/HwobqeUuwvwolhxo3p/axMOIHS8ZgfzU7B0QHAYJTho+9VhjQda7nPX2ILub5ZWlLL9Iz+9beilcOW9RhHD3qPh9ORgYUOh0DRdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022101; c=relaxed/simple; bh=fhb/oh2DjO5i4p0NG4q+kRApXIkNKfH08q5C3C9RYOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QVZx+ooQaqhFxRH5B/ni0a5rc6aURYTMXO22LEHPxtqlAZk4yHyqt9qAjsMW/fNQKbhqkE47NiD5Qjg5Gstcp9mhWrJn75A++ui5cnJxVf5QI3o0XVSECTqqmR+Mnu+4O0+y0Vv6qrDhByt5MEoRCcgODAh/AJUB/BWRQG2pTWA= 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.10 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MI4cT-1rLz8X3v5r-00F9jd; Tue, 23 Jan 2024 16:01:15 +0100 From: Valentin Obst To: Valentin Obst , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Trevor Gross , Martin Rodriguez Reboredo Subject: [PATCH v2 04/12] rust: kernel: add srctree-relative doclinks Date: Tue, 23 Jan 2024 16:00:58 +0100 Message-ID: <20240123150112.124084-5-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:JNxLmFOZ11mhsC9TPd49E2fYhC9noTIOCRe0QaefZ6t7OyfdHYO k6RpdFWbgiybeZUzEbt98mN+SQa3F8eAchgM3etm5HkWQpBMPGosbBU3EuQDx91Xp5BE7YY vcsOavOyksbhiM6QDxPRd68CCG47H39jtjOPOI9MkdZaQ1b9LeZlM+bplCvu0OQgEfJCy1e yGuIfusl5sXPTiL/42Lrg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:/peIACBikaQ=;YUH0Mo4Pgui0DLgpUsdRwjU+mFi GDpqTkT6icNR2B3R046uoI4cc3VO9Z1jNEgTYPzs0OtS7693C6kROn04grWKQYZmtMu9CrXDG wsYhsxoJ9wG4+fm+PeoKMeQfZs8sRj5XM7EOcawu3UUZAUYcw4hBEy6exew80vKIUUXa1RSas XxZJVyr9148jZD5Wqp1U9IodzAi190ZowAGkZ8vdEEvzGc0OUdqetPDOOGTXifbRbx/L2BuG2 I0/R7CI1Ipoyk1GwmzOUrR09vEtMruoYHqlfJqMQn++GW41sVSSHX0WaDlhndcj07od0ieCDr PeTd+WuhCARItcuZpshU6i8bqyUgRCd4P3ef3n1w64B+CVtoCAccaJyQCvclAoseZkKw4jM8n mzHbat1AeczypXnUYYzoDR6/GH6TJpbewzSIII6VaMOPCxwwDVmrymJPiejSP8q1S+PU0P1g1 cxhFPhw44g53XTDIw2S8x+oS7ZdRWvg158Jpwwwo8qOJfvD9iHZneBilR0hR4vzczc2Gkygpt mD4i3kWOFFMxmYpQDtTd8GITIzPXDuc7+HPDgs9UumQ6iN1ZERXGS95RFmaXDFK+rC4bE9KTD aj2eke+hnU8Vhm4h28CVi04h7q6Dc/muwLs50T843+wgWzzR96DiJxQzMw6aroPXPdCBSGOFY wtSZ/Se6HXqkanMP2X8wubBJ6zzMh0bpaJTf9es9zp2BMKV2U3yqzQyqjOSzXt/D8XBNNNP+G ixB9HQac7TcgKsGrjd8i1r/wi/8XA+lIyDJIV0k+jl532egVSH3FV1Fq6YAinP52cdL5BUIKh 0/jAvP9gLmNy1rr6GfntaeohE4ZGFI/84FMBwtaRtxKWFulDBqG3ydWsM0iEtY/AJFr7D0jUT CZ8UsqLmOyjUntG8RQvwbhc30YLOfKaVXdks= Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- 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 { =20 /// 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); =20 // 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 { =20 /// A condvar needs to be pinned because it contains a [`struct list_h= ead`] that is /// self-referential, so it cannot be safely moved once it is initiali= sed. + /// + /// [`struct list_head`]: srctree/include/linux/types.h #[pin] _pin: PhantomPinned, } --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 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 6F8EC5FF16; Tue, 23 Jan 2024 15:01:38 +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=1706022100; cv=none; b=Gi/XSYRJ6Oai7qaerdcPxQS4/EKnyARQzLFMCqpFFhMLi4hf6eDbdBPfW2IqoRYhSwJF/RT/89zat6gQ32UK/0y5gUsaZ/QQ488FWfkS38H17vpe/qDNtt/so//4Zm7/J4W1vTbb21mGQNOk2L8xkIF6lxeUb4qNpZ+tHbyVeKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022100; c=relaxed/simple; bh=Yce6LCNFDfufjjVUpemLuje6pflWFyy3AoidicX0E+4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qJdv2tt0s8zMVypnggV0Gero2gdWaaA1tJ1NWRmHWbgdFXCw+odmHX3jfsjyUm20OIEpdmIn8D0CFdD/Mx+2TOZ8pRLzxLg+BLzt67pdPLa3mm9dtrk9n3YIyC0JG0u0Gb3ij7tDw0efMu3oKDeFBo9cJGMj1Iu8qPBt2Os5vMU= 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MOiU5-1rk5bQ16kh-00QFYf; Tue, 23 Jan 2024 16:01:15 +0100 From: Valentin Obst To: Valentin Obst , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Trevor Gross , Martin Rodriguez Reboredo Subject: [PATCH v2 05/12] rust: str: use `NUL` instead of 0 in doc comments Date: Tue, 23 Jan 2024 16:00:59 +0100 Message-ID: <20240123150112.124084-6-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:7j0l2qt/TSnuqOa+GwuIUPP/dYlzl9VnPmzTtN8FvIpOyJQrZAt fUKSM+gBxFb7RA1W/WkXJRtapNg99rjwnXfxgMMhX+2dtcJ0UQvmMk8dbcp+q2L3en28pYf +vhxt+IbuZGsJ+k8gXb8w7x2swjGm10rHMU4JvmbtcO1LeD/xP/0XDcEraDijaVFLOMsDqi WMvfdWTBCdQU8BUSH1a5Q== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:Yr+uxGb4l8k=;C+NMWIt5EaNZLPyAyx4zeSzwfLH fWU6XjGepXUvADbSHAkGWOMUT1LxkFgeMtm1FuMnW3vCA5jiNbnFyJ89wUJTqKHnIHascQ/x/ Ks7FWqs7Ul8zyfSKx5wOXwL0BxgWgH36vE/PIsmWciuGB3VWKLu3qA9LHqCkbH3L3JReLxDn3 C0reOZG0LwFFVsePCwwdcwpssBzProYYfweOz3cpPh5sqXno0u2NfE3AmXSxFTyaXLtwnc/73 094LMjN3SxfQwssIPrXoPaGvX8SspJCjLXCeFSBcmAcTGgTAsd2kU2BWg4oTBYvlehQQ1PhLJ VWjh/q0fs0ByyLJyH/8RDCb74GuwAeYdMFPxrC4nPXVfeoyfEoQcVLt6qPEcxqtKweNXP9QRG PerZdcYv3cj1eAeQ+znMxLhkxAGsMJVVn+7LZP9whD9VlaqujWmSAO6FLeK4N9XfQXsCNGONx mKOOhtqCP9bhMnzxsQQtnl29iI+/LBFAbBEjdRfxdaoUiJCuwL3/p1T6qQAjxgrvWGdnPzE7L xTEOlWPKGy0FI23dz/u3vEmH08uvJbBMZyu5joRrR7W0mwrBtQZIo1D6lS1ikvq1KHBuq4/cF YQX/GGOLnKfh7tQ+HzOf6m0i5VcW4bfswEPpiPBZ5rjXbJuJpWS6fn6I0aXj6aBiQoJshL8VE jbVxrSYTc9+gowf0NpMr68jBTK3pBP7a+ktAq8mDXRvkOu7cHzZ+sWjXpFVzGEOTHKAJXWQ7f JeVoqzfsJxKvrVY0GKhJqJewCpGOsUgjzlqp4SeRXiGZn4QA9r8VQN/eE4VVezKt+Lt7P6bet 4MuyRdmaAGsyuezzxo3FU8YgsMZizniMauJFrRZA90yBTK8PsZFSrs2e83x1r0Zn7UV+d4UUs UjKJIOVDL2wFyEiFkgpbUUMWa6h4v/vyPaXk= Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- 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 _ } =20 - /// 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()] } =20 - /// Convert the string to a byte slice containing the trailing 0 byte. + /// Convert the string to a byte slice containing the trailing `NUL` b= yte. #[inline] pub const fn as_bytes_with_nul(&self) -> &[u8] { &self.0 --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) (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 586906166E; Tue, 23 Jan 2024 16:06:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026016; cv=none; b=nyypNh7TNCoZx0MAMBBzlkcAXYE147U5DBGYQggWIlZfq0ZVCtC0bHnqtiiroyKeEEQLNG9OXrX/HzAYfkcDao2X8cUakszzWc7TtCWhZi+MsA/UVCBVIEhzM3SIfD051IFFnnpURADo9s3tuloYk28fD0u18dtb1muRK8NnkNc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026016; c=relaxed/simple; bh=+hqW3hOQC1UxvdWfn9TZu3+fIZ7vvE+96H8K/qkpMIg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l2ZGD0GrSHJJFUn8ni6Exea8+KGGBZ6MYZQ079Sfu4utVnknmZfDx8e8cMNVnCESpsT6sb58YUTX/k9pbMeVV5y9W0meJmCkb9frRuEU7lx+7EpPtf8zpW5bNvmvpRp37bbnw8hVpX/K2Is+htwvKTzh2drPZE57u0j0IaeyIV0= 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.10 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.113]) with ESMTPSA (Nemesis) id 1N33ZD-1qy6RS2jwz-013OUg; Tue, 23 Jan 2024 17:06:43 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 06/12] rust: str: move SAFETY comment in front of unsafe block Date: Tue, 23 Jan 2024 17:06:41 +0100 Message-ID: <20240123160642.125285-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:kkN8nkXFa/+Hos8xuVkzUCkfnQm83AX9LM0fqlu6ufKA1n6bf8O fDOu/W245ZOO3bxg1ZxOjfH79yvO+QF8AooaTY6iw9PjLiYxTmqyNvNIcn71GYfsNTbsurI gd9IazbpuqpzwB3Pi5WruGqT8LUUufy0CK7Vny2rw8uq6ysgNcN6oRf7TVYQI5Syb+YmCAH KOcm4J6PT92OtwpvFZj/A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:UXzJXFTNxhQ=;cigvECPexeR2yYWYYtRlxnddXJ6 uUuC7zyc0G9/wix6gcrdC7KEtbWMeFKzssrRHli5z4UlFn0UNoJ1WuF98fKFmNlYjMx47bos0 k1uPNIXPGaHB515jcrN93YXGHA2zlk187NkpHT1zlQbzxPtPkBZZCw/PT006GpZ7oJ17bR3/6 SrV86T+WRZBjoXxj2JZ8D/9ZrNB3IPeDhNtPVSpZB/m7OmOLK/0b9sr9MgpOl6joC1O/2AEEL 3i3eWtoWc7KIj3U0NWnyrirRII/JezCsrE48ZYrBvhkMXyGcECKA8pVHjEMuSMqw3+6TMInCl 3Jvs6f5UdV1eP2g69l7e+uBeug/sRpnNU5BajfEyilkOdkI6TLMoo6EBbivEOValh/CAXnQfY TI+Y0ow2u+kXmizqRdSlLU6Zr2o7lnV2cPLL35MxQZbpSXK9ChdyiGu/Lz+r0kGmFXgsO9tNX 6cwAlJJW2N9EivRWNE7Sug2jmn2l0e+g08cTYi10LUcbJUiysJEsFONBPpNbwkO/BQK+XEeVS HIVqW28zSUS6UW/jNRiNTyNirD2F+Ztr86mh44D0wG/l9rQq4JEuoZH2frQ+gP3jnU1nxZjur UxuAzcvZ7L4DOTtJkXHfcyR2hnLygWhKtwPwVJ+8vUX/nnNhMVZp0DXza9OYV8Qo+NFSGhAf4 bjZOiQ9iKN4muNIKJUQaci8r51eDuxu+OE0S3GNFIYRbC37Nr9ROvObaxE1i5zOFl7isjJEXB T31yEA5ZcGGg0WFUFMVVGr2jXFJlD15kjmJUF4/YIyO2w6gja72JsQ6vjpThXXGEpR1tC1XNY dkrkmGZJ2AVv91Pb2f3Z44cg83hsI/ZVgd6GIuufvk7UkH4swQp5jHLM5Oo0Y1RSnHRT4xVLt vc79mNqvYvfN2Pg== 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 Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- 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::Utf8Err= or> { /// ``` /// # use kernel::c_str; /// # use kernel::str::CStr; + /// let bar =3D c_str!("=E3=83=84"); /// // SAFETY: String literals are guaranteed to be valid UTF-8 /// // by the Rust compiler. - /// let bar =3D c_str!("=E3=83=84"); /// assert_eq!(unsafe { bar.as_str_unchecked() }, "=E3=83=84"); /// ``` #[inline] --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 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 AAC22612F0; Tue, 23 Jan 2024 16:08:05 +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=1706026087; cv=none; b=YdmIXQQZWk/qN7Cku+oPyMSd1JCC9wl0eHrl/tnMZhs27Csk9RQjgbZ9ttWS98fyAlbytF1mrQxbFTnWCuMjPdKH9oy9siftOJPL5+h0p97gJ1ejdcccCJp7AHIN9ICuKzSXYwDkLYtj4/SfNvAU80wKO0uHPQOEsQaiebVv+Lg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026087; c=relaxed/simple; bh=dcjqT6LwDiJet5DL11/RabzBcNLvOWMbGrooPlheAbU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MruHhD4GgquAfw8qz0mTKwdVOcvGqhrR54JaeVQDJkWsQekYLl17Eurhzki5Do4WKgs44yWStUPvtuM+djhBl0V0szstZRYwCnt9izvlsiwi9cWs8VcXUcvVpau3j7zSErVIEm19TL1/fL1WQ649mAd2bFwnDPCnh2I6/EYwgFY= 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MLRDv-1rj1DV3Ck7-00IRcC; Tue, 23 Jan 2024 17:07:46 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/12] rust: kernel: unify spelling of refcount in docs Date: Tue, 23 Jan 2024 17:07:46 +0100 Message-ID: <20240123160746.125310-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:oz7nBXnl6WKtzIifeIQQp/y21tgQTbcqFqguCS0tl9mId5WT3FO x0bHGtitmGuCGA52GfmAok6Uv0oxPEhw4nwzkpYcQXosTUi/ce0AFZHxruVeUfwGoECgddW tpuZUIZsjfY5/0IgMODQXzjWHWY1S7gGoG7cQbpu7JcKm14+o1+xCuJdIvSnidY8p7WIWcY i74nOrBvOfe1nXKdxqByw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:cqVRWdgTbnM=;Cv2PKUFiZOF7VUI4CrEaqm5CXBG jrhytFZRysztOUiuiX7xEe3B08xilN/ZdVlJqdsOCvn2w9qxicfXhwcpOwu1e1w2kPci3DDYw Xlz8jSxQTFC0Hb2Ro96ojSKVanOKBIJcbsmNCxfO6fY/QccEOOmqWytO2vcPIXGGJkttB+gp5 Y3FT/N9RfcXoUw/S0/KA3DGL3kPVXT3HRMe0ji3bI8f6YezI9r/LnxFs2GMEdGVD+b9mJYUI2 1+l10wx374HQlFlOK7eU2uhVWQAISQ6E1VObAVbuiCr4gVKZhcNLgvD7Ml8M+NyCt3MtqcvaY i3a7+4gEBIiyaH7Oj5yUJ07v0zgpHMNmEigQEkCgK4WyRULVC9va+bsWG+zFDm9jFg975eQif 7XmeutsgG2t6lPAy5TlYAeg+SdUokA66H7oFwzW54vmeDgujEI8jC+VUVFGBDyHJR6BmcqL/3 cd5+zshZByTo0JIByCNb05G4sCxdoRDTnQWJ28DVuIY+7354HSm3GmFiHylsCbU3624At+2Ks oRG2Hu9zucXK651K6wb83laVvN3a3Cl5ozJ1W6mBF0yG+38noSKTmqM+DVCZSzPWF9tLFzinQ HRij5k3zZu5mr8yborq3Ka/A9rjJGCwfTgRERm8pBgInG4lpNnY86FNkQCjHDDCxo8A6ZIe7E q6i+f/utTyYd8sWaN7GBVU+bJWfRFya8vqGxrcwE1CtTqnX/O550WGYctOTHrMdDyBz4QLYiW ZlzaJEafG4DiiuCBa6j/67oHBoGcfz90pu+8WPWkiF+ydlPL7IEG67yWB/8tlyeVtFYH5qZuy BBsgr5GV2Xbi0/wkoF5ns69L5Cqx/tqVGoH9EkQ6Twdee8Gqs6VTF5cDFcuNlpRZXEB/I3v5i xPVkcuTc0db9LTQ== Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- 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 =3D 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 `E= xample` but we don't +/// In the following example we first allocate memory for a refcounted `Ex= ample` 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 usefu= l 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) { } } =20 -// 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 refc= ount is nonzero. --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) (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 F17ED6166F; Tue, 23 Jan 2024 16:10:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.72.192.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026203; cv=none; b=tpSmxYpClrrXaJVA23jckNb1p1gY8Lv8AnTdqXhtGO1IAlDl+SLz0aRqfIHBzIt1PBzJEEK0r6LkYjGRxzpiccHUFXagafMQAkKF836VUgEi83G5pgBYZPse76FHybkK22pRR1LQjz2tsbgBnb6lLWCWDP68QRgcy7GuczNYjlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026203; c=relaxed/simple; bh=7evZ5vnJssnQ3L5gw0A+dVQbOD4aGjWM4CuIu8PX8rM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XwqjR0d3t+1UTHvCxMDZtfYI+qALrMzVbfWjaUWAGL4BsSsh/apf7XAy8A4mikJaGyYFGwWI2HnujxGi1KWiFdou+snrRnN95+BA5cJl5y6QAMoUgfrqtklW7rIeUtaT12leJVpskCv7305MI7AYSJBhtol2GqLazg9W1kT1KSI= 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.73 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MhlCg-1qxONS0TGy-00dpaC; Tue, 23 Jan 2024 17:09:42 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 08/12] rust: kernel: mark code fragments in docs with backticks Date: Tue, 23 Jan 2024 17:09:41 +0100 Message-ID: <20240123160941.125348-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:BVPE1uGnnEwYCq5nQavqew5CMEPSzqQb4jldVEYOWski2Y3V2Py xdjj3KWBOncdzQPS38py2WQFo9L+4S8jUa5f2lOVvoi1ajzgCMg/h6eWUcp3xrazQ6YcoMW x5sZwzUGWXp8UXJNk+2vfXXTN63l/gHYVCo+rGdI7X0MObeJyWfF+VAhD7YBMma/8fyohhb +mP2awwuD4gzeGH7o+7YA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:0Nbwhu/xRzk=;n1YrVuSglSXQZyULkMu0U74euon OoU1lAftulE7OJI79yH2pLK9UjdHfMFJES3S+GgFo1hUvpSwQ+K3KPheSkT+Bw+kzVxeAI/7t rqbgJ2fJiUEFalwdTv4HDUa8DxNuC6P+eA5r679Z+SgodB0Topd3JYbhY1spk/fk9RvuVmkz4 RePyF1D5ZIIykp3p2QL/9h4SSbRje/S37CF7kGa9Q2cqWmZXPSXY2Tyl+/HWdzw/+jp3O9ZN3 YBb+agAbMfAUWadY2BhntAT7u7fvc1devSG0zlRMcGfkj3DTrWZ62lDvmO/gxMUvxXqcWK74x 6mFxuBBxBY3lGx7gq52B9KLSBbwmIopo2+TGu4NHGRYAUSjRG6Dozrx8e54/CQhYQBoekuW/k SleZAeyxLS2mQ1oaohRNozbm2JCdPP4fyHdCNufR5kQtIWt+n/h/Qw61HcFvstw7ElukyYI7+ 1upMzgyGPc/FzBBbiwvCz3Uo466RuDBJ99/wOBfbRSg5Ndjfn5Q/2Z3oq5+VZUUzAE2si+mj3 TXi6vII+z+SsZnkcX2qfbmO/Zl7wyJDyKQ3p+JzSKyuo3xZ68xRRLP33WpS60McG+sdpUdeXU +3zj806FtVb/yqRo4ujzyaY3eYo9BsYibSCCJMPbWhVdVZAsVa+KYKrVAZljyx9UvNRemqpYo hkal1TUG+sCm67QYEw1xrKSzWCBK+O5EInOvJOMgRq3oTtjZCwMC2s59qEkZ5ecXgluNJ8yVz qokrUPmISi76RT7N6aZ2sjGlEnEUj6nmSgWlhm+7qUc7ob3s/0EPonVTN4NvJtsvazsTIHVQT B+0p3ctFguXGuPN4s+rTZFSZl79j2ePm/66v46R8bMNH/ts1JjaEiPLkwD+eZ+QGb7Jx8V8VV sHuKJRYPc1xuKeA== Content-Type: text/plain; charset="utf-8" Fix places where comments include code fragments that are not enclosed in backticks. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- 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 =20 -//! ioctl() number definitions. +//! `ioctl()` number definitions. //! //! C header: [`include/asm-generic/ioctl.h`](srctree/include/asm-generic/= ioctl.h) =20 diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs index 87e111c0da17..67588654c22f 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; =20 - /// The state required to be kept between lock and unlock. + /// The state required to be kept between `lock` and `unlock`. type GuardState; =20 /// 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 =3D unsafe { *ptr::addr_of!((*self.0.get()).group_leader) = }; =20 // 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 dangli= ng, 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 poin= ter 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 binding= s::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 b= elow have. +/// The [`OFFSET`] constant must be the offset of a field in `Self` of typ= e [`Work`]. The +/// methods on this trait must have exactly the behavior that the definiti= ons given below have. /// /// [`Work`]: Work /// [`impl_has_work!`]: crate::impl_has_work @@ -428,7 +428,8 @@ pub unsafe trait HasWork { =20 /// Returns the offset of the [`Work`] field. /// - /// This method exists because the [`OFFSET`] constant cannot be acces= sed if the type is not Sized. + /// This method exists because the [`OFFSET`] constant cannot be acces= sed if the type is not + /// `Sized`. /// /// [`Work`]: Work /// [`OFFSET`]: HasWork::OFFSET --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 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 7B04763511; Tue, 23 Jan 2024 16:10:03 +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=1706026205; cv=none; b=T0lC3V8FWvE7kuSlwJG7/ki+EuFt/L1YL9j9NmYQV0iJExpvZJOVa6aLlsxBc0ds6OAQNAfBGS4++pE2NLHtQr03dx5uzTQ6pkmrIcmRe4VF8lK0TDoGblYfTAV6yOqfs25gKzqbVBQiQIgWG1qQpmhX8QZ6eXVt7G8m4qiE8/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026205; c=relaxed/simple; bh=vqGse0J/VzdCW0jsSamCryiiEi2OKG6PX8sSBlLVGaU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SoPp86GDmYKjaCbYDHVR1yO7rUCX4T1LVw2pgFi/NlfYYVl+oS1aR/ey7zXjGjvv4mYBizGaAXh9C35MewR3uRV/Gzsr78o6DKOSKmJ0XDwQvl4jK0YOUoIdk3xpNp/RWuTcCCxU+NuKhcBYj9H5zT3yd6yJLpcWcdpDoPS9Lho= 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue010 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Md6hP-1qs9aB0OwN-00aD4z; Tue, 23 Jan 2024 17:09:56 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 09/12] rust: kernel: add blank lines in front of code blocks Date: Tue, 23 Jan 2024 17:09:55 +0100 Message-ID: <20240123160955.125365-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:NnxvmERd/P/mfjrEmRtmikwaiBnqYIQP8fv4hY0wnbrU2U6aaJ2 XeVs6Jra1qtnsUF9guX0jtVD4tCz0lZtJkauGQKHisA/Kv5YUMxatR3hpPcXGIaE2WjIBLH SEuP9gTIvXhPJBG2Zdbb4hDJJndQjFgoc1cY/XlIbBP8q7EH1jZC1XCjjyLCJ5hQ66FzRy7 VCyqMIm4heY1WaLDx7Viw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:uPLII7ESCc0=;r6j2HXtUl2O7ze2zRdnyNNvBgeh bD/f+S5Ve3pvxPJqztr0eq9eiZOBdnUl70OM5aGuH8eN0Pk1GPSPssBthqfzxVboqQWDGpM1K kxeErRQRHAtJKT4PDnLqfRPkVeztkon7pi3bes1wsMyPb9i+8XxHu4PZ45+p8p+jIXAxT+kBt 2U/+GsisnVNK0uYruAiIRn3SveTj/DEQP0qJ5OSBKbHmXmYqPA2rJOqxf0VbsPZ21LCG1facU XtnfmPkOgOSr1HYNADJviH4d/3FA/0tq6LMaFEWdxD30ODTr/PnPY0ulCl9Oyl9+znTIE16+H y53QgZAeoYsmaiQzcFeKCVlrPfEHio6LrL9gw6zsWYtL4DQjfFGV9rAbrMF8r9j8DLiK7DZ+1 OvZk8nPv7/Nmn02SZq5WEVp1o4hsjF7nW5g6OKMjSobySqrkeiqyRVNYsrYxilzURONxeG9nd i6D4jCX3R/Qw1XrMPTudc6zLSDVxA84FpmxmZSivuVCDEUY3hMub9Ln5eZuRrrefXcYANMdRs HNgKxgtl+hcG5Irgn0k5xQIKfaAXMpbXmQ7/jZiCc7PRc7DYaTAAGwcycJk3EOCKUIPKRDGdO 3osoFu/qC87qNpZMXKNf8MNnVTTCpbmyY1kIb9G4Vx+qIt5B1Xntw3o95BtNeHOQTFaUx0H65 cAU4XzZjNAjKOL8DyA8DpGB0wHeUvMeIAlaDiqeoIvNvNpLI90RRfGSz8FQ62Q+sZwK7wd/nh 2klyLU4mrlsabdvC+h8YnCANKZZ8/3N1BuEk8nSOoKfxtjRY0DiEyDLAY8BG17VSBPCaIviyM KfThMfH52bON5lrs5WHkJnEWlnaAWxZXmLebAC855Fd+5mOhKQ/KOxkiSzcqesHRRSOaa2Z/F ifn72iHbHP1BSUA== Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- 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) -> Se= lf {} /// /// In the example below, we have multiple exit paths and we want to log r= egardless 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 exi= ts 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 acce= ssible within the log /// function, so we wrap it in the [`ScopeGuard`]: +/// /// ``` /// # use kernel::types::ScopeGuard; /// fn example3(arg: bool) -> Result { --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 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 A64C3612ED; Tue, 23 Jan 2024 16:10:26 +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=1706026228; cv=none; b=Naq+pPnLwStlMo4G5MqgTVA/Unp+D+euvKkJamtGzcIlWv2/XLGZJpMP6slWUrR16mULo+YCl9NZAtoRoVikZ+Vj25sz1hrGR6fCeaF97CHZcnl4SBIf4vC9ysn1CkcJHGsZtTrxD/Qf5CBrLhbYhGnH860BahaXip6uUErohPM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026228; c=relaxed/simple; bh=yNxLPKFKZ3J06UdonBVMW5YOPuqcKhVVrMz3VR5s+xM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hvC80aNq5FrKRMiGJAuki0X+BiD0Ck68pRqK3JC6BcjbeB3Zg8ytIrW0urOKLGVeVTmayyTPmKVJbSSh6DJi7zmk9laNSE7CDdwymgtUkfQijh5uwwatLrP4qM3fF0yc4wafLkT+r5t9VojihyQ3lzrMpYkUjB3Kb0RHSIekC2Q= 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MRmsE-1rYGfy13MI-00TFbA; Tue, 23 Jan 2024 17:10:08 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 10/12] rust: kernel: add doclinks Date: Tue, 23 Jan 2024 17:10:07 +0100 Message-ID: <20240123161007.125380-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:AYk5K0DI/SeWiuqD1FwjDB4RASXP+DR8GlmX0yrZEINI+MyAPQ1 flxlJl42P3tRBLLjJo001pw3HRffuZ5eqK/SCAxR4K7mzt1Dzya9bY2CTWrEkS2jQwSjZok 5NTNrhjKg3ZuSt4mdT6hD4pGULN6HuhWmTW9L/bSV5yEDwHbjRjg8nKIwT2c1hAD6NrUuXC 0LKknSklVTmUdDBi+faLw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:JcwRn86CuEo=;E4gMNnRFw+wRTIjyK2DmlkoHTYq MNhN/4+rRSGmzclDMty8eLoFMSIOd20kALaVhdLkvqTkE1SFw5Bn1iiYuPpwjIY06aEe2S421 e8iK1p5Ei1RyV1zTl/GaKlASHO6TwRqpTtbbiziwx4oBh4+ewATqfK7O5t54GONq6a5JOSFPR 55Peov9PXa8tpQq0lcbTPQ1glNVC0I97DKJarOz9S6SsYQweyE+O4y8GupvYs/YL9UaJ5wgY1 wYhBSURtFDHHV5jlrqet9QU10eWFra0qKc+oMr60IgnpLPPlgbEv4zE6Pnuh3RhUTKxdhiNNN jP76k3v4tJ7vp/caBEB+aMN1ZDVzv1Kb2hukC1l6qJbqHvQ0hfSeyzunOySpIyjdj3UNblE9p pQ2U2c+1rvBg7Rf1fYs5kLL8q3KWKt1WP5EBeJy8XNR88KN8z0R99E7xTwZR8dXgVMxMeJgtz 2jSZup6mvXfXMOLhQxLrO9DRyLjvO//Z6G/AxFhkESbPe+UkLtO1kfKCYz1po8qMGF0JWYSOy OoULW7SrvdPnIEvs0CetPmHv+KgP6YMUgnqZQBwA671BQNIqQaNC0lSbMPuol35O/ImZ8NYWb 07v4RHZ6NPX6y/C2qEKEuFoFuIqGwDbfAHBC9vgpzLbqLbbhAgioQM5HM4rIrRL0O93UAi4qc otQ++JnattkOpmaRYrfHDnJpTUhg/hoMJcqq3YSj5jc2sRpfUXjWITsmi5EOaArLySsDzUfLp EYkxSyX4nMWCjdTeEvnh9FcjkraVGO3lDoKe3cLy0jETW7deXRnctR+TPZIeBi95MzZ7J0Lru rSPTt5C1saWDjtfl5dxHiw1UENwgdJoCv7JBOS3pCYDcH5VT5Mq99SzjT69EcF7tFTbkDD289 bnoKARD1gGHdcqQ== Content-Type: text/plain; charset="utf-8" Add doclinks to existing documentation. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- 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`] instan= ce. /// /// 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 p= ointer (shared reference) -/// to a pointer (`Arc`) to the object (`T`). An [`ArcBorrow`] eliminat= es this double -/// indirection while still allowing one to increment the refcount and get= ting an `Arc` when/if +/// to a pointer ([`Arc`]) to the object (`T`). An [`ArcBorrow`] elimin= ates this double +/// indirection while still allowing one to increment the refcount and get= ting an [`Arc`] when/if /// needed. /// /// # Invariants diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs index 67588654c22f..956a0618ecc6 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 pro= tected data once the lock -/// is owned, that is, between calls to `lock` and `unlock`. -/// - Implementers must also ensure that `relock` uses the same locking me= thod 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; =20 - /// 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; =20 /// 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 n= eeds 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. Furt= hermore, it also includes -//! a trait called `WorkItemPointer`, which is usually not used directly b= y 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 enqueue= d to a workqueue. -//! * The `WorkItemPointer` trait is implemented for the pointer type tha= t points at a something -//! that implements `WorkItem`. +//! * The [`Work`] struct is the Rust wrapper for the C `work_struct` typ= e. +//! * The [`WorkItem`] trait is implemented for structs that can be enque= ued to a workqueue. +//! * The [`WorkItemPointer`] trait is implemented for the pointer type t= hat points at a something +//! that implements [`WorkItem`]. //! //! ## Example //! @@ -218,7 +218,9 @@ pub fn try_spawn(&self, f= unc: T) -> Result<(), All } } =20 -/// 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 t= he 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) -> Sel= f::EnqueueOutput =20 /// 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 main= ly intended to be /// implemented for smart pointer types. For your own structs, you would i= mplement [`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 th= e [`WorkItem`] trait. +/// instead. The [`run`] method on this trait will usually just perform th= e appropriate +/// `container_of` translation and then call into the [`run`][WorkItem::ru= n] 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: RawWo= rkItem { /// /// # 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 st= ill 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 m= ust still be valid. + /// + /// [`__enqueue`]: RawWorkItem::__enqueue unsafe extern "C" fn run(ptr: *mut bindings::work_struct); } =20 @@ -328,12 +335,14 @@ pub trait WorkItem { =20 /// 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 t= he [`WorkItemPointer`] /// trait, and defines the linked list pointers necessary to enqueue a wor= k 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 [`Wor= kItem`] 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 binding= s::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 hav= e 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 acces= sed if the type is not - /// `Sized`. + /// [`Sized`]. /// /// [`Work`]: Work /// [`OFFSET`]: HasWork::OFFSET --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 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 C876A612ED; Tue, 23 Jan 2024 16:10:20 +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=1706026222; cv=none; b=fCctp7mbn0xsPfwEPhMxtY5P8xnA7xWDr2Fqbr+frHPIVDwMqb5w7ep0TZQy/3lVs0hCpIm6asDCz1OxHGBl1fBugsq6t2UrvoR75NJB3q1cHqgcz9GOfs2/wqNzC13/oHCGecqdd2Go2zQn8WbF3pbl1OhIYve9c7in6fanYEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026222; c=relaxed/simple; bh=ynU1HC6VgcbU8Mv8I9+BJ3zkWxcifHhQZBpm4nI9Iuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hj4D3N+gopZIpY22hR3MkKvObnfT9eCqAASuMLEUk2hgt0lf9X4MU3nzlky27xxr44hSYVd6tTAh1BcJ7nq51j1pLKTmPu7+JIKx4o81/gjthi0xG74Y239Solc2peLBQeMEXQOS9IGw+Bh1JTuMo5yQz+WQ+4VEsN/t8vpnPbc= 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MFbFW-1rK3DM0aNS-00H9qe; Tue, 23 Jan 2024 17:10:14 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 11/12] rust: kernel: remove unneeded doclink targets Date: Tue, 23 Jan 2024 17:10:13 +0100 Message-ID: <20240123161013.125396-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:d+sLc+PnG3T50bn0EmkGevLMD15rUA9+7Q5nmFP3P/4bKtDtMgu 2jEOFVLIx5k9tL2TPLO11K22kuvE7QfpW/ZAEl/Aih0apm1QlHcAC1Wxd6g4J87lDj+4iNW N+VKzKZiibMXqAZr1TCa0XOdgqkxbzTZsbIOLNwPCsnZwgxSP3/c6uARsqOAFcqQJQdFBOS BYhUmU3S6EVf2w9j/L3fg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:NPRaYtHirQw=;U3Bgv/YyqM1QWg7UpR6MKa4p2G9 WVMKbmDIz6F4zDIZZ//JzAx1peWR88NWxKI1KTrnymNWsiLxPDj4Y3enG7pRVOTAi430TFRnB QWAVXBdOrw6ajJx1aPXULQqZMXrxdYjWmFZeQPfmPl/KQpZkmD/uCyngUQUpGxQyWAE3Phbqs p0Qe60KZXOPQcRU/3zU9LEncjI7aP6BqZZRDZo8MmRNExWcrTBex9B+cC3oMDpDeq/+F99jd6 qx8d96nlfONhUZikJHfT8aBYwW/VufhJB5cVFc1ZcgMlua/iL70TQ+REDBnoLkzgBhIXjsvUM Ben/tKiH0HUGg2sDXuuLgbBnOeZE9cOih6X4tnRhiFdhCUofflFJ+/t+zewGDm/5t/ajLD7f+ v8TO1AYPe3efn5zxsZP16586fr+NXKeGP84AqjCh14A6PHECpL2g2I84I0CMFn6qLifvTdVXm +d1OJKW40ZZjAjYHU4/0lGiCxPVWESxHI54CUej+E1aEMv+ZB1Nel0C5A3WnkDYyqV/JKTV1m 264sdXZUjHK24vfEEkj34ZYHKpYDL7W/740uxUJsyS0PzeS4OoyvQSF4oxPUDLvbPhkGadlqr AgKexFwD4UUBQoTCmY6zF8Pje6VLMwiJzYThyKLWEYqLS43HEhHhtP8oxBKMBqXtV+yWCfQfd 1voe+u2RDGHWHR9KvyGYkB+Ahw0N/2DRchyYSKJmXZAkqFTHNy/emWwOPGAoLP3i+XIpxTkhH BshqTTs+NVh4uaY1W3YAZ04UZpacHRUQbU4LX73QIOQJbKU1eNk4zbTIrE/zqn0EQqZzF+/bV sGMVEeglbRqJ9BIR69RkSfua/cgxm/zvVA2T/Y074hVsHXtRhmCNyCwpO2SfI3if5W2CGrrvG uBf+lISYdm1zCGQ== Content-Type: text/plain; charset="utf-8" Remove explicit targets for doclinks in cases where rustdoc can determine the correct target by itself. The goal is to reduce unneeded verbosity in the source code. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- rust/kernel/workqueue.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index ed3af3491b47..73d6fa544ca6 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -426,13 +426,10 @@ pub unsafe fn raw_get(ptr: *const Self) -> *mut bindi= ngs::work_struct { /// The [`OFFSET`] constant must be the offset of a field in `Self` of typ= e [`Work`]. The /// methods on this trait must have exactly the behavior that the definiti= ons 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; =20 /// Returns the offset of the [`Work`] field. @@ -440,7 +437,6 @@ pub unsafe trait HasWork { /// This method exists because the [`OFFSET`] constant cannot be acces= sed 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 t= ype `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),*>)? --=20 2.43.0 From nobody Wed Dec 24 21:30:36 2025 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) (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 D3AD46BB49; Tue, 23 Jan 2024 16:10:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026231; cv=none; b=l6GWyYYns4qo1Me12k29iQ19v6Gyk5cSziTAZzcgCWSKrxRLn8ocSqBzQcFJcAw7yIpdwsstQJu+DPgANioOHZnpbZzuZGy2SaorOJKarBJbFSb97meEt6HpIJkxXCvCPYbQdxEsXCCqYrvh6cUlqbP5bC31WofxgnNFiRTyjkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706026231; c=relaxed/simple; bh=/mPIgHq0w2qaUMGCkrU3Cu6bC9EjioKbpcWgTPzL5UI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n9KDQn2kAzNhHvOl8qG7ZJJotA/lEi7d1JCKOHR6/Iy9r5vWbRTej3q/lRnf4Khsa/npiU7Ysvm8j+nWjCaICZ5GAmCxEYoC4dGaRBEW+A3E7xdvcm+rhGBbNOsKeP4kWFg1H39/gZQo9WqZoUlKfn6CoijcFEtyYrCdBPjgm68= 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.24 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 ([95.223.130.98]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MdNTy-1qsyXF1lWC-00ZQ6l; Tue, 23 Jan 2024 17:10:21 +0100 From: Valentin Obst To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 12/12] rust: locked_by: shorten doclink preview Date: Tue, 23 Jan 2024 17:10:20 +0100 Message-ID: <20240123161020.125411-1-kernel@valentinobst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123150112.124084-1-kernel@valentinobst.de> References: <20240123150112.124084-1-kernel@valentinobst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:A78h7VEK/k0EYoCiEAC98WH3nnSRQhqfYYEbV0l8MCjBxERCtaC Dw33gAcdWFNUwuUVkFaKlRJe5jplKvWAuxwWqh0KWV/AgaN50QxkxRiOgBqzkSSVaft2gGG 97wn9jLETO+PUITmJYzOssTtk3EHQski3H25nQeO4XbUmZwHa7k0ywdMUnqUKFttXT3MyOP ShYzJYxLuO2X/z+WtA+gA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:EDVxGzJZ4fo=;VNkoZV4Qh5i2B3D7njue7EoaVhb uW5IbeOXK9xEDkU2o+nPhw+W3romeRdnBVj5mrbMHxcgaVRDt6h2ypvbaQCUfceyZKZ1JyMOV spOBvIwS0xLmaKzrPZpBL7WK4U3hQzzAp5IgrTxhwwpFoYJu36UaowOjlfWhDeWZ0YKDdrUMM eaALDZiRCDmONzSzb4fij4gFgRiVzICfi29mz4+SKajFB0iSB5lNKdMeclvdKMzK/d/dUtPYM mQGZ78zWP4dhQI2cMjzxW2hXyF+hwkIysCqr4sUAcdxABYjKx0LkSwC9nlFv+jmpcfrZ1SekF 1WP+84mlL+xHLxcQj4xKMts3z5aFdGeqk5zS0S5aGrQQtTY6iBQyo7DqSUR1LohFnUZP7vC9t o14LIg2AYIyAB4kcIzNNLjaQA1FgGn8rZhQeRQBdv8OZn3TgXeQbC+sUuXu3h3J6IJ705XQLS iUnoa3jZmj0zyTG4WdDe1DXh1nkPlF3a0kNOrJa+3CDRj7WyIwftnx5FDuhCr/89x78hamK7l dgI+tsQMGr3Mi9Nz720mD4w9iFFAp+ymychP8+OrB+iZS4LhlIIObIDjnkpBNHgu/OgDWbzbB CCPh0ED9+mL5ufHa8chayac0TzIUV+bshLMgFRX5Ov6aSVQz2cWV0KEo9k57cA9b4ItpaNWLi igeMuNB3sRvzhoIWfZqWZDT07rM61cwWMiGSImlOFpTAyxEYfQU57MnOShrebBuGJduZhavPI XyLd2FPBwuwRUiVZK8ldx2S4cpSdpKTicfariPCBNkRurpYjn20BvEETHM/hWymPP15QDb6Vd Qvdp4QxS+Ye3uK6BclxFy6qXenGE2zWiYJkraCfZ3CksoTBKgRD9NJG9HueYsD/MMmya+sLQ8 s8IOtxGWsjy2C/Q== Content-Type: text/plain; charset="utf-8" Increases readability by removing `super::` from the link preview text. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Alice Ryhl --- 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 wr= ap 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 cas= es when this is not +/// [`Mutex`] or [`SpinLock`]. [`LockedBy`] is meant for cases when this i= s 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 --=20 2.43.0