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: move ResourceSize to top-level io module

Resource sizes are a general concept for dealing with physical
addresses, and not specific to the Resource type, which is just one way
to access physical addresses. Thus, move the typedef to the io module.

Still keep a re-export under resource. This avoids this commit from
being a flag-day, but I also think it's a useful re-export in general so
that you can import

use kernel::io::resource::{Resource, ResourceSize};

instead of having to write

use kernel::io::{
resource::Resource,
ResourceSize,
};

in the specific cases where you need ResourceSize because you are using
the Resource type. Therefore I think it makes sense to keep this
re-export indefinitely and it is *not* intended as a temporary re-export
for migration purposes.

Cc: stable@vger.kernel.org # for v6.18 [1]
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20251112-resource-phys-typedefs-v2-2-538307384f82@google.com
Link: https://lore.kernel.org/all/20251112-resource-phys-typedefs-v2-0-538307384f82@google.com/ [1]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

Alice Ryhl and committed by
Danilo Krummrich
dfd67993 919b7292

+7 -5
+6
rust/kernel/io.rs
··· 15 15 16 16 pub use resource::Resource; 17 17 18 + /// Resource Size type. 19 + /// 20 + /// This is a type alias to either `u32` or `u64` depending on the config option 21 + /// `CONFIG_PHYS_ADDR_T_64BIT`, and it can be a u64 even on 32-bit architectures. 22 + pub type ResourceSize = bindings::resource_size_t; 23 + 18 24 /// Raw representation of an MMIO region. 19 25 /// 20 26 /// By itself, the existence of an instance of this structure does not provide any guarantees that
+1 -5
rust/kernel/io/resource.rs
··· 16 16 types::Opaque, // 17 17 }; 18 18 19 - /// Resource Size type. 20 - /// 21 - /// This is a type alias to either `u32` or `u64` depending on the config option 22 - /// `CONFIG_PHYS_ADDR_T_64BIT`, and it can be a u64 even on 32-bit architectures. 23 - pub type ResourceSize = bindings::resource_size_t; 19 + pub use super::ResourceSize; 24 20 25 21 /// A region allocated from a parent [`Resource`]. 26 22 ///