qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/4] qdev: integrate reset
Date: Tue,  1 Sep 2009 09:56:12 +0200	[thread overview]
Message-ID: <1251791775-5358-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1251791775-5358-1-git-send-email-kraxel@redhat.com>


Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/qdev.c |   11 ++++++++++-
 hw/qdev.h |    3 +++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index ff2f096..e045968 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -211,12 +211,21 @@ DeviceState *qdev_device_add(QemuOpts *opts)
    calling this function.  */
 int qdev_init(DeviceState *dev)
 {
-    return dev->info->init(dev, dev->info);
+    int rc;
+
+    rc = dev->info->init(dev, dev->info);
+    if (rc < 0)
+        return rc;
+    if (dev->info->reset)
+        qemu_register_reset(dev->info->reset, dev);
+    return 0;
 }
 
 /* Unlink device from bus and free the structure.  */
 void qdev_free(DeviceState *dev)
 {
+    if (dev->info->reset)
+        qemu_unregister_reset(dev->info->reset, dev);
     LIST_REMOVE(dev, sibling);
     qemu_free(dev);
 }
diff --git a/hw/qdev.h b/hw/qdev.h
index af735d7..fde29ea 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -110,6 +110,9 @@ struct DeviceInfo {
     Property *props;
     int no_user;
 
+    /* callbacks */
+    QEMUResetHandler *reset;
+
     /* Private to qdev / bus.  */
     qdev_initfn init;
     BusInfo *bus_info;
-- 
1.6.2.5

  reply	other threads:[~2009-09-01  8:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-01  7:56 [Qemu-devel] [PATCH 0/4] integrate more device handling bits with qdev Gerd Hoffmann
2009-09-01  7:56 ` Gerd Hoffmann [this message]
2009-09-01 16:30   ` [Qemu-devel] [PATCH 1/4] qdev: integrate reset Blue Swirl
     [not found]     ` <m33a76mxkc.fsf@neno.mitica>
2009-09-01 16:45       ` [Qemu-devel] " Blue Swirl
2009-09-02  6:43     ` [Qemu-devel] " Gerd Hoffmann
2009-09-01  7:56 ` [Qemu-devel] [PATCH 2/4] qdev: convert rtl8139 to reset Gerd Hoffmann
2009-09-01  7:56 ` [Qemu-devel] [PATCH 3/4] qdev: integrate vmstate Gerd Hoffmann
2009-09-01  7:56 ` [Qemu-devel] [PATCH 4/4] qdev: convert tcx to reset + vmsd Gerd Hoffmann

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=1251791775-5358-2-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --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).