wil6210: platform hooks for modile init/exit
authorVladimir Kondratiev <QCA_vkondrat@QCA.qualcomm.com>
Tue, 9 Jun 2015 11:11:19 +0000 (14:11 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 9 Jun 2015 11:39:12 +0000 (14:39 +0300)
Provide platform hooks for module init/exit.
If platform require to perform some specific actions
in global context, this is where to do so.

Example may be turning on power for the PCIE based
on DT information.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/wil6210/pcie_bus.c
drivers/net/wireless/ath/wil6210/wil_platform.c
drivers/net/wireless/ath/wil6210/wil_platform.h

index 58c79166a6d11a5d676b857ccee5f55f0b71a415..a4417d4d302ff9e2d60fc5a2a531590cd7c947f8 100644 (file)
@@ -291,7 +291,27 @@ static struct pci_driver wil6210_driver = {
        .name           = WIL_NAME,
 };
 
-module_pci_driver(wil6210_driver);
+static int __init wil6210_driver_init(void)
+{
+       int rc;
+
+       rc = wil_platform_modinit();
+       if (rc)
+               return rc;
+
+       rc = pci_register_driver(&wil6210_driver);
+       if (rc)
+               wil_platform_modexit();
+       return rc;
+}
+module_init(wil6210_driver_init);
+
+static void __exit wil6210_driver_exit(void)
+{
+       pci_unregister_driver(&wil6210_driver);
+       wil_platform_modexit();
+}
+module_exit(wil6210_driver_exit);
 
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Qualcomm Atheros <wil6210@qca.qualcomm.com>");
index 976a071ba74e95dd79669a33ff9dd256c09e29bb..1db680f0c87fd0210b208a3c2b97daf267e586c8 100644 (file)
 #include "linux/device.h"
 #include "wil_platform.h"
 
+int __init wil_platform_modinit(void)
+{
+       return 0;
+}
+
+void wil_platform_modexit(void)
+{
+}
+
 /**
  * wil_platform_init() - wil6210 platform module init
  *
index 158c73b049a9b583602b54763d322d9bfd27bffa..d7fa19b7886dddf7bc08e3c15daabd95d319a476 100644 (file)
@@ -31,4 +31,7 @@ struct wil_platform_ops {
 
 void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops);
 
+int __init wil_platform_modinit(void);
+void wil_platform_modexit(void);
+
 #endif /* __WIL_PLATFORM_H__ */