]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: io: move ResourceSize to top-level io module
authorAlice Ryhl <aliceryhl@google.com>
Wed, 12 Nov 2025 09:48:33 +0000 (09:48 +0000)
committerDanilo Krummrich <dakr@kernel.org>
Thu, 13 Nov 2025 09:16:51 +0000 (20:16 +1100)
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/
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/io.rs
rust/kernel/io/resource.rs

index 1aa9495f777477fe808bf52953927b8e602f3c1b..b8d0fb27f6aea157e3bca48a0eed0cfec082d530 100644 (file)
@@ -15,6 +15,12 @@ pub mod resource;
 
 pub use resource::Resource;
 
+/// Resource Size type.
+///
+/// This is a type alias to either `u32` or `u64` depending on the config option
+/// `CONFIG_PHYS_ADDR_T_64BIT`, and it can be a u64 even on 32-bit architectures.
+pub type ResourceSize = bindings::resource_size_t;
+
 /// Raw representation of an MMIO region.
 ///
 /// By itself, the existence of an instance of this structure does not provide any guarantees that
index e294af96b374a3f52ffb931c40c608e8ba381e8f..eb25cf9b4c9043b85146cf067dc069d05e1865a0 100644 (file)
@@ -16,11 +16,7 @@ use crate::{
     types::Opaque, //
 };
 
-/// Resource Size type.
-///
-/// This is a type alias to either `u32` or `u64` depending on the config option
-/// `CONFIG_PHYS_ADDR_T_64BIT`, and it can be a u64 even on 32-bit architectures.
-pub type ResourceSize = bindings::resource_size_t;
+pub use super::ResourceSize;
 
 /// A region allocated from a parent [`Resource`].
 ///