[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 05/10] rust: pl011: pull interrupt updates out of read/write
From: |
Zhao Liu |
Subject: |
Re: [PATCH 05/10] rust: pl011: pull interrupt updates out of read/write ops |
Date: |
Thu, 23 Jan 2025 00:50:41 +0800 |
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 <pbonzini@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 <pbonzini@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.liu@intel.com>
- Re: [PATCH 03/10] rust: pl011: extract conversion to RegisterOffset, (continued)
[PATCH 04/10] rust: pl011: extract CharBackend receive logic into a separate function, Paolo Bonzini, 2025/01/17
[PATCH 06/10] rust: pl011: extract PL011Registers, Paolo Bonzini, 2025/01/17
[PATCH 05/10] rust: pl011: pull interrupt updates out of read/write ops, Paolo Bonzini, 2025/01/17
- Re: [PATCH 05/10] rust: pl011: pull interrupt updates out of read/write ops,
Zhao Liu <=
[PATCH 07/10] rust: pl011: wrap registers with BqlRefCell, Paolo Bonzini, 2025/01/17
[PATCH 10/10] rust: qdev: make reset take a shared reference, Paolo Bonzini, 2025/01/17
[PATCH 08/10] rust: pl011: remove duplicate definitions, Paolo Bonzini, 2025/01/17