[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/10] rust: qdev: make reset take a shared reference
From: |
Paolo Bonzini |
Subject: |
[PATCH 10/10] rust: qdev: make reset take a shared reference |
Date: |
Fri, 17 Jan 2025 10:26:57 +0100 |
Because register reset is within a borrow_mut() call, reset
does not need anymore a mut reference to the PL011State.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/hw/char/pl011/src/device.rs | 4 ++--
rust/qemu-api/src/qdev.rs | 2 +-
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 af0f451deb2..019c1617807 100644
--- a/rust/hw/char/pl011/src/device.rs
+++ b/rust/hw/char/pl011/src/device.rs
@@ -164,7 +164,7 @@ fn vmsd() -> Option<&'static VMStateDescription> {
Some(&device_class::VMSTATE_PL011)
}
const REALIZE: Option<fn(&mut Self)> = Some(Self::realize);
- const RESET: Option<fn(&mut Self)> = Some(Self::reset);
+ const RESET: Option<fn(&Self)> = Some(Self::reset);
}
impl PL011Registers {
@@ -604,7 +604,7 @@ pub fn realize(&mut self) {
}
}
- 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 686054e737a..4658409bebb 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
--
2.47.1
- [PATCH 00/10] rust: pl011: correctly use interior mutability, Paolo Bonzini, 2025/01/17
- [PATCH 01/10] rust: pl011: remove unnecessary "extern crate", Paolo Bonzini, 2025/01/17
- [PATCH 02/10] rust: pl011: hide unnecessarily "pub" items from outside pl011::device, Paolo Bonzini, 2025/01/17
- [PATCH 03/10] rust: pl011: extract conversion to RegisterOffset, Paolo Bonzini, 2025/01/17
- [PATCH 04/10] rust: pl011: extract CharBackend receive logic into a separate function, Paolo Bonzini, 2025/01/17
- [PATCH 06/10] rust: pl011: extract PL011Registers, Paolo Bonzini, 2025/01/17
- [PATCH 05/10] rust: pl011: pull interrupt updates out of read/write ops, Paolo Bonzini, 2025/01/17
- [PATCH 07/10] rust: pl011: wrap registers with BqlRefCell, Paolo Bonzini, 2025/01/17
- [PATCH 10/10] rust: qdev: make reset take a shared reference,
Paolo Bonzini <=
- [PATCH 08/10] rust: pl011: remove duplicate definitions, Paolo Bonzini, 2025/01/17
- [PATCH 09/10] rust: pl011: pull device-specific code out of MemoryRegionOps callbacks, Paolo Bonzini, 2025/01/17