Re: [PATCH 08/15] devlink: add devres managed devlinkm_alloc and devlinkm_free
From: Jakub Kicinski <kuba@kernel.org>
Date: 2020-01-31 18:07:21
From: Jakub Kicinski <kuba@kernel.org>
Date: 2020-01-31 18:07:21
On Thu, 30 Jan 2020 14:59:03 -0800, Jacob Keller wrote:
Add devres managed allocation functions for allocating a devlink instance. These can be used by device drivers based on the devres framework which want to allocate a devlink instance. For simplicity and to reduce churn in the devlink core code, the devres management works by creating a node with a double-pointer. The devlink instance is allocated using the normal devlink_alloc and released using the normal devlink_free. An alternative solution where the raw memory for devlink is allocated directly via devres_alloc could be done. Such an implementation would either significantly increase code duplication or code churn in order to refactor the setup from the allocation. The new devres managed allocation function will be used by the ice driver in a following change to implement initial devlink support. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
How much are you actually going to gain by doing this given you still have to deal with registering an unregistering all devlink things...