rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: use consistent backtick formatting for NULL in docs
@ 2025-11-30 21:12 Peter Novak
  2025-12-01  3:29 ` Alexandre Courbot
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Novak @ 2025-11-30 21:12 UTC (permalink / raw)
  To: ojeda, alex.gaynor; +Cc: rust-for-linux, Peter Novak

Some doc comments use `NULL` while others use plain NULL.
This patch makes it consistent by adding backticks everywhere,
matching the majority of existing usage.

This is my first kernel patch - just getting familiar with
the contribution process.

Signed-off-by: Peter Novak <seimun018r@gmail.com>
---
 rust/kernel/clk.rs           | 2 +-
 rust/kernel/debugfs/entry.rs | 2 +-
 rust/kernel/kunit.rs         | 8 ++++----
 rust/macros/lib.rs           | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/rust/kernel/clk.rs b/rust/kernel/clk.rs
index 1e6c8c42f..dcada231e 100644
--- a/rust/kernel/clk.rs
+++ b/rust/kernel/clk.rs
@@ -94,7 +94,7 @@ mod common_clk {
     /// # Invariants
     ///
     /// A [`Clk`] instance holds either a pointer to a valid [`struct clk`] created by the C
-    /// portion of the kernel or a NULL pointer.
+    /// portion of the kernel or a `NULL` pointer.
     ///
     /// Instances of this type are reference-counted. Calling [`Clk::get`] ensures that the
     /// allocation remains valid for the lifetime of the [`Clk`].
diff --git a/rust/kernel/debugfs/entry.rs b/rust/kernel/debugfs/entry.rs
index f99402cd3..6f656d452 100644
--- a/rust/kernel/debugfs/entry.rs
+++ b/rust/kernel/debugfs/entry.rs
@@ -148,7 +148,7 @@ pub(crate) fn empty() -> Self {
     /// # Guarantees
     ///
     /// Due to the type invariant, the value returned from this function will always be an error
-    /// code, NULL, or a live DebugFS directory. If it is live, it will remain live at least as
+    /// code, `NULL`, or a live DebugFS directory. If it is live, it will remain live at least as
     /// long as this entry lives.
     pub(crate) fn as_ptr(&self) -> *mut bindings::dentry {
         self.entry
diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
index 79436509d..aecb8dab4 100644
--- a/rust/kernel/kunit.rs
+++ b/rust/kernel/kunit.rs
@@ -193,7 +193,7 @@ pub fn is_test_result_ok(t: impl TestResult) -> bool {
 
 /// Represents an individual test case.
 ///
-/// The [`kunit_unsafe_test_suite!`] macro expects a NULL-terminated list of valid test cases.
+/// The [`kunit_unsafe_test_suite!`] macro expects a `NULL`-terminated list of valid test cases.
 /// Use [`kunit_case_null`] to generate such a delimiter.
 #[doc(hidden)]
 pub const fn kunit_case(
@@ -215,9 +215,9 @@ pub const fn kunit_case(
     }
 }
 
-/// Represents the NULL test case delimiter.
+/// Represents the `NULL` test case delimiter.
 ///
-/// The [`kunit_unsafe_test_suite!`] macro expects a NULL-terminated list of test cases. This
+/// The [`kunit_unsafe_test_suite!`] macro expects a `NULL`-terminated list of test cases. This
 /// function returns such a delimiter.
 #[doc(hidden)]
 pub const fn kunit_case_null() -> kernel::bindings::kunit_case {
@@ -240,7 +240,7 @@ pub const fn kunit_case_null() -> kernel::bindings::kunit_case {
 ///
 /// # Safety
 ///
-/// `test_cases` must be a NULL terminated array of valid test cases,
+/// `test_cases` must be a `NULL` terminated array of valid test cases,
 /// whose lifetime is at least that of the test suite (i.e., static).
 ///
 /// # Examples
diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
index fa847cf3a..364bd3eba 100644
--- a/rust/macros/lib.rs
+++ b/rust/macros/lib.rs
@@ -122,7 +122,7 @@ pub fn module(ts: TokenStream) -> TokenStream {
 /// case the default implementation will never be executed. The reason for this
 /// is that the functions will be called through function pointers installed in
 /// C side vtables. When an optional method is not implemented on a `#[vtable]`
-/// trait, a NULL entry is installed in the vtable. Thus the default
+/// trait, a `NULL` entry is installed in the vtable. Thus the default
 /// implementation is never called. Since these traits are not designed to be
 /// used on the Rust side, it should not be possible to call the default
 /// implementation. This is done to ensure that we call the vtable methods
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rust: use consistent backtick formatting for NULL in docs
  2025-11-30 21:12 [PATCH] rust: use consistent backtick formatting for NULL in docs Peter Novak
@ 2025-12-01  3:29 ` Alexandre Courbot
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Courbot @ 2025-12-01  3:29 UTC (permalink / raw)
  To: Peter Novak, ojeda, alex.gaynor; +Cc: rust-for-linux

On Mon Dec 1, 2025 at 6:12 AM JST, Peter Novak wrote:
> Some doc comments use `NULL` while others use plain NULL.
> This patch makes it consistent by adding backticks everywhere,
> matching the majority of existing usage.
>
> This is my first kernel patch - just getting familiar with
> the contribution process.
>
> Signed-off-by: Peter Novak <seimun018r@gmail.com>

This looks like a pretty good first patch! :) 

Just make sure to put the meta-comments (the "This is my first kernel
patch" sentence) below a `---` line so they don't get picked up in the
git log. See [1] for an example.

With that sentence removed (which I believe will be done when applying
if no other fixes are required),

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

I have double-checked with `rg '\/\/\/.*NULL'` from the `rust` directory
and this indeed appears to address all cases.

[1] https://lore.kernel.org/rust-for-linux/20251124-bounded_fix-v1-1-d8e34e1c727f@nvidia.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-01  3:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-30 21:12 [PATCH] rust: use consistent backtick formatting for NULL in docs Peter Novak
2025-12-01  3:29 ` Alexandre Courbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).