[Xen-devel,14/25,v6] xen/arm: vpl011: Add a new add_console_tty_fd function in xenconsole

Message ID 1500296815-10243-15-git-send-email-bhupinder.thakur@linaro.org
State New
Headers show
Series
  • SBSA UART emulation support in Xen
Related show

Commit Message

Bhupinder Thakur July 17, 2017, 1:06 p.m.
This patch introduces a new 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>
---
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>

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

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

Comments

Wei Liu July 18, 2017, 11:52 a.m. | #1
On Mon, Jul 17, 2017 at 06:36:44PM +0530, Bhupinder Thakur wrote:
> This patch introduces a new 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>
> ---
> CC: Ian Jackson <ian.jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien.grall@arm.com>
> 
> 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 dc96203..6321d78 100644
> --- a/tools/console/daemon/io.c
> +++ b/tools/console/daemon/io.c
> @@ -1069,6 +1069,22 @@ static void add_console_evtchn_fd(struct console *con, void *data)
>  	*((long long *)data) = next_timeout;
>  }
>  
> +static void add_console_tty_fd(struct console *con)

Add maybe_ prefix please.
Stefano Stabellini July 18, 2017, 7:48 p.m. | #2
On Mon, 17 Jul 2017, Bhupinder Thakur wrote:
> This patch introduces a new 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>


> ---
> CC: Ian Jackson <ian.jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien.grall@arm.com>
> 
> 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 dc96203..6321d78 100644
> --- a/tools/console/daemon/io.c
> +++ b/tools/console/daemon/io.c
> @@ -1069,6 +1069,22 @@ static void add_console_evtchn_fd(struct console *con, void *data)
>  	*((long long *)data) = next_timeout;
>  }
>  
> +static void 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;
> @@ -1148,19 +1164,7 @@ void handle_io(void)
>  
>  			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);
> -			}
> +			add_console_tty_fd(con);
>  		}
>  
>  		/* If any domain has been rate limited, we need to work
> -- 
> 2.7.4
>

Patch hide | download patch | download mbox

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index dc96203..6321d78 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -1069,6 +1069,22 @@  static void add_console_evtchn_fd(struct console *con, void *data)
 	*((long long *)data) = next_timeout;
 }
 
+static void 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;
@@ -1148,19 +1164,7 @@  void handle_io(void)
 
 			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);
-			}
+			add_console_tty_fd(con);
 		}
 
 		/* If any domain has been rate limited, we need to work