From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMxwh-0005PL-J2 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:32:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMxwW-0003e0-OK for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:32:51 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34011 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMxwW-0003dY-Hz for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:32:40 -0400 Message-ID: <53FF1356.7020707@suse.de> Date: Thu, 28 Aug 2014 13:32:38 +0200 From: Alexander Graf MIME-Version: 1.0 References: <058158ee2df477e4f0e4e5e434c9becb8e1f9317.1408080397.git.peter.crosthwaite@xilinx.com> In-Reply-To: <058158ee2df477e4f0e4e5e434c9becb8e1f9317.1408080397.git.peter.crosthwaite@xilinx.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 14/14] sysbus: Use TYPE_DEVICE GPIO functionality List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, afaerber@suse.de, pbonzini@redhat.com On 15.08.14 07:37, Peter Crosthwaite wrote: > Re-implement the Sysbus GPIOs to use the existing TYPE_DEVICE > GPIO named framework. A constant string name is chosen to avoid > conflicts with existing unnamed GPIOs. > > This unifies GPIOs are IRQs for sysbus devices and allows removal > of all Sysbus state for GPIOs. > > Any existing and future-added functionality for GPIOs is now > also available for sysbus IRQs. > > Signed-off-by: Peter Crosthwaite > --- > Changed since v1: > Named each IRQ individually. > > hw/core/sysbus.c | 20 +++----------------- > include/hw/sysbus.h | 6 +++--- > 2 files changed, 6 insertions(+), 20 deletions(-) > > diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c > index f4e760d..192a729 100644 > --- a/hw/core/sysbus.c > +++ b/hw/core/sysbus.c > @@ -41,11 +41,7 @@ static const TypeInfo system_bus_info = { > > void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq) > { > - assert(n >= 0 && n < dev->num_irq); > - dev->irqs[n] = NULL; > - if (dev->irqp[n]) { > - *dev->irqp[n] = irq; > - } > + qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq); > } > > static void sysbus_mmio_map_common(SysBusDevice *dev, int n, hwaddr addr, > @@ -89,22 +85,13 @@ void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, > /* Request an IRQ source. The actual IRQ object may be populated later. */ > void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p) > { > - int n; > - > - assert(dev->num_irq < QDEV_MAX_IRQ); > - n = dev->num_irq++; This renders dev->num_irq to always stay 0. Better remove it from the header. Alex