From: Zhao Liu Date: Thu, 13 Nov 2025 05:19:22 +0000 (+0800) Subject: rust/hpet: Reduce unnecessary mutable self argument X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5839d27743b6826cbeb74de6b31401b9ee6917a;p=thirdparty%2Fqemu.git rust/hpet: Reduce unnecessary mutable self argument 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 Link: https://lore.kernel.org/r/20251113051937.4017675-8-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- diff --git a/rust/hw/timer/hpet/src/device.rs b/rust/hw/timer/hpet/src/device.rs index a2c5b7d04c..ddfdf5185a 100644 --- a/rust/hw/timer/hpet/src/device.rs +++ b/rust/hw/timer/hpet/src/device.rs @@ -318,7 +318,7 @@ impl HPETTimer { } } - 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 @@ impl HPETTimer { } } - 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 @@ impl HPETTimer { 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 @@ impl HPETState { 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 @@ impl HPETState { 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); } } }