[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 03/14] qdev: gpio: Register GPIO outputs as QOM l
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH v2 03/14] qdev: gpio: Register GPIO outputs as QOM links |
Date: |
Thu, 14 Aug 2014 22:30:59 -0700 |
Within the object that contains the GPIO output. This allows for
connecting GPIO outputs via setting of a Link property.
Also clear the link value to zero. This catch-alls the case
where a device improperly inits a gpio_out (malloc instead of
malloc0).
Signed-off-by: Peter Crosthwaite <address@hidden>
---
Changed since v1:
Clear the irq when initing the GPIO.
Define propname at start of function.
hw/core/qdev.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 83c3923..6030ee5 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -362,12 +362,24 @@ void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler
handler, int n)
void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,
const char *name, int n)
{
+ int i;
NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
+ char *propname = g_strdup_printf("%s[*]", name ? name :
"unnamed-gpio-out");
assert(gpio_list->num_in == 0 || !name);
assert(gpio_list->num_out == 0);
gpio_list->num_out = n;
gpio_list->out = pins;
+
+ for (i = 0; i < n; ++i) {
+ memset(&pins[i], 0, sizeof(*pins));
+ object_property_add_link(OBJECT(dev), propname, TYPE_IRQ,
+ (Object **)&pins[i],
+ object_property_allow_set_link,
+ OBJ_PROP_LINK_UNREF_ON_RELEASE,
+ &error_abort);
+ }
+ g_free(propname);
}
void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n)
--
2.0.1.1.gfbfc394
- [Qemu-devel] [PATCH v2 00/14] GPIO/IRQ QOMification: Phase 2 - Getting rid of SYSBUS IRQs, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 01/14] qdev: gpio: Don't allow name share between I and O, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 02/14] qdev: gpio: Register GPIO inputs as child objects, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 03/14] qdev: gpio: Register GPIO outputs as QOM links,
Peter Crosthwaite <=
- [Qemu-devel] [PATCH v2 04/14] qmp: qstring: Handle NULL strings, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 05/14] qom: Allow clearing of a Link property, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 06/14] qom: Demote already-has-a-parent to a regular error, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 07/14] qdev: gpio: Re-impement qdev_connect_gpio QOM style, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 08/14] qdev: gpio: Add API for intercepting a GPIO, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 09/14] qtest/irq: Rework IRQ interception, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 10/14] irq: Remove qemu_irq_intercept_out, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 11/14] qdev: gpio: delete NamedGPIOList::out, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 12/14] qdev: gpio: Remove qdev_init_gpio_out x1 restriction, Peter Crosthwaite, 2014/08/15
- [Qemu-devel] [PATCH v2 13/14] qdev: gpio: Define qdev_pass_gpios(), Peter Crosthwaite, 2014/08/15