From patchwork Fri Sep 22 08:23:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 9965453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 82C566020C for ; Fri, 22 Sep 2017 08:26:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7064528975 for ; Fri, 22 Sep 2017 08:26:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 652DD28E17; Fri, 22 Sep 2017 08:26:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0FDCF28975 for ; Fri, 22 Sep 2017 08:26:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGC-0004LP-AH; Fri, 22 Sep 2017 08:24:32 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGA-0004J2-Fq for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:30 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 08/ED-02224-DB8C4C95; Fri, 22 Sep 2017 08:24:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAet29J45 EGhyfw2fxfctkJgdGj8MfrrAEMEaxZuYl5VcksGYcX7uMtWAzd8WElZENjM84uxi5OIQEpjNK fL53nwXEYRGYxyyx8d9pMEdCoJ9VYs2KG6xdjJxATp7E7rvX2CDsNIlNB2ZC2RUSvTdug9UIC WhJHD01mxVi7A4miVsNd9m7GDk42ARMJGZ1SIDUiAgoSdxbNZkJpIZZYD6jRNOkXrBBwgIxEj /6H4INYhFQlbh2cysziM0r4CPxc8p6dohlchI3z3WCxTmB4mv/b2CBWOwtsfXGVZYJjIILGBl WMWoUpxaVpRbpGprqJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEhhwDEOxgXLPd 8xCjJAeTkijv4yNHIoX4kvJTKjMSizPii0pzUosPMcpwcChJ8NYeB8oJFqWmp1akZeYAgx8mL cHBoyTCywuMACHe4oLE3OLMdIjUKUZLjgt3Lv1h4jiw5xaQ7Lh59w+TEEtefl6qlDjvfJB5Ai ANGaV5cONgEXqJUVZKmJcR6EAhnoLUotzMElT5V4ziHIxKwryCIGt5MvNK4La+AjqICeig8tV gB5UkIqSkGhgv8TjZZz2wPLuapTjtv9GGRzHVXZln93AFH91h8CN16dLt61c73vHYtV56Terc j0xhZn9n20fMaFpQcs1OOUAuiv3pnU6v24k6HIbT+vYp95vkJC5aI2JXsqPqRUtb2h6xcOW+M 8d+rF+4+ouc7gGGz8XfSuRFl2l5fEp+t/yq86Lnk17Js+YpsRRnJBpqMRcVJwIAd5XAdMsCAA A= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-31.messagelabs.com!1506068668!60527479!1 X-Originating-IP: [209.85.192.175] 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 13305 invoked from network); 22 Sep 2017 08:24:29 -0000 Received: from mail-pf0-f175.google.com (HELO mail-pf0-f175.google.com) (209.85.192.175) by server-9.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:29 -0000 Received: by mail-pf0-f175.google.com with SMTP id n24so239174pfk.5 for ; Fri, 22 Sep 2017 01:24:28 -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=NinKr6CoL0lUA3XITjM3OOoHJpT86Gb+ZujtG53xuCvMBF0uave+Du3j95wxRfme/3 0s95egI5UpqKdJvAh+qMWUdYOIOJB9ogQxPCtmatG1lUVmgBEu7fVOUyowbK8buWmYj2 aHk5KG4FNr4lrKaSnRKSPmbh0S2Vh46fnvmqk= 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=UAT36a35xVHpq74excV/D9V6LgyCMuMVMeNvLPpOvn+AkFxGwJeihxdKJvoijL/vuK vco/Y7ItymI72V1SXR8R/Uc14kJvtom/1zsTzoQ5zTG7bZPXBe2BZBsXiknMu4pP+GHa SiMOX2adXLEeR9J98ipN7/NS7oXCG49dVdTm4lVuzBh2LRJ4+w04IyyYOYK0NHWcq5nh moFqGAPftrNLSk3QfHwxTwIxeluV54Nmsd/pGt6OgtxCohS5aNaB8jr3ymyHd7oAqzEO WykKLUefatoZLQrV3UlBR8yELxhueo16gLnGX5WbXJYfHMqRoVdUBEiqeJ5cymd9Q6yv DkHQ== X-Gm-Message-State: AHPjjUg1Knptgut+q2rsFYp/HV1Z73B3LBXgDX0ZSf2fPoJwetAFbCDu 9ZtItY+51qMzu3WR4w23torcfv42w7s= X-Google-Smtp-Source: AOwi7QCzR372PQiG/gr52LobLp501WXJiM4IGrVyd6SVh5OdYO8kju6qY7fweAck8ApVbis7It128A== X-Received: by 10.98.139.15 with SMTP id j15mr8519473pfe.33.1506068667546; Fri, 22 Sep 2017 01:24:27 -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 f74sm5569284pfa.36.2017.09.22.01.24.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:27 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:17 +0530 Message-Id: <1506068606-17066-19-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 18/27 v10] 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" X-Virus-Scanned: ClamAV using ClamSMTP 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); }