qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 08/13] be-hci: use backend functions


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 08/13] be-hci: use backend functions
Date: Fri, 26 May 2017 12:39:31 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Hi Marc-André,

On 05/09/2017 08:33 AM, Marc-André Lureau wrote:
Avoid accessing CharBackend directly, use qemu_chr_be_* methods instead.

be->chr_read should exists if qemu_chr_be_can_write() is true.

(use qemu_chr_be_write(), _impl() bypasses replay)

Signed-off-by: Marc-André Lureau <address@hidden>
---
 hw/bt/hci-csr.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/hw/bt/hci-csr.c b/hw/bt/hci-csr.c
index 0f2021086d..d13192b9b5 100644
--- a/hw/bt/hci-csr.c
+++ b/hw/bt/hci-csr.c
@@ -82,17 +82,14 @@ enum {

 static inline void csrhci_fifo_wake(struct csrhci_s *s)
 {
-    Chardev *chr = (Chardev *)s;
-    CharBackend *be = chr->be;
+    Chardev *chr = CHARDEV(s);

     if (!s->enable || !s->out_len)
         return;

     /* XXX: Should wait for s->modem_state & CHR_TIOCM_RTS? */
-    if (be && be->chr_can_read && be->chr_can_read(be->opaque) &&
-        be->chr_read) {
+    if (qemu_chr_be_can_write(chr)) {

Correct.

-        be->chr_read(be->opaque,
-                     s->outfifo + s->out_start++, 1);
+        qemu_chr_be_write(chr, s->outfifo + s->out_start++, 1);

Here the difference with qemu_chr_be_write_impl() is the check with REPLAY_MODE_PLAY which is what you want from your commit message, right? I'm not sure if it makes sens or not to instead call _impl() directly.

         s->out_len--;
         if (s->out_start >= s->out_size) {
             s->out_start = 0;


Regards,

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]