From patchwork Fri Jul 22 19:50:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 72642 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1173209qga; Fri, 22 Jul 2016 12:52:56 -0700 (PDT) X-Received: by 10.55.214.135 with SMTP id p7mr6859005qkl.195.1469217175720; Fri, 22 Jul 2016 12:52:55 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o7si9666161qkc.238.2016.07.22.12.52.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Jul 2016 12:52:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:49092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQgVD-0006ZF-6j for patch@linaro.org; Fri, 22 Jul 2016 15:52:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQgTB-0005d0-Ky for qemu-devel@nongnu.org; Fri, 22 Jul 2016 15:50:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQgTA-00005R-P7 for qemu-devel@nongnu.org; Fri, 22 Jul 2016 15:50:49 -0400 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:32945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQgTA-00005F-Kj for qemu-devel@nongnu.org; Fri, 22 Jul 2016 15:50:48 -0400 Received: by mail-oi0-x243.google.com with SMTP id l9so11280505oih.0 for ; Fri, 22 Jul 2016 12:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ccodK8/xKAgo3623F3ZZW25/VrtAWXb+Rcb95uYI5jk=; b=tAY5xIuLir78MrPKXJG5UCaUlRAZH5RjUeevDfgxNCvVaePo6lgl7pIn/OPy5S6409 jrzg2jhyHgo7WRisTuvH2Y0t/8QB4VA2wJ+cvuxHHbE8P7fuMTjUST5LBc0p4ARKhDO0 IjWN/Pzn6aV+q65fRVa7UJWmZLHnXC0FepPhixe15SaJPu7kKMvWOQN6hbESiw3VyzJJ qtx3z8NgBniDGf8Tv5/zZIIwh9R6w271mswgmuJQvdaroatYdQa3SGCllDL83Xu7CMjZ SzCbTTt5CtLS0OZAKwRQhhTggHyrALAi+Rb1ncAmon8QXFMyie0JWyXGzxhJT4bQK0CC sJZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ccodK8/xKAgo3623F3ZZW25/VrtAWXb+Rcb95uYI5jk=; b=OVEhdQyMdj0QlBJn2bJJGNTn7cRmC2MwuFMWRtutoJCDCNwnqeh2QHcEBmI1SgYEpg eESnieUVI7nGTYzENUL21KB88H1WR7sZnuMZ30GUUdCj5oH9pCn4OKN1qYqUmDFyZ/5e lyRxVR9oW9WIpCGwRn2rh/LQvoRvEa2mypws02c3EEf/aUcA/1dU1JCBUf//UyoUVJGA EcQUK3QeJ7cldC44Ag4x2QHOpmLiGA07fPtotbsgO/Vn5GOHRn/VT8T7zBLvz995b8zK 67JWQ6gT3QudvzLleBHkaaBBdD11neqObQI5ljcJs8ZXAIQf+cIAoJR2L/Qnu7rnNxE8 pKYA== X-Gm-Message-State: AEkoousN21Qf+NE76jqwE2bJq1BQvenSluiDldVdzIxqbKBiecUc7YphQL94NjQZtXyNdQ== X-Received: by 10.202.1.21 with SMTP id 21mr3101258oib.187.1469217048147; Fri, 22 Jul 2016 12:50:48 -0700 (PDT) Received: from serve.minyard.net (serve.minyard.net. [2001:470:b8f6:1b::1]) by smtp.gmail.com with ESMTPSA id o36sm5919509oik.21.2016.07.22.12.50.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jul 2016 12:50:47 -0700 (PDT) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:c87e:7f7a:2ef0:2f10]) by serve.minyard.net (Postfix) with ESMTPA id 4F07B1425; Fri, 22 Jul 2016 14:50:45 -0500 (CDT) Received: by t430.minyard.net (Postfix, from userid 1000) id 806FB302319; Fri, 22 Jul 2016 14:50:43 -0500 (CDT) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Fri, 22 Jul 2016 14:50:40 -0500 Message-Id: <1469217041-15358-4-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469217041-15358-1-git-send-email-minyard@acm.org> References: <1469217041-15358-1-git-send-email-minyard@acm.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::243 Subject: [Qemu-devel] [PATCH v3 3/4] wdt_ib700: Free timer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Richard W . M . Jones" , minyard@acm.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard Add an unrealize function to free the timer allocated in the realize function and to delete the port memory added there, too. Signed-off-by: Corey Minyard Cc: Richard W.M. Jones Cc: Marc-André Lureau Reviewed-by: Richard W.M. Jones --- hw/watchdog/wdt_ib700.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.7.4 diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c index 532afe8..6d5fc4c 100644 --- a/hw/watchdog/wdt_ib700.c +++ b/hw/watchdog/wdt_ib700.c @@ -117,6 +117,17 @@ static void wdt_ib700_realize(DeviceState *dev, Error **errp) portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj), 0); } +static void wdt_ib700_unrealize(DeviceState *dev, Error **errp) +{ + IB700State *s = IB700(dev); + + timer_del(s->timer); + timer_free(s->timer); + s->timer = NULL; + portio_list_del(&s->port_list); + portio_list_destroy(&s->port_list); +} + static void wdt_ib700_reset(DeviceState *dev) { IB700State *s = IB700(dev); @@ -136,6 +147,7 @@ static void wdt_ib700_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = wdt_ib700_realize; + dc->unrealize = wdt_ib700_unrealize; dc->reset = wdt_ib700_reset; dc->vmsd = &vmstate_ib700; set_bit(DEVICE_CATEGORY_MISC, dc->categories);