qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 7/7] PPC: Qdev'ify e500 pci


From: Paul Brook
Subject: Re: [Qemu-devel] [PATCH 7/7] PPC: Qdev'ify e500 pci
Date: Fri, 6 May 2011 17:29:24 +0100
User-agent: KMail/1.13.5 (Linux/2.6.38-2-amd64; KDE/4.4.5; x86_64; ; )

> > PCIBus *ppce500_pci_init(qemu_irq pci_irqs[4], target_phys_addr_t
> > registers) {
> > -    PPCE500PCIState *controller;
> > +    DeviceState *dev;
> > +    PCIBus *b;
> > +    PCIHostState *h;
> > +    PPCE500PCIState *s;
> > 
> >      PCIDevice *d;
> > 
> > -    int index;
> > 
> >      static int ppce500_pci_id;
> > 
> > +    SysBusDevice *sb;
> > +
> > +    dev = qdev_create(NULL, "e500-pcihost");
> > +    sb = sysbus_from_qdev(dev);
> > +    h = FROM_SYSBUS(PCIHostState, sb);
> > +    s = DO_UPCAST(PPCE500PCIState, pci_state, h);
> > +
> > +    b = pci_register_bus(&s->pci_state.busdev.qdev, NULL,
> 
> No.  This function should not exist.  All this should be done in
> e500_pcihost_initfn.  Please do the qdev conversion properly.

Or more precicely it should not depend on the internals of ppce500_pci.c.
In principle the only public entry point in that file should be 
device_init(...).  If used by multiple boards a simple helper function may be 
appropriate (e.g. smc91c111_init).  Note that this helper function has no ties 
to the rest of that file, and could be trivially moved into a different file 
or replaced with a macro/inline funciton.

ppce500_pci_init definitely should not be creating the PCI bus.

Paul



reply via email to

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