* [PATCH] rust: io: cleanup imports and use "kernel vertical" style
@ 2025-11-04 13:32 Danilo Krummrich
2025-11-04 16:25 ` Danilo Krummrich
0 siblings, 1 reply; 3+ messages in thread
From: Danilo Krummrich @ 2025-11-04 13:32 UTC (permalink / raw)
To: aliceryhl, daniel.almeida, ojeda, alex.gaynor, boqun.feng, gary,
bjorn3_gh, lossin, a.hindborg, tmgross
Cc: rust-for-linux, linux-kernel, Danilo Krummrich
Commit 46f045db5a94 ("rust: Add read_poll_timeout_atomic function")
initiated the first import change in the I/O module using the agreed
"kernel vertical" import style [1].
For consistency throughout the module, adjust all other imports
accordingly.
While at it, drop unnecessary imports covered by prelude::*.
Link: https://docs.kernel.org/rust/coding-guidelines.html#imports [1]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
rust/kernel/io.rs | 6 ++++--
rust/kernel/io/mem.rs | 28 ++++++++++++++++++----------
rust/kernel/io/poll.rs | 5 ++++-
rust/kernel/io/resource.rs | 16 ++++++++++------
4 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/rust/kernel/io.rs b/rust/kernel/io.rs
index ee182b0b5452..1aa9495f7774 100644
--- a/rust/kernel/io.rs
+++ b/rust/kernel/io.rs
@@ -4,8 +4,10 @@
//!
//! C header: [`include/asm-generic/io.h`](srctree/include/asm-generic/io.h)
-use crate::error::{code::EINVAL, Result};
-use crate::{bindings, build_assert, ffi::c_void};
+use crate::{
+ bindings,
+ prelude::*, //
+};
pub mod mem;
pub mod poll;
diff --git a/rust/kernel/io/mem.rs b/rust/kernel/io/mem.rs
index 59096d579644..b03b82cd531b 100644
--- a/rust/kernel/io/mem.rs
+++ b/rust/kernel/io/mem.rs
@@ -4,16 +4,24 @@
use core::ops::Deref;
-use crate::c_str;
-use crate::device::Bound;
-use crate::device::Device;
-use crate::devres::Devres;
-use crate::io;
-use crate::io::resource::Region;
-use crate::io::resource::Resource;
-use crate::io::Io;
-use crate::io::IoRaw;
-use crate::prelude::*;
+use crate::{
+ c_str,
+ device::{
+ Bound,
+ Device, //
+ },
+ devres::Devres,
+ io::{
+ self,
+ resource::{
+ Region,
+ Resource, //
+ },
+ Io,
+ IoRaw, //
+ },
+ prelude::*,
+};
/// An IO request for a specific device and resource.
pub struct IoRequest<'a> {
diff --git a/rust/kernel/io/poll.rs b/rust/kernel/io/poll.rs
index ebc29023d59d..e21ccf98b81a 100644
--- a/rust/kernel/io/poll.rs
+++ b/rust/kernel/io/poll.rs
@@ -5,7 +5,10 @@
//! C header: [`include/linux/iopoll.h`](srctree/include/linux/iopoll.h).
use crate::{
- error::{code::*, Result},
+ error::{
+ code::*,
+ Result, //
+ },
processor::cpu_relax,
task::might_sleep,
time::{
diff --git a/rust/kernel/io/resource.rs b/rust/kernel/io/resource.rs
index bea3ee0ed87b..81220493a7f3 100644
--- a/rust/kernel/io/resource.rs
+++ b/rust/kernel/io/resource.rs
@@ -5,12 +5,16 @@
//!
//! C header: [`include/linux/ioport.h`](srctree/include/linux/ioport.h)
-use core::ops::Deref;
-use core::ptr::NonNull;
-
-use crate::prelude::*;
-use crate::str::{CStr, CString};
-use crate::types::Opaque;
+use core::{
+ ops::Deref,
+ ptr::NonNull, //
+};
+
+use crate::{
+ prelude::*,
+ str::CString,
+ types::Opaque, //
+};
/// Resource Size type.
///
--
2.51.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] rust: io: cleanup imports and use "kernel vertical" style
2025-11-04 13:32 [PATCH] rust: io: cleanup imports and use "kernel vertical" style Danilo Krummrich
@ 2025-11-04 16:25 ` Danilo Krummrich
2025-11-06 9:46 ` Zhi Wang
0 siblings, 1 reply; 3+ messages in thread
From: Danilo Krummrich @ 2025-11-04 16:25 UTC (permalink / raw)
To: aliceryhl
Cc: daniel.almeida, ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh,
lossin, a.hindborg, tmgross, rust-for-linux, linux-kernel
On 11/4/25 2:32 PM, Danilo Krummrich wrote:
> diff --git a/rust/kernel/io/poll.rs b/rust/kernel/io/poll.rs
> index ebc29023d59d..e21ccf98b81a 100644
> --- a/rust/kernel/io/poll.rs
> +++ b/rust/kernel/io/poll.rs
> @@ -5,7 +5,10 @@
> //! C header: [`include/linux/iopoll.h`](srctree/include/linux/iopoll.h).
>
> use crate::{
> - error::{code::*, Result},
> + error::{
> + code::*,
> + Result, //
> + },
> processor::cpu_relax,
> task::might_sleep,
> time::{
Should instead be:
diff --git a/rust/kernel/io/poll.rs b/rust/kernel/io/poll.rs
index ebc29023d59d..b1a2570364f4 100644
--- a/rust/kernel/io/poll.rs
+++ b/rust/kernel/io/poll.rs
@@ -5,7 +5,7 @@
//! C header: [`include/linux/iopoll.h`](srctree/include/linux/iopoll.h).
use crate::{
- error::{code::*, Result},
+ prelude::*,
processor::cpu_relax,
task::might_sleep,
time::{
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] rust: io: cleanup imports and use "kernel vertical" style
2025-11-04 16:25 ` Danilo Krummrich
@ 2025-11-06 9:46 ` Zhi Wang
0 siblings, 0 replies; 3+ messages in thread
From: Zhi Wang @ 2025-11-06 9:46 UTC (permalink / raw)
To: Danilo Krummrich
Cc: aliceryhl, daniel.almeida, ojeda, alex.gaynor, boqun.feng, gary,
bjorn3_gh, lossin, a.hindborg, tmgross, rust-for-linux,
linux-kernel
On Tue, 4 Nov 2025 17:25:11 +0100
Danilo Krummrich <dakr@kernel.org> wrote:
> On 11/4/25 2:32 PM, Danilo Krummrich wrote:
> > diff --git a/rust/kernel/io/poll.rs b/rust/kernel/io/poll.rs
> > index ebc29023d59d..e21ccf98b81a 100644
> > --- a/rust/kernel/io/poll.rs
> > +++ b/rust/kernel/io/poll.rs
> > @@ -5,7 +5,10 @@
> > //! C header:
> > [`include/linux/iopoll.h`](srctree/include/linux/iopoll.h).
> > use crate::{
> > - error::{code::*, Result},
> > + error::{
> > + code::*,
> > + Result, //
> > + },
> > processor::cpu_relax,
> > task::might_sleep,
> > time::{
>
> Should instead be:
>
LGTM. Tested on the driver-core-testing branch with this extra change.
Reviewed-by: Zhi Wang <zhiw@nvidia.com>
> diff --git a/rust/kernel/io/poll.rs b/rust/kernel/io/poll.rs
> index ebc29023d59d..b1a2570364f4 100644
> --- a/rust/kernel/io/poll.rs
> +++ b/rust/kernel/io/poll.rs
> @@ -5,7 +5,7 @@
> //! C header:
> [`include/linux/iopoll.h`](srctree/include/linux/iopoll.h).
>
> use crate::{
> - error::{code::*, Result},
> + prelude::*,
> processor::cpu_relax,
> task::might_sleep,
> time::{
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-06 9:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 13:32 [PATCH] rust: io: cleanup imports and use "kernel vertical" style Danilo Krummrich
2025-11-04 16:25 ` Danilo Krummrich
2025-11-06 9:46 ` Zhi Wang
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).