]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: wilc1000: separate hif_sdio and hif_spi into different module
authorGlen Lee <glen.lee@atmel.com>
Fri, 6 Nov 2015 09:39:58 +0000 (18:39 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Nov 2015 04:02:47 +0000 (20:02 -0800)
hif_sdio and hif_spi objects are compiled all the time even though one of SPI
or SDIO is selected. This patch separates hif_sdio and hif_spi into different
modules using ifdef define.
After rework SPI and SDIO modules with only one hif interface, the define
WILC_SDIO will be removed. This is first path of this series.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/Makefile
drivers/staging/wilc1000/wilc_wlan.c

index 64c2f1b83dfbebedf7f67150a949253ee7e7ad4e..650123df0b4c1f02a3cebf142bf91a2996bf4b3c 100644 (file)
@@ -21,8 +21,8 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
                        wilc_msgqueue.o \
                        coreconfigurator.o host_interface.o \
-                       wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o \
+                       wilc_wlan_cfg.o wilc_debugfs.o \
                        wilc_wlan.o
 
-wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o
-wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o
+wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o wilc_sdio.o
+wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o wilc_spi.o
index b6d784bcf98ef1a2f48522c2a5775a582635479f..2ce58702d705aab1ff2fbc07d89b052169c1055d 100644 (file)
@@ -2,8 +2,11 @@
 #include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_cfg.h"
 
+#ifdef WILC_SDIO
 extern struct wilc_hif_func hif_sdio;
+#else
 extern struct wilc_hif_func hif_spi;
+#endif
 u32 wilc_get_chipid(u8 update);
 
 typedef struct {
@@ -1659,26 +1662,21 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
        memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func,
               sizeof(wilc_wlan_io_func_t));
 
-       if ((inp->io_func.io_type & 0x1) == HIF_SDIO) {
-               if (!hif_sdio.hif_init(inp, wilc_debug)) {
-                       ret = -EIO;
-                       goto _fail_;
-               }
-               memcpy((void *)&g_wlan.hif_func, &hif_sdio,
-                      sizeof(struct wilc_hif_func));
-       } else {
-               if ((inp->io_func.io_type & 0x1) == HIF_SPI) {
-                       if (!hif_spi.hif_init(inp, wilc_debug)) {
-                               ret = -EIO;
-                               goto _fail_;
-                       }
-                       memcpy((void *)&g_wlan.hif_func, &hif_spi,
-                              sizeof(struct wilc_hif_func));
-               } else {
-                       ret = -EIO;
-                       goto _fail_;
-               }
+#ifdef WILC_SDIO
+       if (!hif_sdio.hif_init(inp, wilc_debug)) {
+               ret = -EIO;
+               goto _fail_;
        }
+       memcpy((void *)&g_wlan.hif_func, &hif_sdio,
+              sizeof(struct wilc_hif_func));
+#else
+       if (!hif_spi.hif_init(inp, wilc_debug)) {
+               ret = -EIO;
+               goto _fail_;
+       }
+       memcpy((void *)&g_wlan.hif_func, &hif_spi,
+              sizeof(struct wilc_hif_func));
+#endif
 
        if (!wilc_wlan_cfg_init(wilc_debug)) {
                ret = -ENOBUFS;