From patchwork Tue Jan 23 15:00:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 190991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp391680dyi; Tue, 23 Jan 2024 07:02:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3SNpG0bAU7xlWcbIXrCtPMTN+xHVegOHO/mPv97teEdf/00TlSSYJb09X7g2cK77bJcmv X-Received: by 2002:a05:6402:4309:b0:55c:81c0:3b3a with SMTP id m9-20020a056402430900b0055c81c03b3amr1443070edc.29.1706022148879; Tue, 23 Jan 2024 07:02:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706022148; cv=pass; d=google.com; s=arc-20160816; b=UJWSn4hAR9YlD1qeB/PtE5HOR4u9ndRGk0qWxoMDeT88QM1DSHBLqHq9oMTGJNGI0J +wIXpuxcGunVlQbuHWsGaOKYO1xRAyat/ik5fRdrQHyfUZubIqLBLADmaZeHXlUI+ysa 1J9UzLDXgPzKVT8m9t/7NbCRkI336lZiqlEtJ6Rycz83O/uQXv1JMxFIKk9Bp9OVkYnF gaoNFIgD2xwWWWSeOtzFYLKGG0pLRaKzS3OAviuoXyYzrxaKcrhenykKUcoSfj1d1atZ CraXb5MIpSYFJpSDjnpxwAHsp59r6FpExyj0kqrlarYFk7Oknrl/+xg8xYrv3kB5m1uS Sjmg== 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=aHvex8hGAeF3YZkFMSZLyHvBWMeMpPjB1cw4bKkWa0I=; fh=dJj4mMVLGVAFq0WwW7t3PdvAEXNzUYMVBuh9o+dpk7g=; b=Guyc8VzG6rRweUFXWIWLb3jmD++5kIBu7uMZOdMRoO4HY5ghZnpDjEyOmFzMbeauEu OiHCALYVQaueJ2JJhJ0tdoKbiYmsDsA+lHKveZ/xMnr5jH2RgvmHCwtF0HCtltUdW7bP MUwhIDGy1u+uezJiRdoEoCQEQHEQSI3rtVagjj+9kQ5EtgFlgvzJ0PhuWrAK75e269A+ SWe0K2A4z4wmizvpuOoODQ8r52mf2QovP1n07EwaD59BR2R8OOoGQkL/vsEdWDd+4fB8 WfnF2B+4fTLsPi8mjy2Czl7221iY4B1vLMMgZvXB/iaFRqqdAaNMMof4uXCtxF3zBxYi l+hw== 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-35486-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35486-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 fd3-20020a056402388300b0055755d0203esi12636034edb.111.2024.01.23.07.02.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:02:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35486-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-35486-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35486-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 581091F2455E for ; Tue, 23 Jan 2024 15:02:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8F0B5FF1D; Tue, 23 Jan 2024 15:01:38 +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 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 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== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788893880731684427 X-GMAIL-MSGID: 1788893880731684427 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 --- 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: 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.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 protected 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 method 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/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 23 15:00:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 190995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp395950dyi; Tue, 23 Jan 2024 07:07:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+fdq4sHQ7vy7YlH5Dnve6c3HXPUL+PuOSxZi8/+YzbDptte1WAN7yt8Fjr1LC5/YmO2wV X-Received: by 2002:a2e:a445:0:b0:2cd:f62d:adb2 with SMTP id v5-20020a2ea445000000b002cdf62dadb2mr2808906ljn.87.1706022434115; Tue, 23 Jan 2024 07:07:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706022434; cv=pass; d=google.com; s=arc-20160816; b=MarcmKIASjmacFHYJpbxylU9A1kcuaoNXKIC5tMzq+qK5tTSbO9WELCboco2Gtetel CO+FSDgweshpJX0ViqK5D6nZAle1JJ555t7M2aqbQ8vOGUQrADW5eP74Y+WUxhNgk7I7 rNUNZPd0ZLHww5Ht4Jsr6SyfqQDUhaNQ1LmHvG9kJYoeat5Vx8iZh7vIwKTLgl3VCJiH ajS4dd1/tzUFZbh0inlKNZk0tWfYtSvjwNYxD0yi0FEog0dLZMMjvCoed8xQamGNgVbR B4+2vUSC8ge8KB61hkwJn6ZH5ReCsXGPlylZ+fUBHhz5KOoph7eY0ue7r21ZIve1yPWz DOcg== 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=dgV709JAQNRKOTVYTbkWTDtrvwjI9gC84ZoGLjNbA5A=; fh=holi1bJLvX2YwUyoh+DoPjG/4rRvCAaky4a7z/TeGUk=; b=xkA6jUl7dhp3sWmfXJdGdoIKpI6doNYvf/3b91oq6IDFKx0GSOSlUz+Tduow1nVe24 qQhitUsS4VAv239ChF6qmhbzPvN62EIgtEBElnNpfXIu3hWukgfHTa/8Slu8bymWHB0d K7Q6ZmtPJ555a1LWUyUU7IdYHt4XkBbpGysAR84/h8hQcRBFr+VNSXoQLeqJCHBpPu4X hk2JlYffaJTlF3SltS+Ens1oVdONfgCJjl/wxQcsc25Ap0f99Jsuc1VkP8myMMx+xkPU WihiUrGxuAi9na/v3ciLx/oWnxavG44v650HlRo7/jqV4nxWmslwt8vr/gX1w0sRiEv5 OwFA== 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-35501-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35501-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 g5-20020a056402320500b0055a56fa81d0si5227550eda.378.2024.01.23.07.07.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:07:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35501-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-35501-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35501-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 9F6B11F246EB for ; Tue, 23 Jan 2024 15:07:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9D6B5FDCD; Tue, 23 Jan 2024 15:06:50 +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 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 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= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788894179604535798 X-GMAIL-MSGID: 1788894179604535798 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: 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(pdev.to_ptr(), index) }) /// } /// ``` // TODO: Remove `dead_code` marker once an in-kernel client is available. From patchwork Tue Jan 23 15:00:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 190993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp394743dyi; Tue, 23 Jan 2024 07:05:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9bPZdeFnIGJ+rHKKOaz7sFW9G8VjEEQzKYRqOzDS/rsmwwxpkdBztI3vF2+FKu+zHcVDA X-Received: by 2002:a05:6358:6f04:b0:175:77e8:6c31 with SMTP id r4-20020a0563586f0400b0017577e86c31mr6421892rwn.42.1706022346400; Tue, 23 Jan 2024 07:05:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706022346; cv=pass; d=google.com; s=arc-20160816; b=tZhIog+Ys8Aux+mXKXGuQe5mlyFWnWAIQb/oFeW0BoVYulMpa6gMmKwvxLQONXMf9K aVde1uhsXWKylpLcTK4BxFm4+BqB2J44fvASKJiPXKCFOdbyQYRwZkopP+0wUlHe4vPA SLahH3z7NUSadkfRaskplUZTYU1NDDeopwPqAFgqAlR9aWWFmVvhyiDI7UoqTlO9Ubqz DR/iZYe3IBYfZUykwNWsbmrwmmoo/S8MFFJtyOh9dNNxQ11nCM8TZwqQQkpYfHu2L9wU 8VTeTKFHUxlJj6Sz+g2PoGiTOaqG2/mT4cub7bLiVvjjj87eTc3IPcdzKASOSsYcpKdA Sppg== 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=mm/huq76alBePKq6fjKmgYIBaBi/A5V2iXkMfBTMCFM=; fh=dJj4mMVLGVAFq0WwW7t3PdvAEXNzUYMVBuh9o+dpk7g=; b=y1Ez4hgR128mwkWIVkUeml2mc5UpH52LhCKUp+5n+c0P7trAWHpWCQM/Tk6NVo2PrR osdaeMchozUuGrhp5XUkegVv7dCJ3WBGdlgCE7Yy8TwjleafXp1EDR1tflBzLTZ1aeCo Nu19lfKbnS39g6dAItj9uFdmjx+BUQ7EgtqaH9eF9MfndoPLdx+IWUEr8TqE9TGlddBx QhwDz64IWEsd1FMC1PmCz+R3CH9/AFGpUdB6NHpbQF7uHL9NHXTQccEEp79eW2+Q4Ju9 iAmU4F87A72N/58R4vSRgQr5EuZZS4z47M9kAbj2MVmeCu9aICfZRwa/GfqBWssrpTqJ ydNA== 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-35488-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35488-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 q20-20020a635054000000b005ced5bbfcb3si9782911pgl.392.2024.01.23.07.05.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:05:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35488-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; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-35488-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35488-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 AA30F28C433 for ; Tue, 23 Jan 2024 15:03:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00F83604D6; Tue, 23 Jan 2024 15:01:43 +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 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 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== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788894087863334270 X-GMAIL-MSGID: 1788894087863334270 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 --- 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 23 15:00:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 190994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp394783dyi; Tue, 23 Jan 2024 07:05:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdQOU8fgyvdGJ+zrrJoEIbVbhjDoL28NARrZnCGT9UYD5EPxKrsihtEu+VZHz+pm4xTwe2 X-Received: by 2002:a05:6a20:889e:b0:19b:1da3:cb9a with SMTP id d30-20020a056a20889e00b0019b1da3cb9amr2407461pzf.77.1706022349973; Tue, 23 Jan 2024 07:05:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706022349; cv=pass; d=google.com; s=arc-20160816; b=CRCJiY5hCWl0A7s6kRYHT+vyejWr3BQIILZx04Lsi3d2zsiw3raSyffiLCYYKVsFvA uGAGs6nKm5scmrxhcgfTwqLaE9EHtt4bZfaBQ2W4CvYT3ntxmm1GiPFlnbUomLIdYaug 4Mj4NN8BHhkVN9js/cxG5BQcKBHAJdJLmJVOq8wX6aJLXV94nKCxtRz6aCIrsgtUQacQ pLBIz/3cReSSDIwOZoW59XzWcjpR7HjbJdisFKaUtIbkkhAla7O/6hbzTckSPerajjXH ttCmFXCEMfZKMZSRmqA2u8Dy1I3oDh2LYfSu2Q9v71GwuEfj8dohREzoWi+vb8Msuqdv fkew== 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=OXpjPGwWPzcicWfllBJwiKQ6vk4DjMbVdqOp4uaL6fw=; fh=dJj4mMVLGVAFq0WwW7t3PdvAEXNzUYMVBuh9o+dpk7g=; b=BLEMmJUSfqUuaoUXyZ3qGPRRLyg5K0UYDAvVH2LO1oywovYokAHoe8oj1YhUL9oeps bk94sVD19NCjCHm5wjIizfQE9VaGy9WepYyRjCIGXPSJtGEvi3I/XM3w3daN6NzmXgaK O+ybY1iVsFK6KqdFYJ+/OIPG0TdBv5XhOgAQKVb3yF+6ngEZPxi6NzqEBHo//eElDITT ZdvUcSsFdcV2o+CZc4o6L21f5c4MNazZZ83tYdDrDpGB5UDzzjGbkFkE7NE2R+BkxBwL oXAQsIBJAaC1mGS9C70WZHfPnLbkzjRXWm8tI7YjhsFpDcF4GfNrv1NiEJniMMel6Nzb OyNA== 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-35489-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35489-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 q20-20020a635054000000b005ced5bbfcb3si9782911pgl.392.2024.01.23.07.05.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:05:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35489-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; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-35489-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35489-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 1BA2B28C856 for ; Tue, 23 Jan 2024 15:03:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38BB4605A1; Tue, 23 Jan 2024 15:01:43 +0000 (UTC) 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 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= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788894091754567050 X-GMAIL-MSGID: 1788894091754567050 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 --- 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 23 15:00:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 190998 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp398270dyi; Tue, 23 Jan 2024 07:10:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCsMOe5lLchAMMSt7l8i7DoEabUyNKxYcysspNIxgYlOcbPIVQtYdsqLKwPEYvtt+eAirO X-Received: by 2002:a05:6358:6f16:b0:176:4ac9:5508 with SMTP id r22-20020a0563586f1600b001764ac95508mr3955754rwn.0.1706022606947; Tue, 23 Jan 2024 07:10:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706022606; cv=pass; d=google.com; s=arc-20160816; b=YPsIuicx9zAbPPeLujYH8qIpGxVZ2Q8zSPusk9Y9zWfH1IwOZnqAR9QFauI3vS+o7k E5ERkYsSUOoAThbEARgmnrdes3oCphuAmzorwi3HG0KYcH4Ya0nte7Eqwkw6sEXd5rU2 iSvVBTBZbVQzWtN7d6RoTh32/ZShqzvYyHcC5N9cLIIsFqbz+ufNbE2x3Qje/UhabLyA twD+ONCmK6uLqMkF/b50Chm/n6cyrAWeXQew7WmsT6yZqpp1wxFkDY6wSNAZ3dk2Zxpl 29MYUzdM0OlUP4ds/FKO8HCOvu6ruFVkpsAZDkaahKgUVXn5P2+z4B6shuI4+K/t0TWA KjMg== 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=74Qzs5o8XPh9pIxeRK3lhAtw1wpL1d8EhwWq28mzKak=; fh=dJj4mMVLGVAFq0WwW7t3PdvAEXNzUYMVBuh9o+dpk7g=; b=nauYO6iMIur9lDVpEXOUIHpaAgjC6tJd2mUIW1nYtJm5LkB1iUZrd+BhbNPoJZ4Q5V 0ORMO0RxO1pQdXsqhUdsh2Q23zrYLXL2EncLBnrruHX7idxbrISnbiFg0h1qRPPAWRxE VUooFO/2abNCLoOJ+l84q5Rt7RUanwhdJLf+qftO4RohOwdyvCfRgeq5arVZ3XFuJGE+ FlwiEGdbE8Dw4y/uHBUl68R96Odhl6AJhUKe+uTEpXEK/fQpT/e4lHqMjEjAmZCmfGUG SfYjb22Ft1boZwrsciE+muc7/BQ4l4KffkJhU3d5utiNoN7AZV1RFDxq240zZRtvJTmt t/AA== 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-35487-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35487-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t8-20020a63dd08000000b005cd8545dc12si9702103pgg.599.2024.01.23.07.10.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:10:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35487-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=valentinobst.de); spf=pass (google.com: domain of linux-kernel+bounces-35487-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35487-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E8F50B26017 for ; Tue, 23 Jan 2024 15:02:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF02C604A0; Tue, 23 Jan 2024 15:01:41 +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 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 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= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788894361369100120 X-GMAIL-MSGID: 1788894361369100120 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 --- 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 23 16:06:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 191039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp437804dyi; Tue, 23 Jan 2024 08:08:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOzsAqAEZnmyI0bD6YVzdyTHPv0+8qTJdZd9oyQQCeJdksAVZjAeaEHn6Yv2y0CmDwek3m X-Received: by 2002:a05:6512:4006:b0:50e:2d00:4d32 with SMTP id br6-20020a056512400600b0050e2d004d32mr3301706lfb.86.1706026097057; Tue, 23 Jan 2024 08:08:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706026097; cv=pass; d=google.com; s=arc-20160816; b=Zk3/tacSOEqLY3D4eUCCidINTLrSL8Rf5upNeuyTmRcbtbnTt/2uNuG++elwHFtgIS haeeGes2AWYaN7ZzBafSjC4jpA26xqLBYmT4XV17aMDNpIlWQ+jJLH5iKMUuWrs/lp5M RnHWLh92sEBZGZ4nfcz0wm8ejaEg0irMRJsx20mnxAI4mgtXmruixv7Csrs7WHb5xniw PuD1piOadC4HXwZ1y2TL5VeYwjdNrOE+twFhfCqo+VZr9EVJF/ON7vqT9urrj4ESje2k 7KZxNU4pImpJNZPP4oymE9kTJA8dkrbPjQ9TjXEo+Zin1e2vhgGojaj4/a0/sSqawXl3 xgEg== 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=3yUQPmlAgiw03cBaxiw8FcQ0h0YHyCEjLnQKAe+fxMg=; fh=BZI9iWTaEf0O3fXVlcMygnOLgsZaFpsfuA9TcLqdYG4=; b=QS7Auw0t5SxfppYLsV/i6vZM+p0HiJrlzxJ2i1SLgzehXf/Yh3+D34p/5UOlqGHpm8 JPeQ8fCy2th7D+uKc9BqQ8WlHeoCQvz2JnKG/eoOJIqkx8jVgsX6sbDDMqFaMVPHcFgj PMefYBLQePXjP3taD5kJO3ogmAcQrIO7652bDeFdY4HVKC0nIXK7h4CiRIXR6nPl889S zYJ+SIloFZWMMBgQ9MT2SA33fqNFKaD6i1SvCi/C3s1Xoqs3Ond7fc2cJhDb8uZ50AOz QJ4661jU6ApcsoqPSyMCevJod923vmyblb9m4Gn0jux6/mTBdLeVrOAlmlOywviqhXKE yu7A== 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-35622-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35622-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 h25-20020a17090619d900b00a2b94fc6ee9si11934047ejd.132.2024.01.23.08.08.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:08:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35622-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-35622-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35622-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 9F7A11F226D0 for ; Tue, 23 Jan 2024 16:08:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F30A266B33; Tue, 23 Jan 2024 16:06:57 +0000 (UTC) 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 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== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788898020359065002 X-GMAIL-MSGID: 1788898020359065002 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 --- 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 23 16:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 191040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp438059dyi; Tue, 23 Jan 2024 08:08:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6Rw82QRkIvus3ZQlnjvbaONMHkY/5d7cvNYKpwLeu09Ucb4lhLgXgwx3/bYpHY25XdlJi X-Received: by 2002:a05:6870:219d:b0:214:2775:3b2 with SMTP id l29-20020a056870219d00b00214277503b2mr1577232oae.95.1706026116310; Tue, 23 Jan 2024 08:08:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706026116; cv=pass; d=google.com; s=arc-20160816; b=WwZRJX3Z4EYZBxtis5jpXbODHgXha1z/HS+vLztg3EsutUz7po6GwU5D8E0w97H95f vLpObcW1WLxJB70l51hnsMjd1gOv0BZMfkgNqRJc7M9taTxoyUVLRd4rq0MX73a6corg HPywn3WKFd+9XPbnRD/SrzIEsjFcfqUCVBVqUJ1GQcnW97CG4sgQI/wJnhTCGZrC1sp0 ygjEHJXV3tPgLKIxf+9lWAT3DxF1TonFL1RkUcZB+8X922+9yt7LItjhGOITafsJmGbk V1EePqrnyHUAXDRKM5je22dYssVgDQ9S1E16npaHFt2CYXAjA+JAQVpYLPt30uowe4s8 t6yw== 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=9S7K5KQu8M1nvgkInN/G/1oA/haJK9eC/Scj28KnLUA=; fh=BZI9iWTaEf0O3fXVlcMygnOLgsZaFpsfuA9TcLqdYG4=; b=AxpzATv1q/7p7zkCJSJSo3+ykb9mGH4ayFRLWxLEN/+73z5xR/pJGMxLlGA8aN2TQ9 GUgeSb2p3aM1Ns+BB0NLxTOWEfkFE73OJKH8nvlx2TlaOw2NUCWPLfKp84XrUkPVrkqG Hlk77BK4A5VAliwyi8iuhDwWi6F1fuO2BbdsWla0ZB447+lzzlnb/4QVm7bgOOCduPHy L/7NnouWTndWmTQ9Gyljx4ggujpz0sCOqFISCGD5wJ8moEEGRzKRUOT7TVd0cgc2LieW SV2zf2dugINEfjhZVKalnmH79Z4uxSSZUofkoo3c+d5Pr8dW7XLJB/3kh7urbluhsbJu ApLQ== 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-35623-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35623-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 f22-20020a0caa96000000b0067f4f8cc986si8265059qvb.274.2024.01.23.08.08.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:08:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35623-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-35623-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35623-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 1B85D1C257F0 for ; Tue, 23 Jan 2024 16:08:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52FE064A80; Tue, 23 Jan 2024 16:08:09 +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 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 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== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788898040727328341 X-GMAIL-MSGID: 1788898040727328341 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 --- 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 23 16:09:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 191045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp440241dyi; Tue, 23 Jan 2024 08:11:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFqPO8SX8oOD8apwLegqvXeQ6dxhmUN9ZLbdJnO2Cfnn10sY2DncBY2AaZop4+aPHetJIp8 X-Received: by 2002:a05:622a:100b:b0:42a:42da:a03 with SMTP id d11-20020a05622a100b00b0042a42da0a03mr1128275qte.36.1706026300819; Tue, 23 Jan 2024 08:11:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706026300; cv=pass; d=google.com; s=arc-20160816; b=chOjB2KoTEW45KMDUnx46XUry4ZbqOTx4CB0QCFtAzHPt9LEubupllsPgciHmmQJr7 Prkc6maymDXw2I8n1SehFMO0EjEI0373TyHiOhZcSsB87F3YWuav0Lwk2YMeJoO1mkrW x5Lh+wXiT0M04/W8pflAkSMlsGae//dM/AERGKndlhw9mhPgpIfntThmQY8R9/PnCrIV foGYpS33M7y1ymGZQAylB8jjafefhbzuZKdaA4Oupd8v4/LZms/ATXCiqyMq8rFKVjbK mKlnrNRThR/5DH3mgN1aXVxXAV0VUaz05Ddimsc8CQJ79l7K/HvroDLizVolcvXW03Dh 6Btg== 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=bWsCwgiF2eOGlSjFEiZTWOffVNJUu5vYrZMH6T3GBMU=; fh=BZI9iWTaEf0O3fXVlcMygnOLgsZaFpsfuA9TcLqdYG4=; b=Rq9J1/vncpVIHz8mjrVU4lAkmXVnTLCaixxanog2NECLIjoPach/djz44tZt8ptIlh G5P4lAoZud6KXl2od8ydPTmHCuzCQyNt0m+4zphW67/QEMgrOjopzxgEhEzNXLQ7kAiM wtYqFLFEOzBJ4fsPkgPBUZsyYKiAiSdpTzn6OP8b6I/sIItYc+xzklY6NKfuR3ay6mmP yQn4VfX2wmK6H+R82RaqcgJjsJ2GCm/NyeLqJN3qUiR+fQqMaWWp4lofVwrk8W1V6jka 8BWRpaa/RgC1VI2A9CNpQ9fVveDlykmDII4dhQOg/ixKWcho0aRmlCvkNGRCensUw2W7 REzw== 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-35628-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35628-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 w16-20020a05622a135000b0042a3d156a8csi4949279qtk.565.2024.01.23.08.11.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:11:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35628-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-35628-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35628-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 487BA1C285B6 for ; Tue, 23 Jan 2024 16:11:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5BE2664BE; Tue, 23 Jan 2024 16:10:04 +0000 (UTC) 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 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== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788898234097839314 X-GMAIL-MSGID: 1788898234097839314 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 --- 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 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; - /// 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 23 16:09:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 191047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp440435dyi; Tue, 23 Jan 2024 08:11:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWc7fEu4JojM4buPfVCR/ap6mCnsfJ8J5CCA9fj2H+P5wMqtH/M/04wmveRgGjK5ibWgZk X-Received: by 2002:ac8:5754:0:b0:42a:55d2:754f with SMTP id 20-20020ac85754000000b0042a55d2754fmr590455qtx.47.1706026314213; Tue, 23 Jan 2024 08:11:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706026314; cv=pass; d=google.com; s=arc-20160816; b=WXHpcbXCpp8S/J/pbNemlBcSNaWgJ7gl9gi7y0UOuvlgjl3U4sa+BUoPHmqRphnFF/ zuZRkKmAOen7B1sLZKJFu7r94XVtNOG4Sje9WA9h8AX1Gv8Od5LLb4djP1jLrEn7tgJl 4L6wFLi3/0+qosCAEpZablhNLXSLzP/hU382jhc+TxGXtluGJUnjZmkC4KWv3vBmQ9On l5OiAhzG0lXhZQ0D/yTx1DQPsAU9OktIy/iVFTs5M9KIFzF/6l6a4rqjtDJu1RkLFBF8 MhE5gCHDeKcabY88SvNz+wBgk+Yw5DPVA3JHIU4CEXfTWuJhvydx46dSqLy+/hAH5RRJ urmw== 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=lcAeFLRu5pXHLe2pLZr+LMahuPV/eSA+ONl17jIjPck=; fh=BZI9iWTaEf0O3fXVlcMygnOLgsZaFpsfuA9TcLqdYG4=; b=nrHYPLCFfx+2erdnIykc4FX2nnH86K80PTPB5M9vBX+NWeQ8d4z9+f1hkVu6yNPrCB d42tKK8vJVjyJ0jZMYynmwz6k3Wl+sHQ5qPWd1t/4HGP/9A1htGna53zaB9fV22xfEsx klESSqzrwIWXk9Ttz4HlwtP7B1aEoqmOHkkTT8ngN6qLPXlP3V5CxdwOfSo2fThzAat5 fDCtlgbofhBqP2KCGx1GNHShrZaWC62g2Ink2hg0OTIiolUM7g9rx96bTKn9F8sql9kv vj4/X1Q7vqF5kV5Un8X/Wnnj8+BflLstPPUK0NAyBE59FdVZg7E0oo+TBNrBi7iXFWgS Daqg== 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-35629-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35629-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 w16-20020ac87e90000000b0042a458e045dsi3384093qtj.106.2024.01.23.08.11.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:11:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35629-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-35629-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35629-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 729CA1C27B67 for ; Tue, 23 Jan 2024 16:11:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E26496BB3C; Tue, 23 Jan 2024 16:10:06 +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 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 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== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788898247949773068 X-GMAIL-MSGID: 1788898247949773068 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 --- 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 23 16:10:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 191048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp440577dyi; Tue, 23 Jan 2024 08:12:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGthWODBb09gR4NezQs316FMImhat0x6sJQzCF3Uw/L5RPIU5fBkhtU3mjH05sFgmkc5QLc X-Received: by 2002:a17:907:c709:b0:a30:6107:cdea with SMTP id ty9-20020a170907c70900b00a306107cdeamr58882ejc.2.1706026324638; Tue, 23 Jan 2024 08:12:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706026324; cv=pass; d=google.com; s=arc-20160816; b=aDD9kqDzQZin/WIQTgFMVwvKOoApMlZdIdTDksOkOWOssROKXICDDzkl/0XmB9bPXA TLWlJJQnPCbFmB2Trc26PWNwGs597rB6RIl+upVX86RFnOBS7NgRAQXCYB4I/V/4Q1/m 4a92Y4KX39CgZzO1UhBJ7I2zaGzzGfgAGBp47eloQHxOLyHS/xq5ysuwxm5VDUYwpKSG NG/FkV9doFqXgu/FKrAxiVcvbP0JZQdhS/koKxTLWHAow+q2UNzdRo92A+BRx6AiB4CX vnCtUPMKxkn0BYaOo7AtvQwLwAaWhbdSGPP1k0D90e/TFwtlt1ZxzN2n3rhHIOr2zEW3 t/vA== 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=ANc39AHGrGGYgwE5S+bUaCgQbwCwNpjMDAKoK49/6Yg=; fh=BZI9iWTaEf0O3fXVlcMygnOLgsZaFpsfuA9TcLqdYG4=; b=Sy9HsFJH+AWCq6N9rKKVi0r50a3Wl6gmq5988YLPhBT/zjt3+umAuhm79mHTj0AXoM XDKXC64nrGlca8DlL2UUTJCRoorgUnAxj3brdehzmdDFyklrExM36sXB7+4/be6FbpXJ BWpmRNwKuto7pU/JAJ+NBE3GDpkDQBS/iFkz3vDm7qHNX7Wb8uEMckALItLzTyZYNzsW 25TRjoUtz7yhWLiml7jimWzDHUVAhEsX9pqovJP6O8Rz+hQnjcKbuTcGMl8Nau5d0wer mrp/rUB8x9eSCfbFrnpCrhmYB9l3kUSKOh+Ct3LAWALb6rsuDvOa1UpDhkHxEpNm6ssi bLJg== 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-35631-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35631-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 i3-20020a170906250300b00a2ca9f3ce99si10922325ejb.661.2024.01.23.08.12.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:12:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35631-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-35631-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35631-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 1E3DA1F21272 for ; Tue, 23 Jan 2024 16:12:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E1446BB55; Tue, 23 Jan 2024 16:10:31 +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 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 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== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788898259422861004 X-GMAIL-MSGID: 1788898259422861004 Add doclinks to existing documentation. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross Reviewed-by: Martin Rodriguez Reboredo --- 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 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 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 23 16:10: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: 191046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp440404dyi; Tue, 23 Jan 2024 08:11:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnLalTnJYtKT7ojT+5uKJC7VgTiTK4Iw8rX8uDi5RMf8XGvmQN8W43wn9YyuEcboEkNmnn X-Received: by 2002:a17:907:6a0e:b0:a2d:d05e:5704 with SMTP id rf14-20020a1709076a0e00b00a2dd05e5704mr77090ejc.30.1706026311610; Tue, 23 Jan 2024 08:11:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706026311; cv=pass; d=google.com; s=arc-20160816; b=hqkp1wRZLm0T9g31xWmff/2WllXUdho6YuVQ3P9xdB9As1vjuZgI8Xhq4QiFaaKa7k PuFX3QhrvJR9VrXlaDij2NUmstYfcduHOunDIY6a/mzbKXkIAG4m+e4lXqgOtAZ8qJfW RECD3MnEzNO/SSG6CUC4BsbqWBlgx3i/sbGVUQz9CrboCumXiBNO694YMZ2IlEeB3vE9 r3cEHM0ttiu+Pj0pNjg1wivwY5Ep40TuCTByGFZJPxnSzcPYmVRsOELqypTaZ5Zky2eg eeHBVweeANMx6HeNNkBDHflpkfM9YH9Azq05mM3LPkZTa4/oY74cux2RCGAjjE+Z2e8n oW6Q== 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=cWHI8ZwZTH01hqojyRj3v4ptazvTJRV6h7Tc8jijTa0=; fh=BZI9iWTaEf0O3fXVlcMygnOLgsZaFpsfuA9TcLqdYG4=; b=leMaCmH0E58iPYMZg+LpapcWInJgTTC426oIxvh1XqUuhDBcWpZtMkCva5Pdv1iFA/ oGpduDlIi9x0W5suHQ4z4jurj22KpKaqeFSWtGFF3Qleb9pFTS2+obheswwvzdC3KX+Z /P7wOcRaLHXLjjmnHPrraG5ksYG5Px2k8UVs8beAKmUN5uC1s33xHyJzep23RGq/zIRw 3NNGfEPcesmOu1EeiML5OeGNlfCuNpkZ1lvELEdvTbg7BWYnBxOul5OJeGCEhOT43vYT CEVI74VDDQNfsri2456tdJrgxG1RxrdY5QpG53LLPZ116O1A93ZpzVuaovHbHrYnBNU0 fQwg== 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-35630-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35630-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 hh16-20020a170906a95000b00a310231005dsi25754ejb.637.2024.01.23.08.11.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:11:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35630-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-35630-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35630-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 B70611F224EA for ; Tue, 23 Jan 2024 16:11:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 300C266B21; Tue, 23 Jan 2024 16:10:24 +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 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 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== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788898245574778238 X-GMAIL-MSGID: 1788898245574778238 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 --- 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 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 Tue Jan 23 16:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Obst X-Patchwork-Id: 191049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp440790dyi; Tue, 23 Jan 2024 08:12:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkOF7vopXhHzbghpAOMAfxdW0NXbSZfjIxzdOI7TgjcjqRDwlEDHHsWboNjt0YTZ4pY4yk X-Received: by 2002:a05:6512:3611:b0:510:cfa:994f with SMTP id f17-20020a056512361100b005100cfa994fmr133840lfs.100.1706026342603; Tue, 23 Jan 2024 08:12:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706026342; cv=pass; d=google.com; s=arc-20160816; b=g5eBQA95dzjS7xIukyYPZ97PLnoCBS+NWYBmUZ5Fsws4Lz20m7cNFvkUj8kqRuC9Bd s8wXMZOLF8AMFBvf/xLzRhWinmoFmTXuQ2l5zmvABP9N7Z/31bly8zbim7qgWeRyxdFE krtn3jXIs2VoCyU8cLOARMSda4AMXoRu9ab10YzcZUWwgicBmECiGRAof48bRa2oemHS k0Axbj/AhJH2Y2xeK008SyoYM1Dpk3YjPAI3NSjMD/rozW9Cl4qnN2pfC076gQ5U2o4l sCjK7+QIjv0P/DK5AyMAbwdL5nedmDjNOGYU3IPmBXpOtuAbThBbFZKH0eUxC20xgkkl 4lrA== 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=Vj0D2otC9fS8GBngZbr7vyupc0N7bNVQqdnANPZiTw4=; fh=BZI9iWTaEf0O3fXVlcMygnOLgsZaFpsfuA9TcLqdYG4=; b=kdlp4ER7ca4nN2J5Tj4k2fSI/3LhVpagxeGk1DmJD7DTMpAnv/zvQKzHHkCpdCLGbN smBOIk+lEI0pWDsMUnGcZp3V8qD5+g+JVSc8QcFv9IGRf9+N3a3vKPVvCRIOILEsj6eH RZS8cCwCsKFlH5vAtppWWybVbFhyLjKQheBZp3RnOaIVeMUL/RbY0uXziW8RCjZxY/l5 S+ta5O5Hm3IvcwB/XPi+6JJ735KySwQYriVuEbh4Ds2iSB8OCWaKNGXGg0eMnyK3ATpJ BSiEl9G1SdD+lSH9mZqIabdyFOeTPfpC5PhmfIDfPRiYu81byUs9tzUE2gG40/npmg/C 5mkw== 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-35632-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35632-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 i3-20020a170906250300b00a2ca9f3ce99si10922325ejb.661.2024.01.23.08.12.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:12:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35632-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-35632-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35632-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 3727C1F21E7C for ; Tue, 23 Jan 2024 16:12:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 353446D1B6; Tue, 23 Jan 2024 16:10:33 +0000 (UTC) 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 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== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788898278528349024 X-GMAIL-MSGID: 1788898278528349024 Increases readability by removing `super::` from the link preview text. Signed-off-by: Valentin Obst Reviewed-by: Trevor Gross Reviewed-by: Martin Rodriguez Reboredo --- 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