* [PATCH] rust: Update PCI resource_start()/len() to return ResourceSize
@ 2025-08-22 4:13 Alistair Popple
2025-08-22 7:44 ` Alice Ryhl
0 siblings, 1 reply; 2+ messages in thread
From: Alistair Popple @ 2025-08-22 4:13 UTC (permalink / raw)
To: rust-for-linux
Cc: Bjorn Helgaas, Krzysztof Wilczyński, John Hubbard,
Alexandre Courbot, linux-pci, linux-kernel, Alistair Popple,
Danilo Krummrich
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@nvidia.com>
Suggested-by: Danilo Krummrich <dakr@kernel.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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] rust: Update PCI resource_start()/len() to return ResourceSize
2025-08-22 4:13 [PATCH] rust: Update PCI resource_start()/len() to return ResourceSize Alistair Popple
@ 2025-08-22 7:44 ` Alice Ryhl
0 siblings, 0 replies; 2+ messages in thread
From: Alice Ryhl @ 2025-08-22 7:44 UTC (permalink / raw)
To: Alistair Popple
Cc: rust-for-linux, Bjorn Helgaas, Krzysztof Wilczyński,
John Hubbard, Alexandre Courbot, linux-pci, linux-kernel,
Danilo Krummrich
On Fri, Aug 22, 2025 at 6:13 AM Alistair Popple <apopple@nvidia.com> wrote:
>
> 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@nvidia.com>
> Suggested-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> 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},
Maybe we want ResourceSize re-exported from kernel::io to make this simpler?
Alice
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-22 7:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-22 4:13 [PATCH] rust: Update PCI resource_start()/len() to return ResourceSize Alistair Popple
2025-08-22 7:44 ` Alice Ryhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®