From: Zhao Liu <[email protected]> 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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Bonzini <[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 a2c5b7d04c6..ddfdf5185ad 100644 --- a/rust/hw/timer/hpet/src/device.rs +++ b/rust/hw/timer/hpet/src/device.rs @@ -318,7 +318,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() { @@ -344,7 +344,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" @@ -382,7 +382,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(); @@ -656,7 +656,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(); } } @@ -680,7 +680,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.52.0
