From patchwork Mon Aug 28 08:56:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 111111 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4548018qge; Mon, 28 Aug 2017 01:58:47 -0700 (PDT) X-Received: by 10.107.57.132 with SMTP id g126mr5321825ioa.352.1503910727126; Mon, 28 Aug 2017 01:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503910727; cv=none; d=google.com; s=arc-20160816; b=fBgRDFiDPw6LpjMgs/+GMfBODUeekknMKcYGZ8Nnt/DrB5UK9+9hRzzHEM9cbNbOEI zGP8SWVxfoCaCpuTbjz6ioOZsLEE1aruULwhIwLutqNvu9yrTRY0zSou59NxkJ3+VzYP sJxgSxvBQwDt7eHQHAsG1WuTwtA9KwUsNCRItvvBb6e1hJaJsYT2LQ4GS9Cj8SEcYpCq jYqJfjeqiQDjPGy43OYelypa8uBIzZAFzRMplEXDeMsymIacS0u/iy+uGfJKcpkdXrjs NuMHIUnNvZlfMHn2AgmLJx8cPs4gkG3ZZdhtzt/4nbsuOj3L/PgHBOdJUicganLC27vS BzZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=Bg6fT8CW/IMdJdKHwnAiGPV2040T6kKQ60tEt4w7sHw=; b=aAi9DxK4jkwFi7nnkagoGfoW3kB4H1bdBdYlVA/ahpVDnFX4uVypbh9bEcju6vHlnf RICTVHmtCm+YUNrHjYXndpJdPfpWOizSLX4a0B94UygBOmJeWpaOdrcznFv43Oo7T6gF M3K82GzRF+cCYfH49hwsxyZrqr3+O0fgjo0z50TvrhpjsVEe1vgyxR4oRuGvjRH3FaX1 Vw791lq8kGE/OyVKTsLovbqhj507AghIBW6QYk+t1T+Z5jQWLjNx7y8ArR7+7NE4nQM5 IrLcU/Ud9X0/6VLG/5pEVd0N47Aco213M29Kkh3wlbtEJ1xOzMxmjiW26gDD7/PPgui4 hE2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TYQde5v2; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f1si11898949iof.45.2017.08.28.01.58.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 01:58:47 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TYQde5v2; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmFrF-0005St-KR; Mon, 28 Aug 2017 08:57:21 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmFrD-0005Py-Q8 for xen-devel@lists.xenproject.org; Mon, 28 Aug 2017 08:57:19 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 3B/B1-02962-FEAD3A95; Mon, 28 Aug 2017 08:57:19 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRWlGSWpSXmKPExsXiVRusrfvu1uJ Igy8zlCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozja5exFmzmrpiwMrKB8RlnFyMXh5DAdEaJ rw/mMYE4LALzmCXuHzrHCOJICPSzSlxc94+ti5ETyEmTuPbwBjOEXS1xZMkdsLiQgJbE0VOzW SFG7WeSaLq6gKWLkYODTcBEYlaHBEiNiICSxL1Vk8E2MAvMZ5RomtQL1iwsEC2xe0cbI4jNIq AqsfpML9gCXgEfiQkrbrFDLJOTuHmuEyzOCRTfsfYuO8Rib4mu1x9YJzAKLGBkWMWoXpxaVJZ apGuol1SUmZ5RkpuYmaNraGCml5taXJyYnpqTmFSsl5yfu4kRGFgMQLCDcedzp0OMkhxMSqK8 OysWRwrxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4D1zEygnWJSanlqRlpkDDHGYtAQHj5II7weQN G9xQWJucWY6ROoUoy7HpAPbvzAJseTl56VKifM+BCkSACnKKM2DGwGLt0uMslLCvIxARwnxFK QW5WaWoMq/YhTnYFQS5j0IMoUnM68EbtMroCOYgI5QFFwIckRJIkJKqoHRuPO9a5igYN/U1L0 5XwV9LJInPXsb1cP8ZuqbhqqILQlbFv758nbBFMdE12VnZgjz7pj6IDtHl7Pp18yIYzPvlsrK 2aZ1PH6pIZBxw/LW/HTFKWuPz3xdckXnP+cWbXsjRd0Z7YK/3Xb8OmL662vK3rptRkFsf3YtV fujtd9VfdW6JTrrZI69UWIpzkg01GIuKk4EAOLxolayAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-27.messagelabs.com!1503910637!60894063!1 X-Originating-IP: [74.125.83.43] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53866 invoked from network); 28 Aug 2017 08:57:18 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-15.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Aug 2017 08:57:18 -0000 Received: by mail-pg0-f43.google.com with SMTP id t3so22364422pgt.0 for ; Mon, 28 Aug 2017 01:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ibyLFSz2OCW5sE3Ydz65ZRFcFBf596L9bo9Hcmr8ZFk=; b=TYQde5v2NVvbDFf4zHPRlXxtp2supnWr6P7PhavvgMCoe4ttxl3o+zwP7JOR3ptmvz o42D2AdT4gjbvMxYk9ubbLWBokSmoKQh4rWifkOIAqKe6YOG9tcS+D14oRgjDi1jpA1g B+VqSN46kmYGxZKUl04zpkKAw+2FcZIj6XbYU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ibyLFSz2OCW5sE3Ydz65ZRFcFBf596L9bo9Hcmr8ZFk=; b=RLOmlo7yVyuPXz1YaKtYlWyX/xuW/1VHlW5z2vCLB4Aryl+uAvBcLH/Rsqw9I/LkfH SzlJ+7e5ociqbkNyNqVQSfJYuIiQRaXYj5wE3kgm6f33VEHtb9zxpkur6eH/je76pvec mAZb8roAB8rzDObbFUQwQN+p8bCQ1jUKfBd+OLDBUINkCidMMSdI7as5sava6N1qEnXF 8XIHRm1v2Wq5Us5+pUkw49bXHEEUphrm2rLxebEE1XtbQ3uC8OI7pn5oMQ6gWm24h8C4 qcRpSKGw1YEe6qF8s5TmqVnYcS5i8Nua3n59LthL3swudDgerO+/1IisEqJKC5MW+58Z UEtw== X-Gm-Message-State: AHYfb5j8SEx4nVnYs1DuT8LGUJK7GZUrqGfcpLYZXvc9gGW0UKiyjizn ptqpe8+bpPtVOkKsHIXsGQ== X-Received: by 10.99.110.129 with SMTP id j123mr6574316pgc.428.1503910636688; Mon, 28 Aug 2017 01:57:16 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id d88sm21713569pfl.158.2017.08.28.01.57.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Aug 2017 01:57:16 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 28 Aug 2017 14:26:01 +0530 Message-Id: <1503910570-24427-19-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> References: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 18/27 v8] xen/arm: vpl011: Add a new console_cleanup function in xenconsole X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" This patch introduces a new console_cleanup function. This function frees up the console resources. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall 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(-) 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); }