summaryrefslogtreecommitdiff
path: root/rust/kernel/io/resource.rs
diff options
context:
space:
mode:
authorAlice Ryhl <aliceryhl@google.com>2025-11-12 09:48:35 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-01-02 12:57:05 +0100
commitc30ed32690b23e5994ec8de4338896b687d46287 (patch)
tree35c636be8b1bf0d2ca2eced4b07df27bb85779e6 /rust/kernel/io/resource.rs
parent52df55b21ede5fc0418972754f516a200a460709 (diff)
downloadlinux-c30ed32690b23e5994ec8de4338896b687d46287.tar.gz
linux-c30ed32690b23e5994ec8de4338896b687d46287.tar.bz2
linux-c30ed32690b23e5994ec8de4338896b687d46287.zip
rust: io: add typedef for phys_addr_t
commit dd6ff5cf56fb183fce605ca6a5bfce228cd8888b upstream. The C typedef phys_addr_t is missing an analogue in Rust, meaning that we end up using bindings::phys_addr_t or ResourceSize as a replacement in various places throughout the kernel. Fix that by introducing a new typedef on the Rust side. Place it next to the existing ResourceSize typedef since they're quite related to each other. 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-4-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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/kernel/io/resource.rs')
-rw-r--r--rust/kernel/io/resource.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/rust/kernel/io/resource.rs b/rust/kernel/io/resource.rs
index 7fed41fc2030..0e86ee9c98d8 100644
--- a/rust/kernel/io/resource.rs
+++ b/rust/kernel/io/resource.rs
@@ -12,7 +12,10 @@ use crate::prelude::*;
use crate::str::{CStr, CString};
use crate::types::Opaque;
-pub use super::ResourceSize;
+pub use super::{
+ PhysAddr,
+ ResourceSize, //
+};
/// A region allocated from a parent [`Resource`].
///
@@ -93,7 +96,7 @@ impl Resource {
/// the region, or a part of it, is already in use.
pub fn request_region(
&self,
- start: ResourceSize,
+ start: PhysAddr,
size: ResourceSize,
name: CString,
flags: Flags,
@@ -127,7 +130,7 @@ impl Resource {
}
/// Returns the start address of the resource.
- pub fn start(&self) -> ResourceSize {
+ pub fn start(&self) -> PhysAddr {
let inner = self.0.get();
// SAFETY: Safe as per the invariants of `Resource`.
unsafe { (*inner).start }