qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, pbonzini@redhat.com, agraf@suse.de,
	afaerber@suse.de
Subject: [Qemu-devel] [PATCH qom v3 07/14] qdev: gpio: Re-impement qdev_connect_gpio QOM style
Date: Thu, 25 Sep 2014 22:20:25 -0700	[thread overview]
Message-ID: <49bd5a0a38ec4aed5248f5cf7afb47ee9ec722ab.1411703316.git.peter.crosthwaite@xilinx.com> (raw)
In-Reply-To: <cover.1411703316.git.peter.crosthwaite@xilinx.com>

Re-implement as a link setter. This should allow the QOM framework to
keep track of ref counts properly etc.

We need to add a default parent for the connecting input incase it's
coming from a non-qdev source. We simply parent the IRQ to the machine
in this case.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 hw/core/qdev.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 2b42d5b..2cadacd 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -403,10 +403,14 @@ qemu_irq qdev_get_gpio_in(DeviceState *dev, int n)
 void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
                                  qemu_irq pin)
 {
-    NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
-
-    assert(n >= 0 && n < gpio_list->num_out);
-    gpio_list->out[n] = pin;
+    char *propname = g_strdup_printf("%s[%d]",
+                                     name ? name : "unnamed-gpio-out", n);
+    if (pin) {
+        object_property_add_child(qdev_get_machine(), "non-qdev-gpio[*]",
+                                  OBJECT(pin), NULL);
+    }
+    object_property_set_link(OBJECT(dev), OBJECT(pin), propname, &error_abort);
+    g_free(propname);
 }
 
 void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin)
-- 
2.1.0.1.g27b9230

  parent reply	other threads:[~2014-09-26  5:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26  5:16 [Qemu-devel] [PATCH qom v3 00/14] GPIO/IRQ QOMification: Phase 2 - Getting rid of SYSBUS IRQs Peter Crosthwaite
2014-09-26  5:17 ` [Qemu-devel] [PATCH qom v3 01/14] qdev: gpio: Don't allow name share between I and O Peter Crosthwaite
2014-09-26  5:17 ` [Qemu-devel] [PATCH qom v3 02/14] qdev: gpio: Register GPIO inputs as child objects Peter Crosthwaite
2014-09-26  5:18 ` [Qemu-devel] [PATCH qom v3 03/14] qdev: gpio: Register GPIO outputs as QOM links Peter Crosthwaite
2014-09-26  5:18 ` [Qemu-devel] [PATCH qom v3 04/14] qmp: qstring: Handle NULL strings Peter Crosthwaite
2014-09-26 13:27   ` Paolo Bonzini
2014-09-29 15:08     ` Andreas Färber
2014-09-26  5:19 ` [Qemu-devel] [PATCH qom v3 05/14] qom: Allow clearing of a Link property Peter Crosthwaite
2014-09-26 12:59   ` Paolo Bonzini
2014-09-26 13:42   ` Igor Mammedov
2014-09-26  5:19 ` [Qemu-devel] [PATCH qom v3 06/14] qom: Demote already-has-a-parent to a regular error Peter Crosthwaite
2014-09-26  5:20 ` Peter Crosthwaite [this message]
2014-09-26 13:04   ` [Qemu-devel] [PATCH qom v3 07/14] qdev: gpio: Re-impement qdev_connect_gpio QOM style Paolo Bonzini
2014-09-26  5:20 ` [Qemu-devel] [PATCH qom v3 08/14] qdev: gpio: Add API for intercepting a GPIO Peter Crosthwaite
2014-09-26  5:21 ` [Qemu-devel] [PATCH qom v3 09/14] qtest/irq: Rework IRQ interception Peter Crosthwaite
2014-09-26  5:22 ` [Qemu-devel] [PATCH qom v3 10/14] irq: Remove qemu_irq_intercept_out Peter Crosthwaite
2014-09-26  5:22 ` [Qemu-devel] [PATCH qom v3 11/14] qdev: gpio: delete NamedGPIOList::out Peter Crosthwaite
2014-09-26  5:23 ` [Qemu-devel] [PATCH qom v3 12/14] qdev: gpio: Remove qdev_init_gpio_out x1 restriction Peter Crosthwaite
2014-09-26  5:23 ` [Qemu-devel] [PATCH qom v3 13/14] qdev: gpio: Define qdev_pass_gpios() Peter Crosthwaite
2014-09-26  5:24 ` [Qemu-devel] [PATCH qom v3 14/14] sysbus: Use TYPE_DEVICE GPIO functionality Peter Crosthwaite
2014-09-26 13:13 ` [Qemu-devel] [PATCH qom v3 00/14] GPIO/IRQ QOMification: Phase 2 - Getting rid of SYSBUS IRQs Paolo Bonzini
2014-09-26 13:17   ` Andreas Färber

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=49bd5a0a38ec4aed5248f5cf7afb47ee9ec722ab.1411703316.git.peter.crosthwaite@xilinx.com \
    --to=peter.crosthwaite@xilinx.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --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).