rust: io: cleanup imports and use "kernel vertical" style
Subsystems (2)
Danilo Krummrich
maintainerPATCH 1/1 rust: io: cleanup imports and use "kernel vertical" style
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::*.
--- 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(-)
rust/kernel/io.rs +4 -2
@@ -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;
rust/kernel/io/mem.rs +18 -10
@@ -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> {
rust/kernel/io/poll.rs +4 -1
@@ -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::{
rust/kernel/io/resource.rs +10 -6
@@ -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. ///
Signature · 1 line
2.51.2
Danilo Krummrich
maintainerQuoted 6 lines · Danilo Krummrich
rust/kernel/io/poll.rs +0
-0@@ -5,7 +5,10 @@//! C header: [`include/linux/iopoll.h`](srctree/include/linux/iopoll.h).
rust/kernel/io/poll.rs line 14
Quoted 10 lines
rust/kernel/io/poll.rs +4
-1use crate ::{ - error::{code::*,Result }, + error::{ + code::*, +Result ,// + }, processor::cpu_relax, task::might_sleep, time::{
Should instead be:
rust/kernel/io/poll.rs +1 -1
@@ -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::{
Zhi Wang
Reviewed-byQuoted 11 lines · On Tue, 4 Nov 2025 17:25:11 +0100 Danilo Krummrich <[email protected]> wrote:
Quoted 10 lines · Danilo Krummrich
rust/kernel/io/poll.rs +0
-0@@ -5,7 +5,10 @@//! C header: [
include/linux/iopoll.h](srctree/include/linux/iopoll.h).
use crate::{rust/kernel/io/poll.rs +1
-1- error::{code::*, Result}, + error::{
Quoted 9 lines
rust/kernel/io/poll.rs line 11
Quoted 6 lines
rust/kernel/io/poll.rs +3
-0+ code::*, + Result, // + }, processor::cpu_relax, task::might_sleep, time::{Should instead be:
LGTM. Tested on the driver-core-testing branch with this extra change.
Quoted 15 lines
rust/kernel/io/poll.rs +0
-0@@ -5,7 +5,7 @@//! C header: [
include/linux/iopoll.h](srctree/include/linux/iopoll.h).use crate::{
rust/kernel/io/poll.rs +1
-1- error::{code::*, Result}, + prelude::*, processor::cpu_relax, task::might_sleep, time::{
Danilo Krummrich
maintainerQuoted 11 lines · Danilo Krummrich
Commit
46f045db5a94("rust: Addread_poll_timeout_atomicfunction") 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::*.
Applied to driver-core-testing, thanks!
[ Use prelude::* in io/poll.rs. - Danilo ]