devlink is an API to expose device information and resources not directly
related to any device class, such as chip-wide/switch-ASIC-wide configuration.
Driver facing APIs are currently transitioning to allow more explicit
locking. Drivers can use the existing
devlink_* set of APIs, or
new APIs prefixed by
devl_*. The older APIs handle all the locking
in devlink core, but don’t allow registration of most sub-objects once
the main devlink object is itself registered. The newer
devl_* APIs assume
the devlink instance lock is already held. Drivers can take the instance
lock by calling
devl_lock(). It is also held in most of the callbacks.
Eventually all callbacks will be invoked under the devlink instance lock,
refer to the use of the
DEVLINK_NL_FLAG_NO_LOCK flag in devlink core
to find out which callbacks are not converted, yet.
Drivers are encouraged to use the devlink instance lock for their own needs.