Methods of Timer and InterruptSource have been made as safe, so make the related methods of HPETTimer to accept immutable self reference.
Signed-off-by: Zhao Liu <[email protected]> --- rust/hw/timer/hpet/src/device.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rust/hw/timer/hpet/src/device.rs b/rust/hw/timer/hpet/src/device.rs index 3564aa79c6e5..5e08b91494cf 100644 --- a/rust/hw/timer/hpet/src/device.rs +++ b/rust/hw/timer/hpet/src/device.rs @@ -324,7 +324,7 @@ fn get_int_route(&self) -> usize { } } - fn set_irq(&mut self, set: bool) { + fn set_irq(&self, set: bool) { let route = self.get_int_route(); if set && self.is_int_enabled() && self.get_state().is_hpet_enabled() { @@ -350,7 +350,7 @@ fn set_irq(&mut self, set: bool) { } } - fn update_irq(&mut self, set: bool) { + fn update_irq(&self, set: bool) { // If Timer N Interrupt Enable bit is 0, "the timer will // still operate and generate appropriate status bits, but // will not cause an interrupt" @@ -388,7 +388,7 @@ fn set_timer(&mut self) { self.arm_timer(self.cmp64); } - fn del_timer(&mut self) { + fn del_timer(&self) { // Just remove the timer from the timer_list without destroying // this timer instance. self.qemu_timer.delete(); @@ -657,7 +657,7 @@ fn set_cfg_reg(&self, shift: u32, len: u32, val: u64) { self.counter.set(self.get_ticks()); for timer in self.timers.iter().take(self.num_timers) { - timer.borrow_mut().del_timer(); + timer.borrow().del_timer(); } } @@ -681,7 +681,7 @@ fn set_int_status_reg(&self, shift: u32, _len: u32, val: u64) { for (index, timer) in self.timers.iter().take(self.num_timers).enumerate() { if cleared & (1 << index) != 0 { - timer.borrow_mut().update_irq(false); + timer.borrow().update_irq(false); } } } -- 2.34.1
