On Wed, Sep 30, 2020 at 03:50:46PM -0700, Dave Ertman wrote:
+The parent device would then register the ancillary_device by calling +ancillary_device_initialize(), and then ancillary_device_add(), with the pointer +to the ancildev member of the above structure. The parent would provide a name +for the ancillary_device that, combined with the parent's KBUILD_MODNAME, will +create a match_name that will be used for matching and binding with a driver.
Why do you split this into two different calls?
You have to be _VERY_ careful after calling ancillary_device_initialize(), as now you can not just free up the memory if something goes wrong before ancillary_device_add() is called, right?
You need to document the heck out of that, otherwise people will get it wrong, and memory will leak.
greg k-h