mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
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>
This commit is contained in:
parent
20bcc96f45
commit
af7edb1d32
2 changed files with 3 additions and 3 deletions
|
@ -172,7 +172,7 @@ impl DeviceImpl for PL011State {
|
||||||
Some(&device_class::VMSTATE_PL011)
|
Some(&device_class::VMSTATE_PL011)
|
||||||
}
|
}
|
||||||
const REALIZE: Option<fn(&Self)> = Some(Self::realize);
|
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 {
|
impl PL011Registers {
|
||||||
|
@ -631,7 +631,7 @@ impl PL011State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&self) {
|
||||||
self.regs.borrow_mut().reset();
|
self.regs.borrow_mut().reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub trait DeviceImpl {
|
||||||
///
|
///
|
||||||
/// Rust does not yet support the three-phase reset protocol; this is
|
/// Rust does not yet support the three-phase reset protocol; this is
|
||||||
/// usually okay for leaf classes.
|
/// 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
|
/// An array providing the properties that the user can set on the
|
||||||
/// device. Not a `const` because referencing statics in constants
|
/// device. Not a `const` because referencing statics in constants
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue