On Fri, Jan 17, 2025 at 10:26:52AM +0100, Paolo Bonzini wrote: > Date: Fri, 17 Jan 2025 10:26:52 +0100 > From: Paolo Bonzini <pbonz...@redhat.com> > Subject: [PATCH 05/10] rust: pl011: pull interrupt updates out of > read/write ops > X-Mailer: git-send-email 2.47.1 > > qemu_irqs are not part of the vmstate, therefore they will remain in > PL011State. Update them if needed after regs_read()/regs_write(). > > Apply #[must_use] to functions that return whether the interrupt state > could have changed, so that it's harder to forget the call to update(). > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > rust/hw/char/pl011/src/device.rs | 68 ++++++++++++++++++-------------- > 1 file changed, 38 insertions(+), 30 deletions(-) >
[snip] > > pub fn event(&mut self, event: QEMUChrEvent) { > if event == bindings::QEMUChrEvent::CHR_EVENT_BREAK && > !self.loopback_enabled() { > - self.put_fifo(registers::Data::BREAK.into()); > + let update = self.put_fifo(registers::Data::BREAK.into()); We can omit this `update` variable. > + if update { > + self.update(); > + } > } > } Nice refactoring! Reviewed-by: Zhao Liu <zhao....@intel.com>