summaryrefslogtreecommitdiff
path: root/drivers/net/netdevsim/bus.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2019-04-25 16:59:46 +0300
committerDavid S. Miller <davem@davemloft.net>2019-04-26 08:52:02 +0300
commit23d415dae924498dcd26acf2850715dd1f419550 (patch)
tree0aa8ec8b1d822792558e8dd66194e084d6289e55 /drivers/net/netdevsim/bus.c
parent40e4fe4ce115c409c3e2fbb247085103ef1cc755 (diff)
downloadlinux-23d415dae924498dcd26acf2850715dd1f419550.tar.xz
netdevsim: add stub netdevsim driver implementation
In order to bus probing to work correctly, register a simple netdevsim driver implementation. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim/bus.c')
-rw-r--r--drivers/net/netdevsim/bus.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/net/netdevsim/bus.c b/drivers/net/netdevsim/bus.c
index 7e83a2e856d3..5b5a9b0831a9 100644
--- a/drivers/net/netdevsim/bus.c
+++ b/drivers/net/netdevsim/bus.c
@@ -153,12 +153,31 @@ void nsim_bus_dev_del(struct nsim_bus_dev *nsim_bus_dev)
kfree(nsim_bus_dev);
}
+static struct device_driver nsim_driver = {
+ .name = DRV_NAME,
+ .bus = &nsim_bus,
+ .owner = THIS_MODULE,
+};
+
int nsim_bus_init(void)
{
- return bus_register(&nsim_bus);
+ int err;
+
+ err = bus_register(&nsim_bus);
+ if (err)
+ return err;
+ err = driver_register(&nsim_driver);
+ if (err)
+ goto err_bus_unregister;
+ return 0;
+
+err_bus_unregister:
+ bus_unregister(&nsim_bus);
+ return err;
}
void nsim_bus_exit(void)
{
+ driver_unregister(&nsim_driver);
bus_unregister(&nsim_bus);
}