From: "Marc-André Lureau" <mlureau@redhat.com>
To: minyard@acm.org
Cc: qemu-devel@nongnu.org, Corey Minyard <cminyard@mvista.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] ipmi_bmc_sim: Free timer
Date: Thu, 21 Jul 2016 10:49:20 -0400 (EDT) [thread overview]
Message-ID: <568261880.7102035.1469112560328.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1469112292-30548-1-git-send-email-minyard@acm.org>
Hi
----- Original Message -----
> From: Corey Minyard <cminyard@mvista.com>
>
> Add an unrealize function to free the timer allocated in the
> realize function.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> Cc: Marc-André Lureau <mlureau@redhat.com>
> ---
> hw/ipmi/ipmi_bmc_sim.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
> index dc9c14c..c83adf8 100644
> --- a/hw/ipmi/ipmi_bmc_sim.c
> +++ b/hw/ipmi/ipmi_bmc_sim.c
> @@ -1786,12 +1786,22 @@ static void ipmi_sim_realize(DeviceState *dev, Error
> **errp)
> vmstate_register(NULL, 0, &vmstate_ipmi_sim, ibs);
> }
>
> +static void ipmi_sim_unrealize(DeviceState *dev, Error **errp)
> +{
> + IPMIBmc *b = IPMI_BMC(dev);
> + IPMIBmcSim *ibs = IPMI_BMC_SIMULATOR(b);
> +
> + timer_del(ibs->timer);
> + timer_free(ibs->timer);
> +}
> +
I think we may want to unrealize more here:
+static void ipmi_sim_unrealize(DeviceState *dev, Error **errp)
+{
+ IPMIBmcSim *ibs = IPMI_BMC_SIMULATOR(dev);
+ IPMIRcvBufEntry *msg, *tmp;
+
+ vmstate_unregister(NULL, &vmstate_ipmi_sim, ibs);
+ timer_del(ibs->timer);
+ timer_free(ibs->timer);
+ QTAILQ_FOREACH_SAFE(msg, &ibs->rcvbufs, entry, tmp) {
+ QTAILQ_REMOVE(&ibs->rcvbufs, msg, entry);
+ g_free(msg);
+ }
+ qemu_mutex_destroy(&ibs->lock);
> static void ipmi_sim_class_init(ObjectClass *oc, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(oc);
> IPMIBmcClass *bk = IPMI_BMC_CLASS(oc);
>
> dc->realize = ipmi_sim_realize;
> + dc->unrealize = ipmi_sim_unrealize;
> bk->handle_command = ipmi_sim_handle_command;
> }
>
> --
> 2.7.4
>
>
next prev parent reply other threads:[~2016-07-21 14:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 14:44 [Qemu-devel] [PATCH 1/3] ipmi_bmc_sim: Free timer minyard
2016-07-21 14:44 ` [Qemu-devel] [PATCH 2/3] wdt_i6300esb: " minyard
2016-07-21 14:56 ` Marc-André Lureau
2016-07-21 15:11 ` Richard W.M. Jones
2016-07-21 14:44 ` [Qemu-devel] [PATCH 3/3] wdt_ib700: " minyard
2016-07-21 14:52 ` Marc-André Lureau
2016-07-21 15:11 ` Richard W.M. Jones
2016-07-21 14:49 ` Marc-André Lureau [this message]
2016-07-21 15:05 ` [Qemu-devel] [PATCH 1/3] ipmi_bmc_sim: " Corey Minyard
2016-07-21 15:12 ` Corey Minyard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=568261880.7102035.1469112560328.JavaMail.zimbra@redhat.com \
--to=mlureau@redhat.com \
--cc=cminyard@mvista.com \
--cc=minyard@acm.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.