On Thu, Oct 01, 2020 at 09:47:40PM -0300, Jason Gunthorpe wrote: > On Thu, Oct 01, 2020 at 09:17:18PM +0100, Mark Brown wrote: > Instead of making ancillary bus giant, it might be interesting to use > a library technique to avoid the code duplication you are talking > about, eg > struct my_ancillary_data { > struct ancillary_device adev; > struct ancillary_resource resources; > } > Then each user can access the facets they need. The way most of this stuff works already it's not a table in the device itself, it's an array of resources with type information. Your second struct there is presumably just going to be the pointer and size information which you *could* split out but I'm really not sure what you're buying there. The interesting bit isn't really the data in the devices themselves, it's the code that allows devices to just supply a data table and have things mapped through to their child devices. That isn't particularly complex either, but it's still worth avoiding having lots of copies of it. *None* of this bus stuff is hugely complex but we still don't want each device with children having to open code it all when they could just do something data driven.