wlcore: move wl12xx_platform_data up and make it truly optional
authorLuciano Coelho <coelho@ti.com>
Fri, 25 Jan 2013 10:05:34 +0000 (12:05 +0200)
committerLuciano Coelho <coelho@ti.com>
Fri, 8 Feb 2013 08:05:02 +0000 (10:05 +0200)
The platform data is used not only by wlcore-based drivers, but also
by wl1251.  Move it up in the directory hierarchy to reflect this.

Additionally, make it truly optional.  At the moment, disabling
platform data while wl1251_sdio or wlcore_sdio are enabled doesn't
work, but it will be necessary when device tree support is
implemented.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
arch/arm/mach-omap2/board-omap3evm.c
drivers/net/wireless/ti/Kconfig
drivers/net/wireless/ti/Makefile
drivers/net/wireless/ti/wilink_platform_data.c [new file with mode: 0644]
drivers/net/wireless/ti/wlcore/Kconfig
drivers/net/wireless/ti/wlcore/Makefile
drivers/net/wireless/ti/wlcore/wl12xx_platform_data.c [deleted file]
include/linux/wl12xx.h

index 3985f35aee06a6cffbc05d2930b56c456231ee97..a4ca63ba7faa9cd0ce22e6b316c9400260b58613 100644 (file)
@@ -309,7 +309,7 @@ static struct omap2_hsmmc_info mmc[] = {
                .gpio_wp        = 63,
                .deferred       = true,
        },
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
+#ifdef CONFIG_WILINK_PLATFORM_DATA
        {
                .name           = "wl1271",
                .mmc            = 2,
@@ -450,7 +450,7 @@ static struct regulator_init_data omap3evm_vio = {
        .consumer_supplies      = omap3evm_vio_supply,
 };
 
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
+#ifdef CONFIG_WILINK_PLATFORM_DATA
 
 #define OMAP3EVM_WLAN_PMENA_GPIO       (150)
 #define OMAP3EVM_WLAN_IRQ_GPIO         (149)
@@ -563,7 +563,7 @@ static struct omap_board_mux omap35x_board_mux[] __initdata = {
                                OMAP_PIN_OFF_NONE),
        OMAP3_MUX(GPMC_WAIT2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
                                OMAP_PIN_OFF_NONE),
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
+#ifdef CONFIG_WILINK_PLATFORM_DATA
        /* WLAN IRQ - GPIO 149 */
        OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
 
@@ -601,7 +601,7 @@ static struct omap_board_mux omap36x_board_mux[] __initdata = {
        OMAP3_MUX(SYS_BOOT4, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
        OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
        OMAP3_MUX(SYS_BOOT6, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
+#ifdef CONFIG_WILINK_PLATFORM_DATA
        /* WLAN IRQ - GPIO 149 */
        OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
 
@@ -637,7 +637,7 @@ static struct gpio omap3_evm_ehci_gpios[] __initdata = {
 
 static void __init omap3_evm_wl12xx_init(void)
 {
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
+#ifdef CONFIG_WILINK_PLATFORM_DATA
        int ret;
 
        /* WL12xx WLAN Init */
index be800119d0a355d5404122341def2dba8b21c647..cbe1e7fef61b226aa7af9614808bf747ec8d1ebe 100644 (file)
@@ -12,4 +12,13 @@ source "drivers/net/wireless/ti/wl18xx/Kconfig"
 
 # keep last for automatic dependencies
 source "drivers/net/wireless/ti/wlcore/Kconfig"
+
+config WILINK_PLATFORM_DATA
+       bool "TI WiLink platform data"
+       depends on WLCORE_SDIO || WL1251_SDIO
+       default y
+       ---help---
+       Small platform data bit needed to pass data to the sdio modules.
+
+
 endif # WL_TI
index 4d6823983c04e38e71a467deb15a098214e52daa..af14231aeedeffc6e7d8c87dcfbe8c84cfee7de2 100644 (file)
@@ -1,5 +1,7 @@
 obj-$(CONFIG_WLCORE)                   += wlcore/
 obj-$(CONFIG_WL12XX)                   += wl12xx/
-obj-$(CONFIG_WL12XX_PLATFORM_DATA)     += wlcore/
 obj-$(CONFIG_WL1251)                   += wl1251/
 obj-$(CONFIG_WL18XX)                   += wl18xx/
+
+# small builtin driver bit
+obj-$(CONFIG_WILINK_PLATFORM_DATA)     += wilink_platform_data.o
diff --git a/drivers/net/wireless/ti/wilink_platform_data.c b/drivers/net/wireless/ti/wilink_platform_data.c
new file mode 100644 (file)
index 0000000..998e958
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * This file is part of wl12xx
+ *
+ * Copyright (C) 2010-2011 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/wl12xx.h>
+
+static struct wl12xx_platform_data *platform_data;
+
+int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
+{
+       if (platform_data)
+               return -EBUSY;
+       if (!data)
+               return -EINVAL;
+
+       platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
+       if (!platform_data)
+               return -ENOMEM;
+
+       return 0;
+}
+
+struct wl12xx_platform_data *wl12xx_get_platform_data(void)
+{
+       if (!platform_data)
+               return ERR_PTR(-ENODEV);
+
+       return platform_data;
+}
+EXPORT_SYMBOL(wl12xx_get_platform_data);
index d7b907e67170348e70302e6a1cfe70642a8c6f7e..2b832825c3d41130e3ed1c4802dc5c1244275634 100644 (file)
@@ -33,8 +33,3 @@ config WLCORE_SDIO
 
          If you choose to build a module, it'll be called wlcore_sdio.
          Say N if unsure.
-
-config WL12XX_PLATFORM_DATA
-       bool
-       depends on WLCORE_SDIO != n || WL1251_SDIO != n
-       default y
index d9fba9e32130ad378a5b5d37b9cf99efdfac4cb2..b21398f6c3ecd14bdf0558f7fc49becaf482eeca 100644 (file)
@@ -9,7 +9,4 @@ obj-$(CONFIG_WLCORE)                    += wlcore.o
 obj-$(CONFIG_WLCORE_SPI)               += wlcore_spi.o
 obj-$(CONFIG_WLCORE_SDIO)              += wlcore_sdio.o
 
-# small builtin driver bit
-obj-$(CONFIG_WL12XX_PLATFORM_DATA)     += wl12xx_platform_data.o
-
 ccflags-y += -D__CHECK_ENDIAN__
diff --git a/drivers/net/wireless/ti/wlcore/wl12xx_platform_data.c b/drivers/net/wireless/ti/wlcore/wl12xx_platform_data.c
deleted file mode 100644 (file)
index 998e958..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of wl12xx
- *
- * Copyright (C) 2010-2011 Texas Instruments, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include <linux/module.h>
-#include <linux/err.h>
-#include <linux/wl12xx.h>
-
-static struct wl12xx_platform_data *platform_data;
-
-int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
-{
-       if (platform_data)
-               return -EBUSY;
-       if (!data)
-               return -EINVAL;
-
-       platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
-       if (!platform_data)
-               return -ENOMEM;
-
-       return 0;
-}
-
-struct wl12xx_platform_data *wl12xx_get_platform_data(void)
-{
-       if (!platform_data)
-               return ERR_PTR(-ENODEV);
-
-       return platform_data;
-}
-EXPORT_SYMBOL(wl12xx_get_platform_data);
index 360c9bce665cf4473e51b23ebc3b0ed0853a9592..a54fe82e704bc09c5acd6a5f1664a6dfbc982b64 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef _LINUX_WL12XX_H
 #define _LINUX_WL12XX_H
 
+#include <linux/err.h>
+
 /* Reference clock values */
 enum {
        WL12XX_REFCLOCK_19      = 0, /* 19.2 MHz */
@@ -60,10 +62,12 @@ struct wl12xx_platform_data {
 /* Platform does not support level trigger interrupts */
 #define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
 
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
+#ifdef CONFIG_WILINK_PLATFORM_DATA
 
 int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
 
+struct wl12xx_platform_data *wl12xx_get_platform_data(void);
+
 #else
 
 static inline
@@ -72,8 +76,12 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
        return -ENOSYS;
 }
 
-#endif
+static inline
+struct wl12xx_platform_data *wl12xx_get_platform_data(void)
+{
+       return ERR_PTR(-ENODATA);
+}
 
-struct wl12xx_platform_data *wl12xx_get_platform_data(void);
+#endif
 
 #endif