netdevsim: add stub netdevsim driver implementation
authorJiri Pirko <jiri@mellanox.com>
Thu, 25 Apr 2019 13:59:46 +0000 (15:59 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Apr 2019 05:52:02 +0000 (01:52 -0400)
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>
drivers/net/netdevsim/bus.c

index 7e83a2e856d3b6fa58f532eaa5aeb8381082e35e..5b5a9b0831a9f455af750899e5a2e07be5713717 100644 (file)
@@ -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);
 }