1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3 
4 #include <linux/module.h>
5 #include <linux/netdevice.h>
6 
7 #include "ionic.h"
8 #include "ionic_bus.h"
9 #include "ionic_devlink.h"
10 
11 static int ionic_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
12 			     struct netlink_ext_ack *extack)
13 {
14 	return devlink_info_driver_name_put(req, IONIC_DRV_NAME);
15 }
16 
17 static const struct devlink_ops ionic_dl_ops = {
18 	.info_get	= ionic_dl_info_get,
19 };
20 
21 struct ionic *ionic_devlink_alloc(struct device *dev)
22 {
23 	struct devlink *dl;
24 
25 	dl = devlink_alloc(&ionic_dl_ops, sizeof(struct ionic));
26 
27 	return devlink_priv(dl);
28 }
29 
30 void ionic_devlink_free(struct ionic *ionic)
31 {
32 	struct devlink *dl = priv_to_devlink(ionic);
33 
34 	devlink_free(dl);
35 }
36