public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rust: debugfs: use "kernel vertical" style for imports
@ 2025-12-18 16:56 Danilo Krummrich
  2025-12-20  8:40 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Danilo Krummrich @ 2025-12-18 16:56 UTC (permalink / raw)
  To: gregkh, rafael, ojeda, boqun.feng, gary, bjorn3_gh, lossin,
	a.hindborg, aliceryhl, tmgross, mmaurer
  Cc: linux-kernel, rust-for-linux, Danilo Krummrich

Convert all imports in the debugfs Rust module to use "kernel vertical"
style.

With this subsequent patches neither introduce unrelated changes nor
leave an inconsistent import pattern.

While at it, drop unnecessary imports covered by prelude::*.

Link: https://docs.kernel.org/rust/coding-guidelines.html#imports
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
 rust/kernel/debugfs.rs                   | 46 ++++++++++++++++++------
 rust/kernel/debugfs/callback_adapters.rs | 21 +++++++----
 rust/kernel/debugfs/entry.rs             | 14 +++++---
 rust/kernel/debugfs/file_ops.rs          | 25 ++++++++-----
 rust/kernel/debugfs/traits.rs            | 43 ++++++++++++++++------
 5 files changed, 109 insertions(+), 40 deletions(-)

diff --git a/rust/kernel/debugfs.rs b/rust/kernel/debugfs.rs
index facad81e8290..536a320334bf 100644
--- a/rust/kernel/debugfs.rs
+++ b/rust/kernel/debugfs.rs
@@ -8,28 +8,52 @@
 // When DebugFS is disabled, many parameters are dead. Linting for this isn't helpful.
 #![cfg_attr(not(CONFIG_DEBUG_FS), allow(unused_variables))]
 
-use crate::fmt;
-use crate::prelude::*;
-use crate::str::CStr;
 #[cfg(CONFIG_DEBUG_FS)]
 use crate::sync::Arc;
-use crate::uaccess::UserSliceReader;
-use core::marker::PhantomData;
-use core::marker::PhantomPinned;
+use crate::{
+    fmt,
+    prelude::*,
+    str::CStr,
+    uaccess::UserSliceReader, //
+};
+
 #[cfg(CONFIG_DEBUG_FS)]
 use core::mem::ManuallyDrop;
-use core::ops::Deref;
+use core::{
+    marker::{
+        PhantomData,
+        PhantomPinned, //
+    },
+    ops::Deref,
+};
 
 mod traits;
-pub use traits::{BinaryReader, BinaryReaderMut, BinaryWriter, Reader, Writer};
+pub use traits::{
+    BinaryReader,
+    BinaryReaderMut,
+    BinaryWriter,
+    Reader,
+    Writer, //
+};
 
 mod callback_adapters;
-use callback_adapters::{FormatAdapter, NoWriter, WritableAdapter};
+use callback_adapters::{
+    FormatAdapter,
+    NoWriter,
+    WritableAdapter, //
+};
+
 mod file_ops;
 use file_ops::{
-    BinaryReadFile, BinaryReadWriteFile, BinaryWriteFile, FileOps, ReadFile, ReadWriteFile,
-    WriteFile,
+    BinaryReadFile,
+    BinaryReadWriteFile,
+    BinaryWriteFile,
+    FileOps,
+    ReadFile,
+    ReadWriteFile,
+    WriteFile, //
 };
+
 #[cfg(CONFIG_DEBUG_FS)]
 mod entry;
 #[cfg(CONFIG_DEBUG_FS)]
diff --git a/rust/kernel/debugfs/callback_adapters.rs b/rust/kernel/debugfs/callback_adapters.rs
index a260d8dee051..dee7d021e18c 100644
--- a/rust/kernel/debugfs/callback_adapters.rs
+++ b/rust/kernel/debugfs/callback_adapters.rs
@@ -4,12 +4,21 @@
 //! Adapters which allow the user to supply a write or read implementation as a value rather
 //! than a trait implementation. If provided, it will override the trait implementation.
 
-use super::{Reader, Writer};
-use crate::fmt;
-use crate::prelude::*;
-use crate::uaccess::UserSliceReader;
-use core::marker::PhantomData;
-use core::ops::Deref;
+use super::{
+    Reader,
+    Writer, //
+};
+
+use crate::{
+    fmt,
+    prelude::*,
+    uaccess::UserSliceReader, //
+};
+
+use core::{
+    marker::PhantomData,
+    ops::Deref, //
+};
 
 /// # Safety
 ///
diff --git a/rust/kernel/debugfs/entry.rs b/rust/kernel/debugfs/entry.rs
index 706cb7f73d6c..5ed1303f2fe6 100644
--- a/rust/kernel/debugfs/entry.rs
+++ b/rust/kernel/debugfs/entry.rs
@@ -1,10 +1,16 @@
 // SPDX-License-Identifier: GPL-2.0
 // Copyright (C) 2025 Google LLC.
 
-use crate::debugfs::file_ops::FileOps;
-use crate::ffi::c_void;
-use crate::str::{CStr, CStrExt as _};
-use crate::sync::Arc;
+use crate::{
+    debugfs::file_ops::FileOps,
+    prelude::*,
+    str::{
+        CStr,
+        CStrExt as _, //
+    },
+    sync::Arc,
+};
+
 use core::marker::PhantomData;
 
 /// Owning handle to a DebugFS entry.
diff --git a/rust/kernel/debugfs/file_ops.rs b/rust/kernel/debugfs/file_ops.rs
index 8a0442d6dd7a..ad19360540ba 100644
--- a/rust/kernel/debugfs/file_ops.rs
+++ b/rust/kernel/debugfs/file_ops.rs
@@ -1,14 +1,23 @@
 // SPDX-License-Identifier: GPL-2.0
 // Copyright (C) 2025 Google LLC.
 
-use super::{BinaryReader, BinaryWriter, Reader, Writer};
-use crate::debugfs::callback_adapters::Adapter;
-use crate::fmt;
-use crate::fs::file;
-use crate::prelude::*;
-use crate::seq_file::SeqFile;
-use crate::seq_print;
-use crate::uaccess::UserSlice;
+use super::{
+    BinaryReader,
+    BinaryWriter,
+    Reader,
+    Writer, //
+};
+
+use crate::{
+    debugfs::callback_adapters::Adapter,
+    fmt,
+    fs::file,
+    prelude::*,
+    seq_file::SeqFile,
+    seq_print,
+    uaccess::UserSlice, //
+};
+
 use core::marker::PhantomData;
 
 #[cfg(CONFIG_DEBUG_FS)]
diff --git a/rust/kernel/debugfs/traits.rs b/rust/kernel/debugfs/traits.rs
index 3eee60463fd5..8c39524b6a99 100644
--- a/rust/kernel/debugfs/traits.rs
+++ b/rust/kernel/debugfs/traits.rs
@@ -3,17 +3,38 @@
 
 //! Traits for rendering or updating values exported to DebugFS.
 
-use crate::alloc::Allocator;
-use crate::fmt;
-use crate::fs::file;
-use crate::prelude::*;
-use crate::sync::atomic::{Atomic, AtomicBasicOps, AtomicType, Relaxed};
-use crate::sync::Arc;
-use crate::sync::Mutex;
-use crate::transmute::{AsBytes, FromBytes};
-use crate::uaccess::{UserSliceReader, UserSliceWriter};
-use core::ops::{Deref, DerefMut};
-use core::str::FromStr;
+use crate::{
+    alloc::Allocator,
+    fmt,
+    fs::file,
+    prelude::*,
+    sync::{
+        atomic::{
+            Atomic,
+            AtomicBasicOps,
+            AtomicType,
+            Relaxed, //
+        },
+        Arc,
+        Mutex, //
+    },
+    transmute::{
+        AsBytes,
+        FromBytes, //
+    },
+    uaccess::{
+        UserSliceReader,
+        UserSliceWriter, //
+    },
+};
+
+use core::{
+    ops::{
+        Deref,
+        DerefMut, //
+    },
+    str::FromStr,
+};
 
 /// A trait for types that can be written into a string.
 ///

base-commit: 1b89d4a6bb4cd7cfd7eb2e3621f04fda956e4ef3
-- 
2.52.0


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

* Re: [PATCH] rust: debugfs: use "kernel vertical" style for imports
  2025-12-18 16:56 [PATCH] rust: debugfs: use "kernel vertical" style for imports Danilo Krummrich
@ 2025-12-20  8:40 ` Greg KH
  2025-12-22 15:57 ` Danilo Krummrich
  2025-12-28  7:52 ` Alexandre Courbot
  2 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2025-12-20  8:40 UTC (permalink / raw)
  To: Danilo Krummrich
  Cc: rafael, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, mmaurer, linux-kernel, rust-for-linux

On Thu, Dec 18, 2025 at 05:56:11PM +0100, Danilo Krummrich wrote:
> Convert all imports in the debugfs Rust module to use "kernel vertical"
> style.
> 
> With this subsequent patches neither introduce unrelated changes nor
> leave an inconsistent import pattern.
> 
> While at it, drop unnecessary imports covered by prelude::*.
> 
> Link: https://docs.kernel.org/rust/coding-guidelines.html#imports
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
>  rust/kernel/debugfs.rs                   | 46 ++++++++++++++++++------
>  rust/kernel/debugfs/callback_adapters.rs | 21 +++++++----
>  rust/kernel/debugfs/entry.rs             | 14 +++++---
>  rust/kernel/debugfs/file_ops.rs          | 25 ++++++++-----
>  rust/kernel/debugfs/traits.rs            | 43 ++++++++++++++++------
>  5 files changed, 109 insertions(+), 40 deletions(-)
> 
> diff --git a/rust/kernel/debugfs.rs b/rust/kernel/debugfs.rs
> index facad81e8290..536a320334bf 100644
> --- a/rust/kernel/debugfs.rs
> +++ b/rust/kernel/debugfs.rs
> @@ -8,28 +8,52 @@
>  // When DebugFS is disabled, many parameters are dead. Linting for this isn't helpful.
>  #![cfg_attr(not(CONFIG_DEBUG_FS), allow(unused_variables))]
>  
> -use crate::fmt;
> -use crate::prelude::*;
> -use crate::str::CStr;
>  #[cfg(CONFIG_DEBUG_FS)]
>  use crate::sync::Arc;
> -use crate::uaccess::UserSliceReader;
> -use core::marker::PhantomData;
> -use core::marker::PhantomPinned;
> +use crate::{
> +    fmt,
> +    prelude::*,
> +    str::CStr,
> +    uaccess::UserSliceReader, //

While I hate the // use here, I have hope that one day the compiler will
be fixed to allow this...

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH] rust: debugfs: use "kernel vertical" style for imports
  2025-12-18 16:56 [PATCH] rust: debugfs: use "kernel vertical" style for imports Danilo Krummrich
  2025-12-20  8:40 ` Greg KH
@ 2025-12-22 15:57 ` Danilo Krummrich
  2025-12-28  7:52 ` Alexandre Courbot
  2 siblings, 0 replies; 5+ messages in thread
From: Danilo Krummrich @ 2025-12-22 15:57 UTC (permalink / raw)
  To: gregkh, rafael, ojeda, boqun.feng, gary, bjorn3_gh, lossin,
	a.hindborg, aliceryhl, tmgross, mmaurer
  Cc: linux-kernel, rust-for-linux, Danilo Krummrich

On Thu Dec 18, 2025 at 5:56 PM CET, Danilo Krummrich wrote:
> Convert all imports in the debugfs Rust module to use "kernel vertical"
> style.
>
> With this subsequent patches neither introduce unrelated changes nor
> leave an inconsistent import pattern.
>
> While at it, drop unnecessary imports covered by prelude::*.
>
> Link: https://docs.kernel.org/rust/coding-guidelines.html#imports
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>

Applied to driver-core-testing, thanks!

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

* Re: [PATCH] rust: debugfs: use "kernel vertical" style for imports
  2025-12-18 16:56 [PATCH] rust: debugfs: use "kernel vertical" style for imports Danilo Krummrich
  2025-12-20  8:40 ` Greg KH
  2025-12-22 15:57 ` Danilo Krummrich
@ 2025-12-28  7:52 ` Alexandre Courbot
  2025-12-28  7:53   ` Alexandre Courbot
  2 siblings, 1 reply; 5+ messages in thread
From: Alexandre Courbot @ 2025-12-28  7:52 UTC (permalink / raw)
  To: Danilo Krummrich, gregkh, rafael, ojeda, boqun.feng, gary,
	bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross, mmaurer
  Cc: linux-kernel, rust-for-linux

On Fri Dec 19, 2025 at 1:56 AM JST, Danilo Krummrich wrote:
> Convert all imports in the debugfs Rust module to use "kernel vertical"
> style.
>
> With this subsequent patches neither introduce unrelated changes nor
> leave an inconsistent import pattern.
>
> While at it, drop unnecessary imports covered by prelude::*.
>
> Link: https://docs.kernel.org/rust/coding-guidelines.html#imports
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>

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


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

* Re: [PATCH] rust: debugfs: use "kernel vertical" style for imports
  2025-12-28  7:52 ` Alexandre Courbot
@ 2025-12-28  7:53   ` Alexandre Courbot
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Courbot @ 2025-12-28  7:53 UTC (permalink / raw)
  To: Alexandre Courbot, Danilo Krummrich, gregkh, rafael, ojeda,
	boqun.feng, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl,
	tmgross, mmaurer
  Cc: linux-kernel, rust-for-linux

On Sun Dec 28, 2025 at 4:52 PM JST, Alexandre Courbot wrote:
> On Fri Dec 19, 2025 at 1:56 AM JST, Danilo Krummrich wrote:
>> Convert all imports in the debugfs Rust module to use "kernel vertical"
>> style.
>>
>> With this subsequent patches neither introduce unrelated changes nor
>> leave an inconsistent import pattern.
>>
>> While at it, drop unnecessary imports covered by prelude::*.
>>
>> Link: https://docs.kernel.org/rust/coding-guidelines.html#imports
>> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
>
> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

Argh sorry, missed that this has already been applied. Please ignore. ^_^;

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

end of thread, other threads:[~2025-12-28  7:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-18 16:56 [PATCH] rust: debugfs: use "kernel vertical" style for imports Danilo Krummrich
2025-12-20  8:40 ` Greg KH
2025-12-22 15:57 ` Danilo Krummrich
2025-12-28  7:52 ` Alexandre Courbot
2025-12-28  7:53   ` Alexandre Courbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox