On Fri, Oct 02, 2020 at 02:25:58PM -0300, Jason Gunthorpe wrote:
On Fri, Oct 02, 2020 at 05:23:53PM +0000, Ertman, David M wrote:
Would you recommend adding two elements to the ancillary_device like: void *ancillary_data; u32 ancildata_size; like the platform_device uses?
That doesn't seem useful here, the intent is to use container_of, if the creator wants to pass private data then it should be structured into the containing struct.
platform_devices/etc don't use container_of so have this side band way to pass more data.
The other thing platform_data lets you do is keep constant data separate from dynamic data - if you have to use container_of() then you need to either allocate a pointer to any constant data in the container or copy it into the container. Since the platform_data is in struct device it's going to be there anyway and may as well get used.