A parent (such as the Intel audio controller) would use sdw_md_add() to create the device, passing a driver as a parameter. The sdw_md_release() would be called when put_device() is invoked by the parent. We use the shortcut 'md' for 'master device' to avoid very long function names.
I agree we should not have long name :) but md does not sound great. Can we drop the device and use sdw_slave and sdw_master for devices and append _driver when we are talking about drivers...
we dont use sd for slave and imo this would gel well with existing names
In SoundWire parlance, both 'Slave' and 'Master' are 'Devices', so yes we do in the standard talk about 'Slave Devices' and 'Master Devices'.
Then we have Linux 'Devices' which can be used for both.
If we use 'sdw_slave', would we be referring to the actual physical part or the Linux device?
FWIW the Greybus example used 'Host Device' and 'hd' as shortcut.
But this messes up consistency in the naming of sdw objects. I am all for it, if we do sd for slave and name all structs and APIs accordingly. The key is consistency!
So it needs to be sd/md and so on or sdw_slave and sdw_master and so on... not a mix of both
Well the problem is that the existing code took a shortcut and only modeled the slave part, e.g.
struct sdw_slave *slave = dev_to_sdw_dev(dev);
so now it's difficult to add 'sdw_slave_device' and 'sdw_master_device' without quite a few changes.
Would this work for you if we used the following names:
sdw_slave (legacy shortcut for sdw_slave_device, which could be removed in a a future cleanup if desired). sdw_slave_driver sdw_master_device sdw_master_driver
and all the 'md' replaced by the full 'master_device'.