]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
xen/arm: vpl011: Add a new maybe_add_console_tty_fd function in xenconsole
authorBhupinder Thakur <bhupinder.thakur@linaro.org>
Wed, 27 Sep 2017 06:13:23 +0000 (11:43 +0530)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 3 Oct 2017 22:23:37 +0000 (15:23 -0700)
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 <bhupinder.thakur@linaro.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/console/daemon/io.c

index 3483252eb0617d9a94ee8878a524b9d9d905a36e..a0b35da45ca68fd9934f09b31a962bbc70d685b3 100644 (file)
@@ -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(&con->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 *)&next_timeout);
 
-                       if (con->master_fd != -1) {
-                               short events = 0;
-                               if (!d->is_dead && ring_free_bytes(con))
-                                       events |= POLLIN;
-
-                               if (!buffer_empty(&con->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