Received: from eggs.gnu.org ([2001:4830:134:3::10]:36724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeExu-0005xh-1g for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeExn-0004ey-HM for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49293 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeExn-0004eH-Ag for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:23 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 15 Oct 2014 05:08:36 +0200 Message-Id: <1413342561-4754-3-git-send-email-afaerber@suse.de> In-Reply-To: <1413342561-4754-1-git-send-email-afaerber@suse.de> References: <1413342561-4754-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 02/47] qdev: gpio: Register GPIO inputs as child objects List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Crosthwaite , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Peter Crosthwaite To the device that contains them. This will allow for referencing a GPIO input from it's canonical path (exciting for dynamic machine generation!) Reviewed-by: Alexander Graf Signed-off-by: Peter Crosthwaite Signed-off-by: Andreas F=C3=A4rber --- hw/core/qdev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 976e208..a140c79 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -337,11 +337,20 @@ static NamedGPIOList *qdev_get_named_gpio_list(Devi= ceState *dev, void qdev_init_gpio_in_named(DeviceState *dev, qemu_irq_handler handler, const char *name, int n) { + int i; NamedGPIOList *gpio_list =3D qdev_get_named_gpio_list(dev, name); + char *propname =3D g_strdup_printf("%s[*]", name ? name : "unnamed-g= pio-in"); =20 assert(gpio_list->num_out =3D=3D 0 || !name); gpio_list->in =3D qemu_extend_irqs(gpio_list->in, gpio_list->num_in,= handler, dev, n); + + for (i =3D gpio_list->num_in; i < gpio_list->num_in + n; i++) { + object_property_add_child(OBJECT(dev), propname, + OBJECT(gpio_list->in[i]), &error_abort= ); + } + g_free(propname); + gpio_list->num_in +=3D n; } =20 --=20 1.8.4.5