Messages in this thread | | | Date | Wed, 30 Jan 2002 10:26:50 -0800 (PST) | From | Patrick Mochel <> | Subject | Re: [PATCH] driverfs support for USB - take 2 |
| |
On Tue, 29 Jan 2002, Greg KH wrote:
> Hi, > > Well after determining that the last version of this patch doesn't show > the USB tree properly, here's another patch against 2.5.3-pre6 that > fixes this issue. > > With this patch (the driver core changes were from Pat Mochel, thanks > Pat for putting up with my endless questions) my machine now shows the > following tree:
This is great! Thanks to Greg for testing and providing feedback.
One question:
> | | |-- 01:0d.1 > | | | |-- power > | | | |-- status > | | | `-- usb_bus > | | | |-- 003 > | | | | |-- power > | | | | `-- status > | | | |-- power > | | | `-- status
You have a PCI device that is the USB controller. You create a child of that represents the USB bus. Then, devices are added as children of that.
Logically, couldn't you skip that extra layer of indirection and make USB devices children of the USB controller? Or, do you see benefit in the explicit distinction?
> diff -Nru a/include/linux/device.h b/include/linux/device.h > --- a/include/linux/device.h Tue Jan 29 16:02:26 2002 > +++ b/include/linux/device.h Tue Jan 29 16:02:26 2002 > @@ -66,10 +66,8 @@ > > struct device { > struct list_head node; /* node in sibling list */ > - struct iobus *parent; /* parent bus */ > - > - struct iobus *subordinate; /* only valid if this device is a > - bridge device */ > + struct list_head children; > + struct device *parent;
(To everyone else)
Note this change: This patch removed struct iobus, so that everything becomes a device and only a device. A 'bus' is simply a device that has children.
This concept is something that I have argued both for and against since I started on this. Initially, the goal was to separate the two because they followed such different semantics.
But, I've found it, IMO, it creates more problems than it solves. There was/is a lot of code replication just because you want to do the same thing to each object, but have two different pointer types to deal with.
And, it's quite easy to add extra semantics for devices that have children.
-pat
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |