mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alistair Popple <apopple@nvidia.com>
To: rust-for-linux@vger.kernel.org
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Alistair Popple" <apopple@nvidia.com>,
	"Danilo Krummrich" <dakr@kernel.org>
Subject: [PATCH] rust: Update PCI resource_start()/len() to return ResourceSize
Date: Fri, 22 Aug 2025 14:13:13 +1000	[thread overview]
Message-ID: <20250822041313.1410510-1-apopple@nvidia.com> (raw)

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


             reply	other threads:[~2025-08-22  4:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22  4:13 Alistair Popple [this message]
2025-08-22  7:44 ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250822041313.1410510-1-apopple@nvidia.com \
    --to=apopple@nvidia.com \
    --cc=acourbot@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=dakr@kernel.org \
    --cc=jhubbard@nvidia.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®