From patchwork Mon Aug 7 08:53:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 109527 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2481914obb; Mon, 7 Aug 2017 01:55:48 -0700 (PDT) X-Received: by 10.36.57.17 with SMTP id l17mr193365ita.58.1502096148428; Mon, 07 Aug 2017 01:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502096148; cv=none; d=google.com; s=arc-20160816; b=mv15KfJQkKzEoOJBDUQiW8iPdXbvI+FGjBZGBxGVT0QD0tiWKmtuN+G0vcfdtkkRdu yTlE4eqiLu/cw2awptJhV0OVPN63IOzsl0RalP1nuk+fL74hOhmUtNzXZqcGKrbe2cLj HdXqHpRuD1M/MpsDCOV2UlxM9yM5e4g2YBFjtAAdnC2PP0w/eKJaeROUarSsJEZ8+wzV gictQ7ox2SXuyPI5yiMe0CSpk5C1tlfWadERp69mMaXQkQyNCuiYs4W+kSt66DZuhQUe 2vV/wFWiCnEBt2rpj7/QXGbM/T8+5bX/uHDkF7IVQ6XLLyv7snEVDC5idnb/tSvgkwPk 9agA== 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=zUtGRR3i6i6+dbz3QYT1cWiEyBKZBcfsv+JWrPA6amk=; b=kg9cfgE4kxtPmP7iWtwb7/HRpYjwfaMpNClF2FjSTwW8oHaFuS6+Jr+EYkNv0Yi2b5 gykg6vxySFDjUtpI2lS2lhcRQJjNKIcJd1D6D2T7Eh1pjecobn/rGXFOgVPWyPSOlro7 yDwQOmI45ijuhD3eDLnKNwjkOBsS9JxP21p6cg6Zd2mPMR02HqBD59RoqlPKqSKPiSzU +69vMGY+XfZuF0EKWgt8HsbaLT52F1/DEs0yx8WHNVRcThkb35kEXHmznVeB0Y1iS4Wh 6POcYhb/2CZAXh1errN8wz/9WdpHNfgKgT5rjRXS4rpnk5yjHJpbsm5iT6S8cCKLru0L Q7aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=TimVGmdv; 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 69si7523113ite.25.2017.08.07.01.55.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Aug 2017 01:55:48 -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.b=TimVGmdv; 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 1dednt-00053b-PQ; Mon, 07 Aug 2017 08:54:25 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dedns-000518-O0 for xen-devel@lists.xenproject.org; Mon, 07 Aug 2017 08:54:24 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id CF/94-02176-0CA28895; Mon, 07 Aug 2017 08:54:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRWlGSWpSXmKPExsVyMfTAat39Wh2 RBsuPCVl83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmPfh5kK+jmrtjwZSF7A+Mhzi5GLg4hgZmM EkvX7mYCcVgE5jFLtM1aD+ZICPSzSvS/nQjkcAI5aRI3lm1igbCrJJqbToPZQgJaEkdPzWaFG NXGJDH7zyqgBg4ONgETiVkdEiA1IgJKEvdWTQYbyiwwn1GiaVIvG0hCWCBaYu7pbnaQehYBVY mde8JAwrwCPhI/vp5nhNglJ3HzXCcziM0JFD9/6Q3UXm+J28f6GCcwCixgZFjFqFGcWlSWWqR rbKCXVJSZnlGSm5iZo2toYKyXm1pcnJiempOYVKyXnJ+7iREYWvUMDIw7GDtP+B1ilORgUhLl jV/RFinEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgvezZkekkGBRanpqRVpmDjDIYdISHDxKIrxOw EAX4i0uSMwtzkyHSJ1itOS4cmXdFyaOKQe2A8lXE/5/YxJiycvPS5US5z0HMk8ApCGjNA9uHC wSLzHKSgnzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5uUAWcuTmVcCt/UV0EFMQAe9SWwFOagkESE l1cCoyfRz7gJVJ5853+NrGNhZr6fdv+A9fXblg+ySTYu2N8d4qR/J+Rf5evvDKcVuGayGh7Pd frtPD963vraqIqKbJWoVe928jevP3XPRn3pbQeHNrP2ru5q9f5QdX3q21P/Ab1FR/6Xeaqeu2 GivvVnLFdOy6vLRJU7umdsWRoQ2s0+8cUzget9jJZbijERDLeai4kQAtx8ms78CAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-31.messagelabs.com!1502096062!108950681!1 X-Originating-IP: [209.85.192.171] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2565 invoked from network); 7 Aug 2017 08:54:23 -0000 Received: from mail-pf0-f171.google.com (HELO mail-pf0-f171.google.com) (209.85.192.171) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Aug 2017 08:54:23 -0000 Received: by mail-pf0-f171.google.com with SMTP id c28so30687064pfe.3 for ; Mon, 07 Aug 2017 01:54:23 -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=O+v6KVnLDkCOtfqAGafxBkX1DdQ/QTAA5Uo5XO7DMl0=; b=TimVGmdv7mTmMAZGsyNZQXFC/ZpyEVRNo7fu1v5LWq6RRk0fWOIHVXZpyMBnMtwesB H0orOtDWGz4dkZrH7JBTCfGCJOldErRBUhQLi8HN4J9qQH5IM7V5cyGdn+oXkTW7Rtbw fD+4oSbIi7b+O9HkplMXFVgZgOOepchjq4904= 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=O+v6KVnLDkCOtfqAGafxBkX1DdQ/QTAA5Uo5XO7DMl0=; b=g0esA8Vv2vkskBQlFfbxXy5M9B++QNrQFWx1e1zPIjq6ALOnb50+aETVDWm1aRokYL MvUG9yi6hB8lhI59LVneOZxrBZvpCgKo5RBk3vrbesr5vfy7QBsfQ5fX+jRwxZlOGc7A rUKmYWZJSVr1XD8esFfc1H0spItOOnJSDoPtjbUC2HutrW+CdyI3+U6DeKPwbLCd9pgh o68gn8BaTjYvyYUPb0BFjHJeUQbh8FBp65a1/RunDJ2zNhUabeh/MxbRP3nPqbGrlOZp NIrIbgXtoobY43dyG2DO0XxuMZ57nGd+JjlPGrTICKqklQxacm20n6OINzB2gMz6QiGj nuxQ== X-Gm-Message-State: AIVw1107uDWyu+RPamE6YdVT4ByHqBCc8TmonLwFLGpKuD7aPXFMT17p 76k2L67aQbyofiGRAA51CQ== X-Received: by 10.84.217.23 with SMTP id o23mr13217857pli.243.1502096061581; Mon, 07 Aug 2017 01:54:21 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id p77sm12604047pfi.153.2017.08.07.01.54.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 01:54:21 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 7 Aug 2017 14:23:10 +0530 Message-Id: <1502095997-31219-19-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> References: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 18/25 v7] 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); }