diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-01-25 00:28:09 +0100 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-01-28 17:58:09 +0100 |
| commit | a1ab4eed8d37e4afb78367d766edeadfdb489027 (patch) | |
| tree | 5992761456301abdaba0b2599b236fc7c5ddfe23 /rust/hw/char/pl011/src/device_class.rs | |
| parent | 49bfe63f297f71c5d7e1578a8b69953430b7b532 (diff) | |
| download | focaccia-qemu-a1ab4eed8d37e4afb78367d766edeadfdb489027.tar.gz focaccia-qemu-a1ab4eed8d37e4afb78367d766edeadfdb489027.zip | |
rust: pl011: wrap registers with BqlRefCell
This is a step towards making memory ops use a shared reference to the device type; it's not yet possible due to the calls to character device functions. Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/hw/char/pl011/src/device_class.rs')
| -rw-r--r-- | rust/hw/char/pl011/src/device_class.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rust/hw/char/pl011/src/device_class.rs b/rust/hw/char/pl011/src/device_class.rs index d94b98de7b..8a157a663f 100644 --- a/rust/hw/char/pl011/src/device_class.rs +++ b/rust/hw/char/pl011/src/device_class.rs @@ -6,7 +6,7 @@ use core::ptr::NonNull; use std::os::raw::{c_int, c_void}; use qemu_api::{ - bindings::*, c_str, vmstate_clock, vmstate_fields, vmstate_of, vmstate_struct, + bindings::*, c_str, prelude::*, vmstate_clock, vmstate_fields, vmstate_of, vmstate_struct, vmstate_subsections, vmstate_unused, zeroable::Zeroable, }; @@ -31,8 +31,8 @@ static VMSTATE_PL011_CLOCK: VMStateDescription = VMStateDescription { }; extern "C" fn pl011_post_load(opaque: *mut c_void, version_id: c_int) -> c_int { - let mut state = NonNull::new(opaque).unwrap().cast::<PL011State>(); - let result = unsafe { state.as_mut().post_load(version_id as u32) }; + let state = NonNull::new(opaque).unwrap().cast::<PL011State>(); + let result = unsafe { state.as_ref().post_load(version_id as u32) }; if result.is_err() { -1 } else { @@ -71,7 +71,7 @@ pub static VMSTATE_PL011: VMStateDescription = VMStateDescription { post_load: Some(pl011_post_load), fields: vmstate_fields! { vmstate_unused!(core::mem::size_of::<u32>()), - vmstate_struct!(PL011State, regs, &VMSTATE_PL011_REGS, PL011Registers), + vmstate_struct!(PL011State, regs, &VMSTATE_PL011_REGS, BqlRefCell<PL011Registers>), }, subsections: vmstate_subsections! { VMSTATE_PL011_CLOCK |