OSDN Git Service

net: devlink: make the devlink_ops::info_get() callback optional
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Tue, 29 Nov 2022 09:51:39 +0000 (18:51 +0900)
committerJakub Kicinski <kuba@kernel.org>
Thu, 1 Dec 2022 05:49:39 +0000 (21:49 -0800)
commitc5cd7c86847cda0fdd44956561c0f3d9adea032b
tree08acd70c5edfbc6b471b6c61c500cb5a67d2e166
parent226bf980550627c88549b112ac6c8fb40873afb4
net: devlink: make the devlink_ops::info_get() callback optional

Some drivers only reported the driver name in their
devlink_ops::info_get() callback. Now that the core provides this
information, the callback became empty. For such drivers, just
removing the callback would prevent the core from executing
devlink_nl_info_fill() meaning that "devlink dev info" would not
return anything.

Make the callback function optional by executing
devlink_nl_info_fill() even if devlink_ops::info_get() is NULL.

N.B.: the drivers with devlink support which previously did not
implement devlink_ops::info_get() will now also be able to report
the driver name.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/devlink.c