diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2024-12-04 21:49:34 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-12-19 19:36:38 +0100 |
commit | bf9987c06eb8274c2503174b944b8fbe94cc24d7 (patch) | |
tree | a6523bac815244364687cb1dd11da2d440197293 /rust/hw/char/pl011/src | |
parent | 6b4f7b0705be31c7df6ea01c81a42a42950959a9 (diff) | |
download | qemu-bf9987c06eb8274c2503174b944b8fbe94cc24d7.zip qemu-bf9987c06eb8274c2503174b944b8fbe94cc24d7.tar.gz qemu-bf9987c06eb8274c2503174b944b8fbe94cc24d7.tar.bz2 |
rust: pl011: simplify handling of the FIFO enabled bit in LCR
Use ==/!= instead of going through bool and xor.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/hw/char/pl011/src')
-rw-r--r-- | rust/hw/char/pl011/src/device.rs | 6 | ||||
-rw-r--r-- | rust/hw/char/pl011/src/lib.rs | 6 |
2 files changed, 2 insertions, 10 deletions
diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/device.rs index 4d620b4..18cc122 100644 --- a/rust/hw/char/pl011/src/device.rs +++ b/rust/hw/char/pl011/src/device.rs @@ -302,9 +302,7 @@ impl PL011State { Ok(LCR_H) => { let new_val: registers::LineControl = value.into(); // Reset the FIFO state on FIFO enable or disable - if bool::from(self.line_control.fifos_enabled()) - ^ bool::from(new_val.fifos_enabled()) - { + if self.line_control.fifos_enabled() != new_val.fifos_enabled() { self.reset_rx_fifo(); self.reset_tx_fifo(); } @@ -497,7 +495,7 @@ impl PL011State { #[inline] pub fn fifo_enabled(&self) -> bool { - matches!(self.line_control.fifos_enabled(), registers::Mode::FIFO) + self.line_control.fifos_enabled() == registers::Mode::FIFO } #[inline] diff --git a/rust/hw/char/pl011/src/lib.rs b/rust/hw/char/pl011/src/lib.rs index 0747e13..69064d6 100644 --- a/rust/hw/char/pl011/src/lib.rs +++ b/rust/hw/char/pl011/src/lib.rs @@ -419,12 +419,6 @@ pub mod registers { FIFO = 1, } - impl From<Mode> for bool { - fn from(val: Mode) -> Self { - matches!(val, Mode::FIFO) - } - } - #[bitsize(2)] #[derive(Clone, Copy, Debug, Eq, FromBits, PartialEq)] /// `WLEN` Word length, field of [Line Control register](LineControl). |