Re: How to make a bus with heterogeneous devices?

From: Kay Sievers
Date: Sat Mar 03 2012 - 06:43:53 EST


On Fri, Mar 2, 2012 at 23:38, Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Mar 02, 2012 at 11:18:59AM +0100, Federico Vaga wrote:

>> Maybe I'm missing something.
>
> I think you are.
>
> Kay, you know this area of the driver core better than I do at the
> moment, given your most recent changes here. ÂAny reason why Alessandro
> and Federico can't do the same thing that the sysdev rework did for
> their devices here?

Maybe I miss something but it sounds not that different from USB.

You have a bus that enumerates devices and a "bus driver" creates a
generic device on that bus for everything it finds. These devices stay
generic, do not have type-specific attributes, but export matches
again to bind other device-specific drivers, which create _new_ child
devices below the generic ones with the proper attributes matching
their individual type of devices. So every "logical" device is always
represented by one generic device and one type-specific child device.

All these devices, the generic ones and the type-specific ones can be
on the same bus (struct bus_type) when they get a "struct device_type"
assigned which carries the device-type specific set of attributes.

It's like USB, where we get a plain "usb_device" for every device
connected, then we look at each device to find out how many
"usb_interface" childs we need to create, and every interface device
offers again matches for more drivers again, like tty, storage, video,
... to bind to as child devices.

Wouldn't that work?

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/