summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-12-02 12:40:18 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2025-01-28 17:58:09 +0100
commitaf7edb1d326de0af565b48c663163c7e5050e03c (patch)
tree0c2c58e68abd690dac041068444c3f0ec6610441
parent20bcc96f458dafb9fcf84e240545c8136ac7443f (diff)
downloadfocaccia-qemu-af7edb1d326de0af565b48c663163c7e5050e03c.tar.gz
focaccia-qemu-af7edb1d326de0af565b48c663163c7e5050e03c.zip
rust: qdev: make reset take a shared reference
Because register reset is within a borrow_mut() call, reset
does not need anymore a mut reference to the PL011State.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--rust/hw/char/pl011/src/device.rs4
-rw-r--r--rust/qemu-api/src/qdev.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/device.rs
index bb6a6e4daf..8050ede9c8 100644
--- a/rust/hw/char/pl011/src/device.rs
+++ b/rust/hw/char/pl011/src/device.rs
@@ -172,7 +172,7 @@ impl DeviceImpl for PL011State {
         Some(&device_class::VMSTATE_PL011)
     }
     const REALIZE: Option<fn(&Self)> = Some(Self::realize);
-    const RESET: Option<fn(&mut Self)> = Some(Self::reset);
+    const RESET: Option<fn(&Self)> = Some(Self::reset);
 }
 
 impl PL011Registers {
@@ -631,7 +631,7 @@ impl PL011State {
         }
     }
 
-    pub fn reset(&mut self) {
+    pub fn reset(&self) {
         self.regs.borrow_mut().reset();
     }
 
diff --git a/rust/qemu-api/src/qdev.rs b/rust/qemu-api/src/qdev.rs
index 42429903aa..f4c75c752f 100644
--- a/rust/qemu-api/src/qdev.rs
+++ b/rust/qemu-api/src/qdev.rs
@@ -30,7 +30,7 @@ pub trait DeviceImpl {
     ///
     /// Rust does not yet support the three-phase reset protocol; this is
     /// usually okay for leaf classes.
-    const RESET: Option<fn(&mut Self)> = None;
+    const RESET: Option<fn(&Self)> = None;
 
     /// An array providing the properties that the user can set on the
     /// device.  Not a `const` because referencing statics in constants