summary refs log tree commit diff stats
path: root/rust/hw/char/pl011/src/memory_ops.rs
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-10-24 13:53:59 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2024-11-05 14:18:16 +0100
commit9f7d4520d679364f7ca95b7ddb899ff084e7d7c6 (patch)
tree24a6141ec40e14fed14dec97e8e6b1d9fd446f8d /rust/hw/char/pl011/src/memory_ops.rs
parent646b5378e0ff4b369ea7cc050689c1c65ed041a7 (diff)
downloadfocaccia-qemu-9f7d4520d679364f7ca95b7ddb899ff084e7d7c6.tar.gz
focaccia-qemu-9f7d4520d679364f7ca95b7ddb899ff084e7d7c6.zip
rust: use std::os::raw instead of core::ffi
core::ffi::c_* types were introduced in Rust 1.64.0.  Use the older types
in std::os::raw, which are now aliases of the types in core::ffi.  There is
no need to compile QEMU as no_std, so this is acceptable as long as we support
a version of Debian with Rust 1.63.0.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/hw/char/pl011/src/memory_ops.rs')
-rw-r--r--rust/hw/char/pl011/src/memory_ops.rs14
1 files changed, 3 insertions, 11 deletions
diff --git a/rust/hw/char/pl011/src/memory_ops.rs b/rust/hw/char/pl011/src/memory_ops.rs
index fc69922fbf..169d485a4d 100644
--- a/rust/hw/char/pl011/src/memory_ops.rs
+++ b/rust/hw/char/pl011/src/memory_ops.rs
@@ -3,6 +3,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 
 use core::ptr::NonNull;
+use std::os::raw::{c_uint, c_void};
 
 use qemu_api::{bindings::*, zeroable::Zeroable};
 
@@ -22,11 +23,7 @@ pub static PL011_OPS: MemoryRegionOps = MemoryRegionOps {
     },
 };
 
-unsafe extern "C" fn pl011_read(
-    opaque: *mut core::ffi::c_void,
-    addr: hwaddr,
-    size: core::ffi::c_uint,
-) -> u64 {
+unsafe extern "C" fn pl011_read(opaque: *mut c_void, addr: hwaddr, size: c_uint) -> u64 {
     assert!(!opaque.is_null());
     let mut state = unsafe { NonNull::new_unchecked(opaque.cast::<PL011State>()) };
     let val = unsafe { state.as_mut().read(addr, size) };
@@ -43,12 +40,7 @@ unsafe extern "C" fn pl011_read(
     }
 }
 
-unsafe extern "C" fn pl011_write(
-    opaque: *mut core::ffi::c_void,
-    addr: hwaddr,
-    data: u64,
-    _size: core::ffi::c_uint,
-) {
+unsafe extern "C" fn pl011_write(opaque: *mut c_void, addr: hwaddr, data: u64, _size: c_uint) {
     unsafe {
         assert!(!opaque.is_null());
         let mut state = NonNull::new_unchecked(opaque.cast::<PL011State>());