Revision b09a6f7b

b/hw/intc/realview_gic.c
9 9

  
10 10
#include "hw/sysbus.h"
11 11

  
12
#define TYPE_REALVIEW_GIC "realview_gic"
13
#define REALVIEW_GIC(obj) \
14
    OBJECT_CHECK(RealViewGICState, (obj), TYPE_REALVIEW_GIC)
15

  
12 16
typedef struct {
13
    SysBusDevice busdev;
17
    SysBusDevice parent_obj;
18

  
14 19
    DeviceState *gic;
15 20
    MemoryRegion container;
16 21
} RealViewGICState;
......
21 26
    qemu_set_irq(qdev_get_gpio_in(s->gic, irq), level);
22 27
}
23 28

  
24
static int realview_gic_init(SysBusDevice *dev)
29
static int realview_gic_init(SysBusDevice *sbd)
25 30
{
26
    RealViewGICState *s = FROM_SYSBUS(RealViewGICState, dev);
31
    DeviceState *dev = DEVICE(sbd);
32
    RealViewGICState *s = REALVIEW_GIC(dev);
27 33
    SysBusDevice *busdev;
28 34
    /* The GICs on the RealView boards have a fixed nonconfigurable
29 35
     * number of interrupt lines, so we don't need to expose this as
......
38 44
    busdev = SYS_BUS_DEVICE(s->gic);
39 45

  
40 46
    /* Pass through outbound IRQ lines from the GIC */
41
    sysbus_pass_irq(dev, busdev);
47
    sysbus_pass_irq(sbd, busdev);
42 48

  
43 49
    /* Pass through inbound GPIO lines to the GIC */
44
    qdev_init_gpio_in(&s->busdev.qdev, realview_gic_set_irq, numirq - 32);
50
    qdev_init_gpio_in(dev, realview_gic_set_irq, numirq - 32);
45 51

  
46 52
    memory_region_init(&s->container, OBJECT(s),
47 53
                       "realview-gic-container", 0x2000);
......
49 55
                                sysbus_mmio_get_region(busdev, 1));
50 56
    memory_region_add_subregion(&s->container, 0x1000,
51 57
                                sysbus_mmio_get_region(busdev, 0));
52
    sysbus_init_mmio(dev, &s->container);
58
    sysbus_init_mmio(sbd, &s->container);
53 59
    return 0;
54 60
}
55 61

  
......
61 67
}
62 68

  
63 69
static const TypeInfo realview_gic_info = {
64
    .name          = "realview_gic",
70
    .name          = TYPE_REALVIEW_GIC,
65 71
    .parent        = TYPE_SYS_BUS_DEVICE,
66 72
    .instance_size = sizeof(RealViewGICState),
67 73
    .class_init    = realview_gic_class_init,

Also available in: Unified diff