Skip to contentSkip to conversation

rust: debugfs: use "kernel vertical" style for imports

PATCH In review Danilo Krummrich 3 participants 5 messages Dec 18, 2025 – Dec 28, 2025

Subsystems (2)
lore
Share & tools
lore

Danilo Krummrich

author maintainer
#0 lore raw

PATCH 1/1 rust: debugfs: use "kernel vertical" style for imports

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::*.

---
 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(-)
rust/kernel/debugfs.rs +35 -11
index facad81e8290..536a320334bf 100644
@@ -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)]
rust/kernel/debugfs/callback_adapters.rs +15 -6
index a260d8dee051..dee7d021e18c 100644
@@ -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
 ///
rust/kernel/debugfs/entry.rs +10 -4
index 706cb7f73d6c..5ed1303f2fe6 100644
@@ -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.
rust/kernel/debugfs/file_ops.rs +17 -8
index 8a0442d6dd7a..ad19360540ba 100644
@@ -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)]
rust/kernel/debugfs/traits.rs +32 -11

49 lines not on this page · raw message

base-commit: 1b89d4a6bb4cd7cfd7eb2e3621f04fda956e4ef3

Signature · 1 line
2.52.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 29 lines · 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::*.

---
 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(-)
rust/kernel/debugfs.rs +0 -3
index facad81e8290..536a320334bf 100644
@@ -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;

rust/kernel/debugfs.rs line 17

Quoted 10 lines
rust/kernel/debugfs.rs +5 -3
 #[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...

author maintainer
#2 lore raw
In reply to Danilo Krummrich
Quoted 10 lines · 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::*.

Applied to driver-core-testing, thanks!

reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Danilo Krummrich
Quoted 10 lines · 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::*.

#4 lore raw
Quoted 7 lines · Alexandre Courbot
Quoted 6 lines · 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.

Quoted 6 lines
Quoted 4 lines

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

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