From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, jsnow@redhat.com,
Li Qiang <liq3ea@gmail.com>, Li Qiang <liqiang6-s@360.cn>
Subject: [Qemu-devel] [PULL for-rc1 2/3] ide: core: add cleanup function
Date: Wed, 15 Mar 2017 20:52:58 -0400 [thread overview]
Message-ID: <20170316005259.21970-3-jsnow@redhat.com> (raw)
In-Reply-To: <20170316005259.21970-1-jsnow@redhat.com>
From: Li Qiang <liq3ea@gmail.com>
As the pci ahci can be hotplug and unplug, in the ahci unrealize
function it should free all the resource once allocated in the
realized function. This patch add ide_exit to free the resource.
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Message-id: 1488449293-80280-3-git-send-email-liqiang6-s@360.cn
Signed-off-by: John Snow <jsnow@redhat.com>
---
hw/ide/core.c | 8 ++++++++
include/hw/ide/internal.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index db509b3..0b48b64 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2603,6 +2603,14 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
bus->dma = &ide_dma_nop;
}
+void ide_exit(IDEState *s)
+{
+ timer_del(s->sector_write_timer);
+ timer_free(s->sector_write_timer);
+ qemu_vfree(s->smart_selftest_data);
+ qemu_vfree(s->io_buffer);
+}
+
static const MemoryRegionPortio ide_portio_list[] = {
{ 0, 8, 1, .read = ide_ioport_read, .write = ide_ioport_write },
{ 0, 1, 2, .read = ide_data_readw, .write = ide_data_writew },
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index 88dc118..482a951 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -607,6 +607,7 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind,
uint32_t cylinders, uint32_t heads, uint32_t secs,
int chs_trans);
void ide_init2(IDEBus *bus, qemu_irq irq);
+void ide_exit(IDEState *s);
void ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
void ide_register_restart_cb(IDEBus *bus);
--
2.9.3
next prev parent reply other threads:[~2017-03-16 0:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 0:52 [Qemu-devel] [PULL for-rc1 0/3] Ide patches John Snow
2017-03-16 0:52 ` [Qemu-devel] [PULL for-rc1 1/3] ide: qdev: register ide bus unrealize function John Snow
2017-03-16 0:52 ` John Snow [this message]
2017-03-16 0:52 ` [Qemu-devel] [PULL for-rc1 3/3] ide: ahci: call cleanup function in ahci unit John Snow
2017-03-16 11:05 ` [Qemu-devel] [PULL for-rc1 0/3] Ide patches Peter Maydell
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=20170316005259.21970-3-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=liq3ea@gmail.com \
--cc=liqiang6-s@360.cn \
--cc=peter.maydell@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).