[PATCH 1/3] Add dummy platform driver registration

Eugene Krasnikov k.eugene.e at gmail.com
Wed Aug 7 03:57:43 EDT 2013


This will make an abstraction over platform.

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 main.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/main.c b/main.c
index f241feb..7657f1d 100644
--- a/main.c
+++ b/main.c
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/wcnss_wlan.h>
 #include <linux/firmware.h>
+#include <linux/platform_device.h>
 #include "wcn36xx.h"
 
 unsigned int debug_mask;
@@ -953,6 +954,34 @@ static int wcn36xx_read_mac_addresses(struct wcn36xx *wcn)
 
 	return 0;
 }
+static int __devinit wcn36xx_probe(struct platform_device *pdev)
+{
+	wcn36xx_dbg(WCN36XX_DBG_MAC, "platform probe");
+	return 0;
+}
+static int __devexit wcn36xx_remove(struct platform_device *pdev)
+{
+	wcn36xx_dbg(WCN36XX_DBG_MAC, "platform remove");
+	return 0;
+}
+static const struct platform_device_id wcn36xx_platform_id_table[] = {
+	{
+		.name = "wcn36xx",
+		.driver_data = 0
+	},
+	{}
+};
+MODULE_DEVICE_TABLE(platform, wcn36xx_platform_id_table);
+
+static struct platform_driver wcn36xx_driver = {
+	.probe      = wcn36xx_probe,
+	.remove     = wcn36xx_remove,
+	.driver         = {
+		.name   = "wcn36xx",
+		.owner  = THIS_MODULE,
+	},
+	.id_table    = wcn36xx_platform_id_table,
+};
 
 static int __init wcn36xx_init(void)
 {
@@ -1041,6 +1070,7 @@ static int __init wcn36xx_init(void)
 	if (ret)
 		goto out_unmap;
 
+	platform_driver_register(&wcn36xx_driver);
 	return 0;
 
 out_unmap:
@@ -1057,6 +1087,7 @@ static void __exit wcn36xx_exit(void)
 	struct ieee80211_hw *hw = private_hw;
 	struct wcn36xx *wcn = hw->priv;
 
+	platform_driver_unregister(&wcn36xx_driver);
 	mutex_destroy(&wcn->pm_mutex);
 	mutex_destroy(&wcn->smd_mutex);
 
-- 
1.8.2.2




More information about the wcn36xx mailing list