Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Link: https://docs.kernel.org/rust/coding-guidelines.html#imports [1]
Reviewed-by: Zhi Wang <zhiw@nvidia.com>
Link: https://patch.msgid.link/20251104133301.59402-1-dakr@kernel.org
[ Use prelude::* in io/poll.rs. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

+32 -18
+4 -2
rust/kernel/io.rs
··· 4 4 //! 5 5 //! C header: [`include/asm-generic/io.h`](srctree/include/asm-generic/io.h) 6 6 7 - use crate::error::{code::EINVAL, Result}; 8 - use crate::{bindings, build_assert, ffi::c_void}; 7 + use crate::{ 8 + bindings, 9 + prelude::*, // 10 + }; 9 11 10 12 pub mod mem; 11 13 pub mod poll;
+18 -10
rust/kernel/io/mem.rs
··· 4 4 5 5 use core::ops::Deref; 6 6 7 - use crate::c_str; 8 - use crate::device::Bound; 9 - use crate::device::Device; 10 - use crate::devres::Devres; 11 - use crate::io; 12 - use crate::io::resource::Region; 13 - use crate::io::resource::Resource; 14 - use crate::io::Io; 15 - use crate::io::IoRaw; 16 - use crate::prelude::*; 7 + use crate::{ 8 + c_str, 9 + device::{ 10 + Bound, 11 + Device, // 12 + }, 13 + devres::Devres, 14 + io::{ 15 + self, 16 + resource::{ 17 + Region, 18 + Resource, // 19 + }, 20 + Io, 21 + IoRaw, // 22 + }, 23 + prelude::*, 24 + }; 17 25 18 26 /// An IO request for a specific device and resource. 19 27 pub struct IoRequest<'a> {
+1 -1
rust/kernel/io/poll.rs
··· 5 5 //! C header: [`include/linux/iopoll.h`](srctree/include/linux/iopoll.h). 6 6 7 7 use crate::{ 8 - error::{code::*, Result}, 8 + prelude::*, 9 9 processor::cpu_relax, 10 10 task::might_sleep, 11 11 time::{
+9 -5
rust/kernel/io/resource.rs
··· 5 5 //! 6 6 //! C header: [`include/linux/ioport.h`](srctree/include/linux/ioport.h) 7 7 8 - use core::ops::Deref; 9 - use core::ptr::NonNull; 8 + use core::{ 9 + ops::Deref, 10 + ptr::NonNull, // 11 + }; 10 12 11 - use crate::prelude::*; 12 - use crate::str::{CStr, CString}; 13 - use crate::types::Opaque; 13 + use crate::{ 14 + prelude::*, 15 + str::CString, 16 + types::Opaque, // 17 + }; 14 18 15 19 /// Resource Size type. 16 20 ///