From: Rakesh Jeyasingh <rakeshjb010@gmail.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, rakeshjb010@gmail.com
Subject: [PATCH 2/2] rust/hw/char/pl011: Extract DR write logic into separate function
Date: Mon, 7 Apr 2025 23:43:27 +0530 [thread overview]
Message-ID: <20250407181327.171563-3-rakeshjb010@gmail.com> (raw)
In-Reply-To: <20250407181327.171563-1-rakeshjb010@gmail.com>
- Split `write()` DR case into `write_data_register()`
Signed-off-by: Rakesh Jeyasingh <rakeshjb010@gmail.com>
---
rust/hw/char/pl011/src/device.rs | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/device.rs
index 87153cdae1..bb2a0f207a 100644
--- a/rust/hw/char/pl011/src/device.rs
+++ b/rust/hw/char/pl011/src/device.rs
@@ -221,12 +221,7 @@ pub(self) fn write(
// eprintln!("write offset {offset} value {value}");
use RegisterOffset::*;
match offset {
- DR => {
- // interrupts always checked
- let _ = self.loopback_tx(value.into());
- self.int_level |= Interrupt::TX.0;
- return true;
- }
+ DR => return self.write_data_register(value),
RSR => {
self.receive_status_error_clear = 0.into();
}
@@ -307,6 +302,13 @@ fn read_data_register(&mut self, update: &mut bool) -> u32 {
u32::from(c)
}
+ fn write_data_register(&mut self, value: u32) -> bool {
+ // interrupts always checked
+ let _ = self.loopback_tx(value.into());
+ self.int_level |= Interrupt::TX.0;
+ true
+ }
+
#[inline]
#[must_use]
fn loopback_tx(&mut self, value: registers::Data) -> bool {
--
2.43.0
next prev parent reply other threads:[~2025-04-07 18:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 18:13 [PATCH 0/2] pl011: Refactor DR register handling in Rust implementation Rakesh Jeyasingh
2025-04-07 18:13 ` [PATCH 1/2] rust/hw/char/pl011: Extract extract DR read logic into separate function Rakesh Jeyasingh
2025-04-07 18:13 ` Rakesh Jeyasingh [this message]
2025-04-15 11:12 ` [PATCH 0/2] pl011: Refactor DR register handling in Rust implementation Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250407181327.171563-3-rakeshjb010@gmail.com \
--to=rakeshjb010@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).