diff mbox series

[Xen-devel,18/25,v7] xen/arm: vpl011: Add a new console_cleanup function in xenconsole

Message ID 1502095997-31219-19-git-send-email-bhupinder.thakur@linaro.org
State Superseded
Headers show
Series SBSA UART emulation support in Xen | expand

Commit Message

Bhupinder Thakur Aug. 7, 2017, 8:53 a.m. UTC
This patch introduces a new console_cleanup function. This function
frees up the console resources.

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 v6:
- Removed a null pointer check before calling free() as free() already checks that.

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

 tools/console/daemon/io.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Wei Liu Aug. 8, 2017, 1:29 p.m. UTC | #1
On Mon, Aug 07, 2017 at 02:23:10PM +0530, Bhupinder Thakur wrote:
> This patch introduces a new console_cleanup function. This function
> frees up the console resources.
> 
> Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox series

Patch

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 5c6da31..ff69e52 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -768,12 +768,8 @@  static void remove_domain(struct domain *dom)
 	}
 }
 
-static void cleanup_domain(struct domain *d)
+static void console_cleanup(struct console *con)
 {
-	struct console *con = &d->console;
-
-	console_close_tty(con);
-
 	if (con->log_fd != -1) {
 		close(con->log_fd);
 		con->log_fd = -1;
@@ -784,6 +780,15 @@  static void cleanup_domain(struct domain *d)
 
 	free(con->xspath);
 	con->xspath = NULL;
+}
+
+static void cleanup_domain(struct domain *d)
+{
+	struct console *con = &d->console;
+
+	console_close_tty(con);
+
+	console_cleanup(con);
 
 	remove_domain(d);
 }