[PATCH 2/4] Define struct wcn36xx_msm

Eugene Krasnikov k.eugene.e at gmail.com
Thu Aug 8 03:42:33 EDT 2013


wcn36xx_msm will store all internal properties needed for this module.

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 wcn36xx_msm/main.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/wcn36xx_msm/main.c b/wcn36xx_msm/main.c
index 015c0ed..c1ede74 100644
--- a/wcn36xx_msm/main.c
+++ b/wcn36xx_msm/main.c
@@ -17,8 +17,12 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/wcnss_wlan.h>
+#include "../wcn36xx.h"
 
-static struct platform_device *core;
+struct wcn36xx_msm {
+	struct wcn36xx_platform_ctrl_ops ctrl_ops;
+	struct platform_device *core;
+} wmsm;
 
 static int __init wcn36xx_msm_init(void)
 {
@@ -27,7 +31,7 @@ static int __init wcn36xx_msm_init(void)
 	struct resource *tx_irq;
 	struct resource *rx_irq;
 	struct resource res[3];
-	core = platform_device_alloc("wcn36xx", -1);
+	wmsm.core = platform_device_alloc("wcn36xx", -1);
 
 	memset(res, 0x00, sizeof(res));
 
@@ -36,7 +40,8 @@ static int __init wcn36xx_msm_init(void)
 					      IORESOURCE_MEM,
 					      "wcnss_mmio");
 	if (wcnss_memory == NULL) {
-		dev_err(&core->dev, "Failed to get wcnss wlan memory map.\n");
+		dev_err(&wmsm.core->dev,
+			"Failed to get wcnss wlan memory map.\n");
 		ret = -ENOMEM;
 		return ret;
 	}
@@ -46,7 +51,7 @@ static int __init wcn36xx_msm_init(void)
 					      IORESOURCE_IRQ,
 					      "wcnss_wlantx_irq");
 	if (tx_irq == NULL) {
-		dev_err(&core->dev, "Failed to get wcnss tx_irq");
+		dev_err(&wmsm.core->dev, "Failed to get wcnss tx_irq");
 		ret = -ENOMEM;
 		return ret;
 	}
@@ -56,20 +61,20 @@ static int __init wcn36xx_msm_init(void)
 					      IORESOURCE_IRQ,
 					      "wcnss_wlanrx_irq");
 	if (rx_irq == NULL) {
-		dev_err(&core->dev, "Failed to get wcnss rx_irq");
+		dev_err(&wmsm.core->dev, "Failed to get wcnss rx_irq");
 		ret = -ENOMEM;
 		return ret;
 	}
 	memcpy(&res[2], rx_irq, sizeof(*rx_irq));
 
-	platform_device_add_resources(core, res, ARRAY_SIZE(res));
-	platform_device_add(core);
+	platform_device_add_resources(wmsm.core, res, ARRAY_SIZE(res));
+	platform_device_add(wmsm.core);
 	return 0;
 }
 static void __exit wcn36xx_msm_exit(void)
 {
-	platform_device_del(core);
-	platform_device_put(core);
+	platform_device_del(wmsm.core);
+	platform_device_put(wmsm.core);
 }
 module_init(wcn36xx_msm_init);
 module_exit(wcn36xx_msm_exit);
-- 
1.8.2.2




More information about the wcn36xx mailing list