On Tuesday 25 September 2007, Rusty Russell wrote:
> On Tue, 2007-09-25 at 00:18 +0200, Arnd Bergmann wrote:
> > This is a pattern I've seen a few times before, but could never understand
> > what it's good for. What is your reason for defining a new data structure
> > that is used only once, instead of just
> > 
> > static struct bus_type virtio_bus_type;
> > static struct device virtio_root_dev;
> 
> It's copied from the lguest bus which was copied from somewhere else.
> Creating a struct like this is a quiet complaint about the requirements
> to do so: it's not clear to me why I need to create a fake device,
> rather than making the bus the parent of the device if it needs one.
> 
> > Also, I would not mix the two in a single source file. Instead, I think
> > every driver that can provide virtio devices (pci, lguest, ...) should
> > be responsible for setting the parent appropriately.
> 
> I don't mind: we could expose it.

What I mean with setting the parent appropriately is not to have a global
device that is used by the hv-specific probing code, but to make sure
that each of them provides their own one. The bus_type should either be
global or provide the wrappers for device_register and driver_register
that you have, but the host bridge device belongs with the code that
probes it. E.g. when all virtio devices are behind PCI bridges, there
does not need to be an empty /virtio or /lguest device node at all.

        Arnd <><

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to