qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com,
	marcel.a@redhat.com, blauwirbel@gmail.com,
	alex.williamson@redhat.com, anthony@codemonkey.ws,
	pbonzini@redhat.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH 2/7] qdev: add to BusState "hotplug-device" link
Date: Fri,  6 Dec 2013 18:03:10 +0100	[thread overview]
Message-ID: <1386349395-5710-3-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1386349395-5710-1-git-send-email-imammedo@redhat.com>

It will allow to reuse field in different BUSes, reducing code duplication.
Field is intended fot replacing 'hotplug_qdev' field in PCIBus and also
will allow not to add equivalent field to DimmBus with possiblitity
to refactor other BUSes to use it instead of custom field.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/core/qdev.c         |    4 ++++
 include/hw/qdev-core.h |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index e374a93..43cf160 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -32,6 +32,7 @@
 #include "qapi/visitor.h"
 #include "qapi/qmp/qjson.h"
 #include "monitor/monitor.h"
+#include "hw/hotplug.h"
 
 int qdev_hotplug = 0;
 static bool qdev_hot_added = false;
@@ -868,6 +869,9 @@ static void qbus_initfn(Object *obj)
     BusState *bus = BUS(obj);
 
     QTAILQ_INIT(&bus->children);
+    object_property_add_link(obj, QDEV_HOTPLUG_DEVICE_PROPERTY,
+                             TYPE_HOTPLUG_DEVICE,
+                             (Object **)&bus->hotplug_device, NULL);
 }
 
 static char *default_bus_get_fw_dev_path(DeviceState *dev)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index f2043a6..9dc0fd1 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -169,14 +169,18 @@ typedef struct BusChild {
     QTAILQ_ENTRY(BusChild) sibling;
 } BusChild;
 
+#define QDEV_HOTPLUG_DEVICE_PROPERTY "hotplug-device"
+
 /**
  * BusState:
+ * @hotplug_device: link to a hotplug device associated with bus.
  */
 struct BusState {
     Object obj;
     DeviceState *parent;
     const char *name;
     int allow_hotplug;
+    DeviceState *hotplug_device;
     int max_index;
     QTAILQ_HEAD(ChildrenHead, BusChild) children;
     QLIST_ENTRY(BusState) sibling;
-- 
1.7.1

  parent reply	other threads:[~2013-12-06 17:05 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06 17:03 [Qemu-devel] [PATCH 0/7] Refactor PCI/SHPC/PCIE hotplug to use a more generic hotplug API Igor Mammedov
2013-12-06 17:03 ` [Qemu-devel] [PATCH 1/7] define hotplug interface Igor Mammedov
2013-12-06 17:26   ` Paolo Bonzini
2013-12-09 12:42     ` Igor Mammedov
2013-12-09 13:15       ` Paolo Bonzini
2013-12-09  5:40   ` Li Guang
2013-12-09  9:11     ` Marcel Apfelbaum
2013-12-09 12:44     ` Igor Mammedov
2013-12-09  8:58   ` Marcel Apfelbaum
2013-12-09 12:52     ` Igor Mammedov
2013-12-06 17:03 ` Igor Mammedov [this message]
2013-12-06 17:03 ` [Qemu-devel] [PATCH 3/7] hw/acpi: move typeinfo to the file end Igor Mammedov
2013-12-06 17:03 ` [Qemu-devel] [PATCH 4/7] acpi/piix4pm: convert ACPI PCI hotplug to use hotplug-device interface Igor Mammedov
2013-12-09  9:02   ` Marcel Apfelbaum
2013-12-09 13:24     ` Igor Mammedov
2013-12-06 17:03 ` [Qemu-devel] [PATCH 5/7] pci/shpc: convert SHPC " Igor Mammedov
2013-12-06 17:03 ` [Qemu-devel] [PATCH 6/7] pci/pcie: convert PCIE " Igor Mammedov
2013-12-06 17:03 ` [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface Igor Mammedov
2013-12-06 17:29   ` Paolo Bonzini
2013-12-09 13:41     ` Igor Mammedov
2013-12-09 13:47       ` Paolo Bonzini
2013-12-09 14:14         ` Igor Mammedov
2013-12-09 14:36           ` Paolo Bonzini
2013-12-09 15:08             ` Igor Mammedov
2013-12-09 15:16               ` Paolo Bonzini
2013-12-09 16:48                 ` Igor Mammedov
2013-12-09 17:18                   ` Paolo Bonzini
2013-12-09 21:15                     ` Igor Mammedov
2013-12-09 22:28                       ` Paolo Bonzini
2013-12-09  9:09   ` Marcel Apfelbaum
2013-12-09 13:55     ` Igor Mammedov
2013-12-09 14:01       ` Marcel Apfelbaum
2013-12-06 17:31 ` [Qemu-devel] [PATCH 0/7] Refactor PCI/SHPC/PCIE hotplug to use a more generic hotplug API Paolo Bonzini
2013-12-09 14:15   ` Igor Mammedov

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=1386349395-5710-3-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=afaerber@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=blauwirbel@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=marcel.a@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).