qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 14/14] sysbus: Use TYPE_DEVICE GPIO functiona


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH v2 14/14] sysbus: Use TYPE_DEVICE GPIO functionality
Date: Thu, 28 Aug 2014 13:32:38 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0


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 <address@hidden>
> ---
> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]