Received: from eggs.gnu.org ([2001:4830:134:3::10]:36666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeExs-0005xd-VR 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-0004er-GN for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:28 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49292 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeExn-0004eD-9W 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:35 +0200 Message-Id: <1413342561-4754-2-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 01/47] qdev: gpio: Don't allow name share between I and O 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 Only allow a GPIO name to be one or the other. Inputs and outputs are functionally different and should be in different namespaces. Prepares support for the QOMification of IRQs as Links or Child objects. The alternative is to munge names .e.g. with "-in" or "-out" suffixes when giving QOM names. But that reduces clarity and if there are cases out there where users want I and O with same name they can manually add their own suffixes. Reviewed-by: Alexander Graf Signed-off-by: Peter Crosthwaite Signed-off-by: Andreas F=C3=A4rber --- hw/core/qdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index fcb1638..976e208 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -339,6 +339,7 @@ void qdev_init_gpio_in_named(DeviceState *dev, qemu_i= rq_handler handler, { NamedGPIOList *gpio_list =3D qdev_get_named_gpio_list(dev, name); =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); gpio_list->num_in +=3D n; @@ -354,6 +355,7 @@ void qdev_init_gpio_out_named(DeviceState *dev, qemu_= irq *pins, { NamedGPIOList *gpio_list =3D qdev_get_named_gpio_list(dev, name); =20 + assert(gpio_list->num_in =3D=3D 0 || !name); assert(gpio_list->num_out =3D=3D 0); gpio_list->num_out =3D n; gpio_list->out =3D pins; --=20 1.8.4.5