On Fri, Dec 18, 2020 at 07:09:11PM +0000, Lee Jones wrote:
ACPI, DT and MFD are not busses.
And yet ACPI and PNP have a bus: extern struct bus_type acpi_bus_type; extern struct bus_type pnp_bus_type;
Why? Because in the driver core if you subclass struct device and want to bind drivers, as both PNP and ACPI do, you must place those devices on a bus with a bus_type matching the device type. Thus subclassing the device means subclassing the bus as well.
The purpose of the bus_type is to match drivers to devices and provide methods to the driver core. The bus_type also defines the unique name space of the device names.
It is confusing because the word bus immediately makes people think of physical objects like I2C, PCI, etc, but that is not what bus_type does in the object model of the driver core, IMHO.
So, if you subclass struct device for MFD's usage, then you must also create a bus_type to handle driver binding. The MFD bus_type. Just like auxillary does.
Making a mfd subclass is the logical thing for a subsystem to do, co-opting another subsystem's bus_type is just really weird/abusive.
auxillary bus shows how all these parts work, and it is simple enough to see the pieces clearly.
Jason