Re: [Xen-devel] [PATCH 14/25 v7] xen/arm: vpl011: Add a new maybe_add_console_tty_fd function in xenconsole

2017-08-08 Thread Wei Liu
On Mon, Aug 07, 2017 at 02:23:06PM +0530, Bhupinder Thakur wrote:
> This patch introduces a new maybe_add_console_tty_fd function. This function
> adds the tty fd to the list of polled fds.
> 
> Signed-off-by: Bhupinder Thakur 
> Reviewed-by: Stefano Stabellini 

Acked-by: Wei Liu 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH 14/25 v7] xen/arm: vpl011: Add a new maybe_add_console_tty_fd function in xenconsole

2017-08-07 Thread Bhupinder Thakur
This patch introduces a new maybe_add_console_tty_fd function. This function
adds the tty fd to the list of polled fds.

Signed-off-by: Bhupinder Thakur 
Reviewed-by: Stefano Stabellini 
---
CC: Ian Jackson 
CC: Wei Liu 
CC: Stefano Stabellini 
CC: Julien Grall 

Changes since v6:
- Renamed add_console_tty_fd to maybe_add_console_tty_fd since it 
  adds the tty FD to the poll list conditionally.
- I have retained the reviewed-by tag as only the function name has been
  changed.

Changes since v5:
- Split this change in a separate patch.

 tools/console/daemon/io.c | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 3483252..a0b35da 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -1067,6 +1067,22 @@ static void maybe_add_console_evtchn_fd(struct console 
*con, void *data)
*((long long *)data) = next_timeout;
 }
 
+static void maybe_add_console_tty_fd(struct console *con)
+{
+   if (con->master_fd != -1) {
+   short events = 0;
+   if (!con->d->is_dead && ring_free_bytes(con))
+   events |= POLLIN;
+
+   if (!buffer_empty(>buffer))
+   events |= POLLOUT;
+
+   if (events)
+   con->master_pollfd_idx =
+   set_fds(con->master_fd, events|POLLPRI);
+   }
+}
+
 void handle_io(void)
 {
int ret;
@@ -1146,19 +1162,7 @@ void handle_io(void)
 
maybe_add_console_evtchn_fd(con, (void *)_timeout);
 
-   if (con->master_fd != -1) {
-   short events = 0;
-   if (!d->is_dead && ring_free_bytes(con))
-   events |= POLLIN;
-
-   if (!buffer_empty(>buffer))
-   events |= POLLOUT;
-
-   if (events)
-   con->master_pollfd_idx =
-   set_fds(con->master_fd,
-   events|POLLPRI);
-   }
+   maybe_add_console_tty_fd(con);
}
 
/* If any domain has been rate limited, we need to work
-- 
2.7.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel