From: herculoxz <abhinav.ogl@gmail.com>
To: linux-pci@vger.kernel.org
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
dakr@kernel.org, bhelgaas@google.com, kwilczynski@kernel.org,
ojeda@kernel.org, alex.gaynor@gmail.com, boqun.feng@gmail.com,
gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org,
a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
Abhinav Ananthu <abhinav.ogl@gmail.com>
Subject: [PATCH v2] rust: pci: Use explicit types in FFI callbacks
Date: Tue, 29 Jul 2025 15:59:53 +0530 [thread overview]
Message-ID: <20250729102953.141412-1-abhinav.ogl@gmail.com> (raw)
From: Abhinav Ananthu <abhinav.ogl@gmail.com>
Update PCI FFI callback signatures to use `c_int` from the prelude,
instead of accessing it via `kernel::ffi::c_int`.
This follows Rust-for-Linux coding guidelines and improves ABI
correctness when interfacing with C code.
Signed-off-by: Abhinav Ananthu <abhinav.ogl@gmail.com>
---
rust/kernel/pci.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
index 5ce07999168e..fbeeaec4e044 100644
--- a/rust/kernel/pci.rs
+++ b/rust/kernel/pci.rs
@@ -61,7 +61,7 @@ impl<T: Driver + 'static> Adapter<T> {
extern "C" fn probe_callback(
pdev: *mut bindings::pci_dev,
id: *const bindings::pci_device_id,
- ) -> kernel::ffi::c_int {
+ ) -> c_int {
// SAFETY: The PCI bus only ever calls the probe callback with a valid pointer to a
// `struct pci_dev`.
//
@@ -333,7 +333,7 @@ unsafe fn do_release(pdev: &Device, ioptr: usize, num: i32) {
// `ioptr` is valid by the safety requirements.
// `num` is valid by the safety requirements.
unsafe {
- bindings::pci_iounmap(pdev.as_raw(), ioptr as *mut kernel::ffi::c_void);
+ bindings::pci_iounmap(pdev.as_raw(), ioptr as *mut c_void);
bindings::pci_release_region(pdev.as_raw(), num);
}
}
--
2.34.1
next reply other threads:[~2025-07-29 10:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 10:29 herculoxz [this message]
2025-07-29 10:52 ` [PATCH v2] rust: pci: Use explicit types in FFI callbacks Miguel Ojeda
2025-07-29 14:45 ` Danilo Krummrich
2025-07-30 7:56 ` Alice Ryhl
2025-07-29 16:35 ` Benno Lossin
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=20250729102953.141412-1-abhinav.ogl@gmail.com \
--to=abhinav.ogl@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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;
as well as URLs for NNTP newsgroup(s).