[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250822041313.1410510-1-apopple@nvidia.com>
Date: Fri, 22 Aug 2025 14:13:13 +1000
From: Alistair Popple <apopple@...dia.com>
To: rust-for-linux@...r.kernel.org
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Krzysztof WilczyĆski <kwilczynski@...nel.org>,
John Hubbard <jhubbard@...dia.com>,
Alexandre Courbot <acourbot@...dia.com>,
linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org,
Alistair Popple <apopple@...dia.com>,
Danilo Krummrich <dakr@...nel.org>
Subject: [PATCH] rust: Update PCI resource_start()/len() to return ResourceSize
It's nicer to return native Rust types rather than the FFI bindings to a
type so update the PCI resource bindings to return ResourceSize.
Signed-off-by: Alistair Popple <apopple@...dia.com>
Suggested-by: Danilo Krummrich <dakr@...nel.org>
---
rust/kernel/pci.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
index cae4e274f7766..ef949ff10a10a 100644
--- a/rust/kernel/pci.rs
+++ b/rust/kernel/pci.rs
@@ -10,7 +10,7 @@
devres::Devres,
driver,
error::{from_result, to_result, Result},
- io::{Io, IoRaw},
+ io::{resource::ResourceSize, Io, IoRaw},
irq::{self, IrqRequest},
str::CStr,
sync::aref::ARef,
@@ -437,7 +437,7 @@ pub fn subsystem_device_id(&self) -> u16 {
}
/// Returns the start of the given PCI bar resource.
- pub fn resource_start(&self, bar: u32) -> Result<bindings::resource_size_t> {
+ pub fn resource_start(&self, bar: u32) -> Result<ResourceSize> {
if !Bar::index_is_valid(bar) {
return Err(EINVAL);
}
@@ -449,7 +449,7 @@ pub fn resource_start(&self, bar: u32) -> Result<bindings::resource_size_t> {
}
/// Returns the size of the given PCI bar resource.
- pub fn resource_len(&self, bar: u32) -> Result<bindings::resource_size_t> {
+ pub fn resource_len(&self, bar: u32) -> Result<ResourceSize> {
if !Bar::index_is_valid(bar) {
return Err(EINVAL);
}
--
2.47.2
Powered by blists - more mailing lists