From patchwork Mon Sep 18 10:32:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112877 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3500989qgf; Mon, 18 Sep 2017 03:34:40 -0700 (PDT) X-Received: by 10.107.132.87 with SMTP id g84mr21249110iod.272.1505730880276; Mon, 18 Sep 2017 03:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730880; cv=none; d=google.com; s=arc-20160816; b=scqAtrgmFs9FMFh5SeCadHwB66Vt5d/T/r7+nsIew88StN1CVQpgwcNEz4lTBqYyHl WZVHJTq+mrssISDOMDOwXqPaeuJEXc3VrxMxXmqW1jZr+qFt2QO/2QoGf/K6BCcJOW7x YNOfn04DjBoMtDNVjRskiGhLyFn1HARrys3ZAyuLe6TdtIBTcsZQz3KKgPbN389N3bKa t5sAkSEMO4rncDO7KE+bazEzOgx/CwE4sStqxwVIrdhlFGZxs+SNtbnIu3IVkqCHU3Tl +O4ycjednDPAOEUIT/hGL35PxFZARm2ETYsMyBHx7kdMP6ckgTIhABUhOFgNnPM3KPaN 8oYA== 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=jNeDlR3nnNIv8C80edgyeQ+8uM/0zvuYTMYZHThRRXlNOkgdM67vA7JJX6MZtgczj8 zVLZECkhTtag9cXDLZcYCWxlVYLTwcpHMPgeDUpxPp43YBcl1jAA7AxafpTov3Dd2sC9 SDcmY/kGV+lpfRXzO7i5ej2457AuBviUSR6dafLn8mVYjNDWGg3vt5xFyLb0yuba/Rfh 66Q50sOwTh9HcTIwJLgMabfMy00Xjd3kq7fns8cEjmBcwBCB053RK0enfYaVzY/OZ7F6 jfym8n3b4qn8ur7FnOLZp2IlvT/6NEaaEPJbIz9JCUKbo40+1lZXYhKu1mEaB7pUODgE u1og== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hCJEldLM; 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 134si5323880iou.189.2017.09.18.03.34.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:40 -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=hCJEldLM; 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 1dttMa-0002Sa-Ut; Mon, 18 Sep 2017 10:33:16 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMZ-0002OZ-AD for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:15 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 22/10-17770-AE0AFB95; Mon, 18 Sep 2017 10:33:14 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRWlGSWpSXmKPExsVyMfTARt1XC/Z HGkz4y2XxfctkJgdGj8MfrrAEMEaxZuYl5VcksGYcX7uMtWAzd8WElZENjM84uxg5OYQEpjNK TH2c3MXIxcEiMI9ZYtrpfhaQhIRAP6vEq+VCXYwcQHaaxKF34hDhNInrT/cwQ9gVEkf/zWGEm KMlcfTUbFaQOUICO5gkDpybzAjSyyZgIjGrQwKkRkRASeLeqslMIDXMAvMZJZom9bKBJIQFoi W2zToItpdFQFVi59YLYHFeAR+JK3d/Qy2Tk7h5rhPM5gSKn1//gBVisbfEvF9XGCcwCi5gZFj FqF6cWlSWWqRrppdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERhqDECwg3HeCf9D jJIcTEqivKKR+yOF+JLyUyozEosz4otKc1KLDzHKcHAoSfCKA0NXSLAoNT21Ii0zBxj0MGkJD h4lEd5184HSvMUFibnFmekQqVOMlhwX7lz6w8RxYM8tINlx8+4fJiGWvPy8VClx3ncgDQIgDR mleXDjYJF5iVFWSpiXEehAIZ6C1KLczBJU+VeM4hyMSsK8ciBX8WTmlcBtfQV0EBPQQS079oA cVJKIkJJqYLR1nljp6O6acObaz2Wq3pGnV77zc5O8VhNb66Ch0lz1WOV9fOva5z8K5FVfb4hN OsayU952Q0GAXQDPagOlU9NLT5bpJge+fBAuXuF4Y4qC0AIT5XtFKfctYrUYrXlLCn8V/dmiv Kjwi83NS4VTdvxkmuzpfChjWYKXyK4tOtd6ecxfCvZMVWIpzkg01GIuKk4EAJqVDsHHAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-21.messagelabs.com!1505730793!83225608!1 X-Originating-IP: [209.85.192.177] 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 5751 invoked from network); 18 Sep 2017 10:33:14 -0000 Received: from mail-pf0-f177.google.com (HELO mail-pf0-f177.google.com) (209.85.192.177) by server-9.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:14 -0000 Received: by mail-pf0-f177.google.com with SMTP id x78so26343pff.10 for ; Mon, 18 Sep 2017 03:33:13 -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=hCJEldLM7jQpF6ZYxcfsTb8JVw7ipfVEr2xIbeMH17aPK2lKttZPTMVvohresDiLJD mbZFRDaJKmUmZNpmbdTcYFMKsZ6ru+unjvt8w/4ja5OfTuGPni8NqcYtd7tIdNEKOvlH ejhi5nU/mhAtk7pjyjzFEg41YRnp+PgqLt3ks= 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=rvdL2SqXDQOjrv/dUZI1GGFO0BtD4Gb24DnXviWzt2J0lU7xUJVH1hFor+qgWxgmOR jaa+4dsIERLDc0rALP5wl4uZLwdd4aMTTMiMNxGVX3XupDa1WNOcFeMig9Z1mSxVpBgl r+b0UuqqHlhasL/ygIyTGV+9eIA5QuaMlar6Xa4khnxMo6JNMNYcraolQG4RWY5G0mwJ cQmlk34qviqwiuyoBE+5pmfdJusOoS+HDe6Y1uP3rKxGffhh/Y/o7yIxy+yhiBoKQQ5P aqLDj228Lt2MIGvJxMEuG+3YuLtRolhHITd6eukyLcKN6MkUxG5WMFotJC1wn+8k/nEy czrw== X-Gm-Message-State: AHPjjUhZuB8VrUP4XKP5+BaGVEJH2BPQGDtHy/Vlhqn5G36qJ7t4dxS/ V65JGuFQa8UDpLLX4fMJUQ== X-Google-Smtp-Source: ADKCNb4ktuImSYdGwbyCrYIJnMzOhxPqaQOJ6WeAvnlvMFJM0T5IVtZOFvUQg+SCc2XyxDmhDlcVXw== X-Received: by 10.98.23.10 with SMTP id 10mr32680703pfx.339.1505730792369; Mon, 18 Sep 2017 03:33:12 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:12 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:02 +0530 Message-Id: <1505730731-10947-19-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 18/27 v9] 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); }