Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1252310 > unrolled thread

[PATCH 00/19] staging/wilc1000 cleanups

Started byArnd Bergmann <arnd@arndb.de>
First post2015-10-21 00:50 +0200
Last post2015-10-27 08:20 +0100
Articles 20 on this page of 25 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/19] staging/wilc1000 cleanups Arnd Bergmann <arnd@arndb.de> - 2015-10-21 00:50 +0200
    [PATCH 17/19] staging/wilc1000: pass hif operations through initialization Arnd Bergmann <arnd@arndb.de> - 2015-10-21 00:50 +0200
    [PATCH 19/19] [RFC] staging/wilc1000: use more regular probing Arnd Bergmann <arnd@arndb.de> - 2015-10-21 00:50 +0200
    [PATCH 08/19] staging/wilc1000: move wilc_wlan_inp_t into struct wilc Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 10/19] staging/wilc1000: unify device pointer Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 04/19] staging/wilc1000: move extern declarations to headers Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 05/19] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 16/19] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 14/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 01/19] staging/wilc1000: remove unused functions Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
      Re: [PATCH 01/19] staging/wilc1000: remove unused functions Greg KH <gregkh@linuxfoundation.org> - 2015-10-25 09:30 +0100
    [PATCH 06/19] staging/wilc1000: avoid static definitions in header Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 09/19] staging/wilc1000: move init/exit functions to driver files Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 07/19] staging/wilc1000: remove linux_wlan_{device_power,device_detection} Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 13/19] staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 18/19] staging/wilc1000: split out bus specific modules Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
      [PATCH] fixup! staging/wilc1000: split out bus specific modules Arnd Bergmann <arnd@arndb.de> - 2015-10-21 16:30 +0200
    [PATCH 02/19] staging/wilc1000: make symbols static if possible Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    [PATCH 12/19] staging/wilc1000: use device pointer for phy creation Arnd Bergmann <arnd@arndb.de> - 2015-10-21 01:00 +0200
    Re: [PATCH 00/19] staging/wilc1000 cleanups glen lee <glen.lee@atmel.com> - 2015-10-21 12:10 +0200
      Re: [PATCH 00/19] staging/wilc1000 cleanups Arnd Bergmann <arnd@arndb.de> - 2015-10-21 13:00 +0200
      Re: [PATCH 00/19] staging/wilc1000 cleanups Arnd Bergmann <arnd@arndb.de> - 2015-10-22 14:30 +0200
        Re: [PATCH 00/19] staging/wilc1000 cleanups glen lee <glen.lee@atmel.com> - 2015-10-23 03:40 +0200
          Re: [PATCH 00/19] staging/wilc1000 cleanups Tony Cho <tony.cho@atmel.com> - 2015-10-23 10:00 +0200
            Re: [PATCH 00/19] staging/wilc1000 cleanups Tony Cho <tony.cho@atmel.com> - 2015-10-27 08:20 +0100

Page 1 of 2  [1] 2  Next page →


#1252310 — [PATCH 00/19] staging/wilc1000 cleanups

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 00:50 +0200
Subject[PATCH 00/19] staging/wilc1000 cleanups
Message-ID<qlNTc-O7-17@gated-at.bofh.it>
After I screwed up two or three times trying to get the dependencies
with the SPI and SDIO backends right, I ended up taking the time
to do the real fix and make both coexist.

This is a series of patches that address various issues with the
driver, but is mainly targetted at splitting out the spi and sdio
backends into separate drivers that can be built independent of
one another.

The last patch is more experimental than the others, hence the
[RFC] annotation.

Please review and test.

	Arnd

Arnd Bergmann (19):
  staging/wilc1000: remove unused functions
  staging/wilc1000: make symbols static if possible
  staging/wilc1000: use proper naming for global symbols
  staging/wilc1000: move extern declarations to headers
  staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT
  staging/wilc1000: avoid static definitions in header
  staging/wilc1000: remove linux_wlan_{device_power,device_detection}
  staging/wilc1000: move wilc_wlan_inp_t into struct wilc
  staging/wilc1000: move init/exit functions to driver files
  staging/wilc1000: unify device pointer
  staging/wilc1000: move wilc1000_ops to drivers
  staging/wilc1000: use device pointer for phy creation
  staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c
  staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
  staging/wilc1000: turn enable_irq/disable_irq into callbacks
  staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
  staging/wilc1000: pass hif operations through initialization
  staging/wilc1000: split out bus specific modules
  [RFC] staging/wilc1000: use more regular probing

 drivers/staging/wilc1000/Kconfig                  |  66 +-
 drivers/staging/wilc1000/Makefile                 |  16 +-
 drivers/staging/wilc1000/coreconfigurator.c       |  12 +-
 drivers/staging/wilc1000/coreconfigurator.h       |  12 +-
 drivers/staging/wilc1000/host_interface.c         | 501 +++-------------
 drivers/staging/wilc1000/host_interface.h         | 349 ++---------
 drivers/staging/wilc1000/linux_mon.c              |  11 +-
 drivers/staging/wilc1000/linux_wlan.c             | 695 +++++++---------------
 drivers/staging/wilc1000/linux_wlan_common.h      |  18 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c        | 202 +++++--
 drivers/staging/wilc1000/linux_wlan_sdio.h        |  14 -
 drivers/staging/wilc1000/linux_wlan_spi.c         | 119 ++--
 drivers/staging/wilc1000/linux_wlan_spi.h         |   8 -
 drivers/staging/wilc1000/wilc_debugfs.c           |  20 +-
 drivers/staging/wilc1000/wilc_sdio.c              | 213 +++----
 drivers/staging/wilc1000/wilc_spi.c               | 276 +--------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 495 +++++++--------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  87 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  21 +-
 drivers/staging/wilc1000/wilc_wlan.c              | 180 +++---
 drivers/staging/wilc1000/wilc_wlan.h              |  49 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c          |   6 +-
 drivers/staging/wilc1000/wilc_wlan_if.h           |  23 +-
 23 files changed, 1171 insertions(+), 2222 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h

-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1252317 — [PATCH 17/19] staging/wilc1000: pass hif operations through initialization

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 00:50 +0200
Subject[PATCH 17/19] staging/wilc1000: pass hif operations through initialization
Message-ID<qlNTe-O7-65@gated-at.bofh.it>
In reply to#1252310
The wilc1000_hif_spi and wilc1000_hif_sdio structures are part of
the bus specific code, and the generic code should have no knowledge
of their addresses.

This changes the code to reference them only from the bus
specific initialization code, which we can then use to split
up the driver into separate modules.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/linux_wlan.c         |  4 ++-
 drivers/staging/wilc1000/linux_wlan_sdio.c    |  3 ++-
 drivers/staging/wilc1000/linux_wlan_spi.c     |  3 ++-
 drivers/staging/wilc1000/wilc_sdio.c          | 35 +++++++++++++--------------
 drivers/staging/wilc1000/wilc_spi.c           | 34 +++++++++++++-------------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c          | 29 ++++------------------
 drivers/staging/wilc1000/wilc_wlan.h          | 11 +++++----
 8 files changed, 53 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 7b0ac31f04a2..04ebb6310070 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1503,7 +1503,8 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
 		WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, buff, size);
 }
 
-int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops, int gpio)
+int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
+		     const struct wilc1000_hif_ops *hif_ops, int gpio)
 {
 
 	int i;
@@ -1518,6 +1519,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops, int gpi
 		return -ENOMEM;
 
 	wilc1000_dev->ops = ops;
+	wilc1000_dev->hif_ops = hif_ops;
 	wilc1000_dev->gpio = gpio;
 
 	register_inetaddr_notifier(&g_dev_notifier);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 86251b907197..1f79d986be5c 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -206,7 +206,8 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 
 	PRINT_D(INIT_DBG, "Initializing netdev\n");
 	wilc1000_sdio_func = func;
-	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops, gpio)) {
+	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops,
+	    &wilc1000_hif_sdio, gpio)) {
 		PRINT_ER("Couldn't initialize netdev\n");
 		return -1;
 	}
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index c6ea3ef0664f..02b922ab86bb 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -424,7 +424,8 @@ static int __init init_wilc_spi_driver(void)
 	int ret;
 
 	wilc1000_init_driver();
-	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, GPIO_NUM);
+	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, &wilc1000_hif_spi,
+			       GPIO_NUM);
 	if (ret)
 		return ret;
 
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 69b7c72b76c5..5bfc093b6201 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -924,23 +924,22 @@ static int sdio_sync_ext(int nint /*  how mant interrupts to enable. */)
  *
  ********************************************/
 
-wilc_hif_func_t wilc1000_hif_sdio = {
-	sdio_init,
-	sdio_deinit,
-	sdio_read_reg,
-	sdio_write_reg,
-	sdio_read,
-	sdio_write,
-	sdio_sync,
-	sdio_clear_int,
-	sdio_read_int,
-	sdio_clear_int_ext,
-	sdio_read_size,
-	sdio_write,
-	sdio_read,
-	sdio_sync_ext,
-
-	sdio_set_max_speed,
-	sdio_set_default_speed,
+const struct wilc1000_hif_ops wilc1000_hif_sdio = {
+	.hif_init = sdio_init,
+	.hif_deinit = sdio_deinit,
+	.hif_read_reg = sdio_read_reg,
+	.hif_write_reg = sdio_write_reg,
+	.hif_block_rx = sdio_read,
+	.hif_block_tx = sdio_write,
+	.hif_sync = sdio_sync,
+	.hif_clear_int = sdio_clear_int,
+	.hif_read_int = sdio_read_int,
+	.hif_clear_int_ext = sdio_clear_int_ext,
+	.hif_read_size = sdio_read_size,
+	.hif_block_rx_ext = sdio_write,
+	.hif_block_tx_ext = sdio_read,
+	.hif_sync_ext = sdio_sync_ext,
+	.hif_set_max_bus_speed = sdio_set_max_speed,
+	.hif_set_default_bus_speed = sdio_set_default_speed,
 };
 
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 4c5659b72f29..a418774d7960 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -1032,21 +1032,21 @@ static int spi_sync_ext(int nint /*  how mant interrupts to enable. */)
  *      Global spi HIF function table
  *
  ********************************************/
-wilc_hif_func_t wilc1000_hif_spi = {
-	spi_init,
-	spi_deinit,
-	spi_read_reg,
-	spi_write_reg,
-	spi_read,
-	spi_write,
-	spi_sync,
-	spi_clear_int,
-	spi_read_int,
-	spi_clear_int_ext,
-	spi_read_size,
-	spi_write,
-	spi_read,
-	spi_sync_ext,
-	spi_max_bus_speed,
-	spi_default_bus_speed,
+const struct wilc1000_hif_ops wilc1000_hif_spi = {
+	.hif_init = spi_init,
+	.hif_deinit = spi_deinit,
+	.hif_read_reg = spi_read_reg,
+	.hif_write_reg = spi_write_reg,
+	.hif_block_rx = spi_read,
+	.hif_block_tx = spi_write,
+	.hif_sync = spi_sync,
+	.hif_clear_int = spi_clear_int,
+	.hif_read_int = spi_read_int,
+	.hif_clear_int_ext = spi_clear_int_ext,
+	.hif_read_size = spi_read_size,
+	.hif_block_rx_ext = spi_write,
+	.hif_block_tx_ext = spi_read,
+	.hif_sync_ext = spi_sync_ext,
+	.hif_set_max_bus_speed = spi_max_bus_speed,
+	.hif_set_default_bus_speed = spi_default_bus_speed,
 };
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index f1f78f51fea0..791ede247465 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -157,6 +157,7 @@ struct wilc_vif {
 
 struct wilc {
 	const struct wilc1000_ops *ops;
+	const struct wilc1000_hif_ops *hif_ops;
 	int mac_status;
 	int wilc1000_initialized;
 	int gpio;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 038c9b2eee6c..04d2938a383c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -28,7 +28,7 @@ typedef struct {
 	/**
 	 *      host interface functions
 	 **/
-	wilc_hif_func_t hif_func;
+	struct wilc1000_hif_ops hif_func;
 
 	/**
 	 *      configuration interface functions
@@ -1947,29 +1947,10 @@ int wilc_wlan_init(struct wilc *inp)
 	/***
 	 *      host interface init
 	 **/
-	if ((inp->ops->io_type & 0x1) == HIF_SDIO) {
-		if (!wilc1000_hif_sdio.hif_init(inp, wilc_debug)) {
-			/* EIO	5 */
-			ret = -5;
-			goto _fail_;
-		}
-		memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_sdio, sizeof(wilc_hif_func_t));
-	} else {
-		if ((inp->ops->io_type & 0x1) == HIF_SPI) {
-			/**
-			 *      TODO:
-			 **/
-			if (!wilc1000_hif_spi.hif_init(inp, wilc_debug)) {
-				/* EIO	5 */
-				ret = -5;
-				goto _fail_;
-			}
-			memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_spi, sizeof(wilc_hif_func_t));
-		} else {
-			/* EIO	5 */
-			ret = -5;
-			goto _fail_;
-		}
+	g_wlan.hif_func = *inp->hif_ops;
+	if (!g_wlan.hif_func.hif_init(inp, wilc_debug))	{
+		ret = -EIO;
+		goto _fail_;
 	}
 
 	/***
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 2f636534fc5d..f684d5bf465d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -251,7 +251,7 @@ struct rxq_entry_t {
 
 struct wilc;
 
-typedef struct {
+struct wilc1000_hif_ops {
 	int (*hif_init)(struct wilc *, wilc_debug_func);
 	int (*hif_deinit)(void *);
 	int (*hif_read_reg)(u32, u32 *);
@@ -268,10 +268,10 @@ typedef struct {
 	int (*hif_sync_ext)(int);
 	void (*hif_set_max_bus_speed)(void);
 	void (*hif_set_default_bus_speed)(void);
-} wilc_hif_func_t;
+};
 
-extern wilc_hif_func_t wilc1000_hif_spi;
-extern wilc_hif_func_t wilc1000_hif_sdio;
+extern const struct wilc1000_hif_ops wilc1000_hif_spi;
+extern const struct wilc1000_hif_ops wilc1000_hif_sdio;
 
 /********************************************
  *
@@ -318,7 +318,8 @@ void wilc1000_enable_tcp_ack_filter(bool value);
 void wilc1000_chip_sleep_manually(u32 u32SleepTime);
 int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops, int gpio);
+int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
+		     const struct wilc1000_hif_ops *hif_ops, int gpio);
 void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252319 — [PATCH 19/19] [RFC] staging/wilc1000: use more regular probing

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 00:50 +0200
Subject[PATCH 19/19] [RFC] staging/wilc1000: use more regular probing
Message-ID<qlNTd-O7-63@gated-at.bofh.it>
In reply to#1252310
So far, my patches tried to do equivalent conversions of the
existing code.  This one goes beyond that by restructuring
how the devices get probed. In particular, the spi driver
no longer creates the netdev until the device is probed,
and I've removed the global wilc1000_sdio_func and wilc_spi_dev
variables in favor of retrieving them from the wilc1000_dev
variable that will eventually get passed through all functions
instead of using a global.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/linux_wlan.c      |  30 ++++----
 drivers/staging/wilc1000/linux_wlan_sdio.c |  54 ++++---------
 drivers/staging/wilc1000/linux_wlan_spi.c  | 118 ++++++++++-------------------
 drivers/staging/wilc1000/wilc_wlan.h       |   5 +-
 4 files changed, 72 insertions(+), 135 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 8a5f4673c5d0..6e16c0b32f43 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1594,19 +1594,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-void __init wilc1000_init_driver(void)
-{
-#if defined(WILC_DEBUGFS)
-	if (wilc_debugfs_init() < 0)
-		PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
-#endif
-
-	printk("IN INIT FUNCTION\n");
-	printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
-}
-EXPORT_SYMBOL_GPL(wilc1000_init_driver);
-
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
+void wilc_netdev_free(struct wilc *wilc1000_dev)
 {
 	int i = 0;
 	perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
@@ -1653,16 +1641,28 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_free);
 
+int __init wilc1000_init_driver(void)
+{
+	int ret = 0;
+#if defined(WILC_DEBUGFS)
+	ret = wilc_debugfs_init();
+	if (ret < 0)
+		PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
+#endif
+	return ret;
+
+}
+module_init(wilc1000_init_driver);
+
 void __exit wilc1000_exit_driver(void)
 {
 	kfree(wilc1000_dev);
 	wilc1000_dev = NULL;
-	printk("Module_exit Done.\n");
 
 #if defined(WILC_DEBUGFS)
 	wilc_debugfs_remove();
 #endif
 }
-EXPORT_SYMBOL_GPL(wilc1000_exit_driver);
+module_exit(wilc1000_exit_driver);
 
 MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1f343ac72530..916c2a1d189d 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -24,7 +24,6 @@
 #endif
 
 
-static struct sdio_func *wilc1000_sdio_func;
 static unsigned int sdio_default_speed;
 
 #define SDIO_VENDOR_ID_WILC 0x0296
@@ -113,6 +112,7 @@ static const struct wilc1000_ops wilc1000_sdio_ops;
 
 static struct sdio_driver wilc_bus;
 static volatile int wilc1000_probe;
+static struct sdio_func *wilc1000_sdio_func;
 
 #define READY_CHECK_THRESHOLD		30
 static u8 wilc1000_prepare_11b_core(struct wilc *nic)
@@ -195,6 +195,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 		PRINT_D(INIT_DBG, "wilc1000_sdio_func isn't NULL\n");
 		return 0;
 	}
+	wilc1000_sdio_func = func;
 #endif
 
 	gpio = -1;
@@ -205,13 +206,13 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 	}
 
 	PRINT_D(INIT_DBG, "Initializing netdev\n");
-	wilc1000_sdio_func = func;
 	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops,
 	    &wilc1000_hif_sdio, gpio)) {
 		PRINT_ER("Couldn't initialize netdev\n");
 		return -1;
 	}
-	wilc1000_dev->dev = &wilc1000_sdio_func->dev;
+	wilc1000_dev->dev = &func->dev;
+	sdio_set_drvdata(func, wilc1000_dev);
 
 	printk("Driver Initializing success\n");
 	return 0;
@@ -219,18 +220,17 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 
 static void linux_sdio_remove(struct sdio_func *func)
 {
-	/**
-	 *      TODO
-	 **/
-
+	wilc_netdev_free(sdio_get_drvdata(func));
 }
 
-static struct sdio_driver wilc_bus = {
+static struct sdio_driver wilc1000_sdio_driver = {
 	.name		= SDIO_MODALIAS,
 	.id_table	= wilc_sdio_ids,
 	.probe		= linux_sdio_probe,
 	.remove		= linux_sdio_remove,
 };
+module_driver(wilc1000_sdio_driver, sdio_register_driver, sdio_unregister_driver);
+MODULE_LICENSE("GPL");
 
 static int wilc1000_sdio_enable_interrupt(struct wilc *dev)
 {
@@ -268,14 +268,15 @@ static void wilc1000_sdio_disable_interrupt(struct wilc *dev)
 static int linux_sdio_set_speed(int speed)
 {
 	struct mmc_ios ios;
+	struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
 
-	sdio_claim_host(wilc1000_sdio_func);
+	sdio_claim_host(func);
 
-	memcpy((void *)&ios, (void *)&wilc1000_sdio_func->card->host->ios, sizeof(struct mmc_ios));
-	wilc1000_sdio_func->card->host->ios.clock = speed;
+	memcpy((void *)&ios, (void *)&func->card->host->ios, sizeof(struct mmc_ios));
+	func->card->host->ios.clock = speed;
 	ios.clock = speed;
-	wilc1000_sdio_func->card->host->ops->set_ios(wilc1000_sdio_func->card->host, &ios);
-	sdio_release_host(wilc1000_sdio_func);
+	func->card->host->ops->set_ios(func->card->host, &ios);
+	sdio_release_host(func);
 	PRINT_INFO(INIT_DBG, "@@@@@@@@@@@@ change SDIO speed to %d @@@@@@@@@\n", speed);
 
 	return 1;
@@ -283,7 +284,8 @@ static int linux_sdio_set_speed(int speed)
 
 static int linux_sdio_get_speed(void)
 {
-	return wilc1000_sdio_func->card->host->ios.clock;
+	struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
+	return func->card->host->ios.clock;
 }
 
 static int wilc1000_sdio_init(void *pv)
@@ -300,13 +302,6 @@ static int wilc1000_sdio_init(void *pv)
 
 static void wilc1000_sdio_deinit(void *pv)
 {
-
-	/**
-	 *      TODO :
-	 **/
-
-
-	sdio_unregister_driver(&wilc_bus);
 }
 
 static int wilc1000_sdio_set_max_speed(void)
@@ -334,20 +329,3 @@ static const struct wilc1000_ops wilc1000_sdio_ops = {
 	.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
 	.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
 };
-
-static int __init init_wilc_sdio_driver(void)
-{
-	wilc1000_init_driver();
-	return sdio_register_driver(&wilc_bus);
-}
-late_initcall(init_wilc_sdio_driver);
-
-static void __exit exit_wilc_sdio_driver(void)
-{
-	if (wilc1000_dev)
-		wilc_netdev_free(wilc1000_dev);
-	sdio_unregister_driver(&wilc_bus);
-	wilc1000_exit_driver();
-}
-module_exit(exit_wilc_sdio_driver);
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index c0e0e6be6b0b..d472edcfdf9d 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -8,6 +8,7 @@
 #include <linux/uaccess.h>
 #include <linux/device.h>
 #include <linux/spi/spi.h>
+#include <linux/of_gpio.h>
 
 #include "wilc_wfi_netdevice.h"
 #include "linux_wlan_common.h"
@@ -43,72 +44,61 @@
 
 static u32 SPEED = MIN_SPEED;
 
-struct spi_device *wilc_spi_dev;
+static const struct wilc1000_ops wilc1000_spi_ops;
 
 static int __init wilc_bus_probe(struct spi_device *spi)
 {
+	int ret, gpio;
 
-	PRINT_D(BUS_DBG, "spiModalias: %s\n", spi->modalias);
-	PRINT_D(BUS_DBG, "spiMax-Speed: %d\n", spi->max_speed_hz);
-	wilc_spi_dev = spi;
+	gpio = of_get_gpio(spi->dev.of_node, 0);
+	if (gpio < 0)
+		gpio = GPIO_NUM;
+
+	ret = wilc_netdev_init(&spi->dev, &wilc1000_spi_ops, &wilc1000_hif_spi,
+			       gpio);
+	if (ret)
+		return ret;
+
+	spi_set_drvdata(spi, wilc1000_dev);
+	wilc1000_dev->dev = &spi->dev;
 
-	printk("Driver Initializing success\n");
 	return 0;
 }
 
-static int __exit wilc_bus_remove(struct spi_device *spi)
+static int wilc_bus_remove(struct spi_device *spi)
 {
-
+	wilc_netdev_free(spi_get_drvdata(spi));
 	return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id wilc1000_of_match[] = {
 	{ .compatible = "atmel,wilc_spi", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, wilc1000_of_match);
-#endif
 
-struct spi_driver wilc_bus __refdata = {
+struct spi_driver wilc1000_spi_driver __refdata = {
 	.driver = {
 		.name = MODALIAS,
-#ifdef CONFIG_OF
 		.of_match_table = wilc1000_of_match,
-#endif
 	},
 	.probe =  wilc_bus_probe,
-	.remove = __exit_p(wilc_bus_remove),
+	.remove = wilc_bus_remove,
 };
-
+module_spi_driver(wilc1000_spi_driver);
+MODULE_LICENSE("GPL");
 
 static void wilc1000_spi_deinit(void *vp)
 {
-
-	spi_unregister_driver(&wilc_bus);
-
 	SPEED = MIN_SPEED;
 	PRINT_ER("@@@@@@@@@@@@ restore SPI speed to %d @@@@@@@@@\n", SPEED);
-
 }
 
 
 
 static int wilc1000_spi_init(void *vp)
 {
-	int ret = 1;
-	static int called;
-
-
-	if (called == 0) {
-		called++;
-		ret = spi_register_driver(&wilc_bus);
-	}
-
-	/* change return value to match WILC interface */
-	(ret < 0) ? (ret = 0) : (ret = 1);
-
-	return ret;
+	return 1;
 }
 
 #if defined(PLAT_WMS8304)
@@ -119,6 +109,7 @@ static int wilc1000_spi_init(void *vp)
 
 static int wilc1000_spi_write(u8 *b, u32 len)
 {
+	struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
 	int ret;
 
 	if (len > 0 && b != NULL) {
@@ -145,11 +136,11 @@ static int wilc1000_spi_write(u8 *b, u32 len)
 
 				memset(&msg, 0, sizeof(msg));
 				spi_message_init(&msg);
-				msg.spi = wilc_spi_dev;
+				msg.spi = spi;
 				msg.is_dma_mapped = USE_SPI_DMA;
 
 				spi_message_add_tail(&tr, &msg);
-				ret = spi_sync(wilc_spi_dev, &msg);
+				ret = spi_sync(spi, &msg);
 				if (ret < 0) {
 					PRINT_ER("SPI transaction failed\n");
 				}
@@ -170,11 +161,11 @@ static int wilc1000_spi_write(u8 *b, u32 len)
 
 			memset(&msg, 0, sizeof(msg));
 			spi_message_init(&msg);
-			msg.spi = wilc_spi_dev;
+			msg.spi = spi;
 			msg.is_dma_mapped = USE_SPI_DMA;                                /* rachel */
 
 			spi_message_add_tail(&tr, &msg);
-			ret = spi_sync(wilc_spi_dev, &msg);
+			ret = spi_sync(spi, &msg);
 			if (ret < 0) {
 				PRINT_ER("SPI transaction failed\n");
 			}
@@ -196,7 +187,7 @@ static int wilc1000_spi_write(u8 *b, u32 len)
 #else
 static int wilc1000_spi_write(u8 *b, u32 len)
 {
-
+	struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
 	int ret;
 	struct spi_message msg;
 
@@ -217,12 +208,12 @@ static int wilc1000_spi_write(u8 *b, u32 len)
 		memset(&msg, 0, sizeof(msg));
 		spi_message_init(&msg);
 /* [[johnny add */
-		msg.spi = wilc_spi_dev;
+		msg.spi = spi;
 		msg.is_dma_mapped = USE_SPI_DMA;
 /* ]] */
 		spi_message_add_tail(&tr, &msg);
 
-		ret = spi_sync(wilc_spi_dev, &msg);
+		ret = spi_sync(spi, &msg);
 		if (ret < 0) {
 			PRINT_ER("SPI transaction failed\n");
 		}
@@ -247,6 +238,7 @@ static int wilc1000_spi_write(u8 *b, u32 len)
 
 static int wilc1000_spi_read(u8 *rb, u32 rlen)
 {
+	struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
 	int ret;
 
 	if (rlen > 0) {
@@ -273,11 +265,11 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)
 
 				memset(&msg, 0, sizeof(msg));
 				spi_message_init(&msg);
-				msg.spi = wilc_spi_dev;
+				msg.spi = spi;
 				msg.is_dma_mapped = USE_SPI_DMA;
 
 				spi_message_add_tail(&tr, &msg);
-				ret = spi_sync(wilc_spi_dev, &msg);
+				ret = spi_sync(spi, &msg);
 				if (ret < 0) {
 					PRINT_ER("SPI transaction failed\n");
 				}
@@ -297,11 +289,11 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)
 
 			memset(&msg, 0, sizeof(msg));
 			spi_message_init(&msg);
-			msg.spi = wilc_spi_dev;
+			msg.spi = spi;
 			msg.is_dma_mapped = USE_SPI_DMA;                                /* rachel */
 
 			spi_message_add_tail(&tr, &msg);
-			ret = spi_sync(wilc_spi_dev, &msg);
+			ret = spi_sync(spi, &msg);
 			if (ret < 0) {
 				PRINT_ER("SPI transaction failed\n");
 			}
@@ -321,7 +313,7 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)
 #else
 static int wilc1000_spi_read(u8 *rb, u32 rlen)
 {
-
+	struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
 	int ret;
 
 	if (rlen > 0) {
@@ -342,12 +334,12 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)
 		memset(&msg, 0, sizeof(msg));
 		spi_message_init(&msg);
 /* [[ johnny add */
-		msg.spi = wilc_spi_dev;
+		msg.spi = spi;
 		msg.is_dma_mapped = USE_SPI_DMA;
 /* ]] */
 		spi_message_add_tail(&tr, &msg);
 
-		ret = spi_sync(wilc_spi_dev, &msg);
+		ret = spi_sync(spi, &msg);
 		if (ret < 0) {
 			PRINT_ER("SPI transaction failed\n");
 		}
@@ -366,7 +358,7 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)
 
 static int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 {
-
+	struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
 	int ret;
 
 	if (rlen > 0) {
@@ -383,11 +375,11 @@ static int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 
 		memset(&msg, 0, sizeof(msg));
 		spi_message_init(&msg);
-		msg.spi = wilc_spi_dev;
+		msg.spi = spi;
 		msg.is_dma_mapped = USE_SPI_DMA;
 
 		spi_message_add_tail(&tr, &msg);
-		ret = spi_sync(wilc_spi_dev, &msg);
+		ret = spi_sync(spi, &msg);
 		if (ret < 0) {
 			PRINT_ER("SPI transaction failed\n");
 		}
@@ -418,33 +410,3 @@ static const struct wilc1000_ops wilc1000_spi_ops = {
 	.u.spi.spi_trx = wilc1000_spi_write_read,
 	.u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
 };
-
-static int __init init_wilc_spi_driver(void)
-{
-	int ret;
-
-	wilc1000_init_driver();
-	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, &wilc1000_hif_spi,
-			       GPIO_NUM);
-	if (ret)
-		return ret;
-
-	if (!wilc1000_spi_init(NULL)) {
-		PRINT_ER("Can't initialize SPI\n");
-		return -ENXIO;
-	}
-	wilc1000_dev->dev = &wilc_spi_dev->dev;
-
-	return ret;
-}
-late_initcall(init_wilc_spi_driver);
-
-static void __exit exit_wilc_spi_driver(void)
-{
-	if (wilc1000_dev)
-		wilc_netdev_free(wilc1000_dev);
-	spi_unregister_driver(&wilc_bus);
-	wilc1000_exit_driver();
-}
-module_exit(exit_wilc_spi_driver);
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index f684d5bf465d..a551e6810ff3 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -320,7 +320,7 @@ int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
 		     const struct wilc1000_hif_ops *hif_ops, int gpio);
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+void wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
 
@@ -340,7 +340,4 @@ extern bool wilc1000_enable_ps;
 int wilc1000_firmware_download(struct wilc *p_nic);
 int wilc1000_start_firmware(struct wilc_per_interface *nic);
 
-void __init wilc1000_init_driver(void);
-void __exit wilc1000_exit_driver(void);
-
 #endif
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252320 — [PATCH 08/19] staging/wilc1000: move wilc_wlan_inp_t into struct wilc

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 08/19] staging/wilc1000: move wilc_wlan_inp_t into struct wilc
Message-ID<qlO2S-10k-5@gated-at.bofh.it>
In reply to#1252310
wilc_wlan_inp_t is an unnecessary indirection and requires linux_wlan.c
to have knowledge of the specific sdio and spi front-ends. This
removes the structure and places the members with a constant
'struct wilc1000_ops' pointer inside of 'struct wilc'.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/linux_wlan.c         | 67 +++++++++++++--------------
 drivers/staging/wilc1000/wilc_sdio.c          | 17 +++----
 drivers/staging/wilc1000/wilc_spi.c           | 17 +++----
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c          | 22 ++++-----
 drivers/staging/wilc1000/wilc_wlan.h          |  4 +-
 drivers/staging/wilc1000/wilc_wlan_if.h       | 16 ++-----
 7 files changed, 70 insertions(+), 74 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index eb4c6cba4575..53cecb892a84 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -923,31 +923,29 @@ static int wlan_deinit_locks(struct wilc *nic)
 	return 0;
 }
 
-static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
-{
-
-	PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
-
-	nwi->os_context.os_private = (void *)nic;
-
 #ifdef WILC_SDIO
-	nwi->io_func.io_type = HIF_SDIO;
-	nwi->io_func.io_init = wilc1000_sdio_init;
-	nwi->io_func.io_deinit = wilc1000_sdio_deinit;
-	nwi->io_func.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52;
-	nwi->io_func.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53;
-	nwi->io_func.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed;
-	nwi->io_func.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed;
-#else
-	nwi->io_func.io_type = HIF_SPI;
-	nwi->io_func.io_init = wilc1000_spi_init;
-	nwi->io_func.io_deinit = wilc1000_spi_deinit;
-	nwi->io_func.u.spi.spi_tx = wilc1000_spi_write;
-	nwi->io_func.u.spi.spi_rx = wilc1000_spi_read;
-	nwi->io_func.u.spi.spi_trx = wilc1000_spi_write_read;
-	nwi->io_func.u.spi.spi_max_speed = wilc1000_spi_set_max_speed;
+static const struct wilc1000_ops wilc1000_sdio_ops = {
+	.io_type = HIF_SDIO,
+	.io_init = wilc1000_sdio_init,
+	.io_deinit = wilc1000_sdio_deinit,
+	.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
+	.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
+	.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
+	.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
+};
+#endif
+
+#ifdef WILC_SPI
+static const struct wilc1000_ops wilc1000_spi_ops = {
+	.io_type = HIF_SPI,
+	.io_init = wilc1000_spi_init,
+	.io_deinit = wilc1000_spi_deinit,
+	.u.spi.spi_tx = wilc1000_spi_write,
+	.u.spi.spi_rx = wilc1000_spi_read,
+	.u.spi.spi_trx = wilc1000_spi_write_read,
+	.u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
+};
 #endif
-}
 
 static int wlan_initialize_threads(perInterface_wlan_t *nic)
 {
@@ -995,7 +993,7 @@ static void wlan_deinitialize_threads(struct wilc *nic)
 #ifdef COMPLEMENT_BOOT
 
 #define READY_CHECK_THRESHOLD		30
-static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
+static u8 wilc1000_prepare_11b_core(struct wilc *nic)
 {
 	u8 trials = 0;
 
@@ -1011,8 +1009,8 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 			msleep(100);
 		wilc1000_probe = 0;
 		wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
-		linux_to_wlan(nwi, nic);
-		wilc_wlan_init(nwi);
+		nic->ops = &wilc1000_sdio_ops;
+		wilc_wlan_init(nic);
 	}
 
 	if (READY_CHECK_THRESHOLD <= trials)
@@ -1025,8 +1023,6 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 static int repeat_power_cycle(perInterface_wlan_t *nic)
 {
 	int ret = 0;
-	wilc_wlan_inp_t nwi;
-
 	sdio_unregister_driver(&wilc_bus);
 
 	sdio_register_driver(&wilc_bus);
@@ -1036,8 +1032,8 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 		msleep(100);
 	wilc1000_probe = 0;
 	wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
-	linux_to_wlan(&nwi, wilc1000_dev);
-	ret = wilc_wlan_init(&nwi);
+	wilc1000_dev->ops = &wilc1000_sdio_ops;
+	ret = wilc_wlan_init(wilc1000_dev);
 
 	wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
 	#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
@@ -1067,7 +1063,6 @@ __fail__:
 
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 {
-	wilc_wlan_inp_t nwi;
 	perInterface_wlan_t *nic = p_nic;
 	int ret = 0;
 
@@ -1078,9 +1073,13 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 
 		wlan_init_locks(wilc1000_dev);
 
-		linux_to_wlan(&nwi, wilc1000_dev);
+#ifdef WILC_SDIO
+		wilc1000_dev->ops = &wilc1000_sdio_ops;
+#else
+		wilc1000_dev->ops = &wilc1000_spi_ops;
+#endif
 
-		ret = wilc_wlan_init(&nwi);
+		ret = wilc_wlan_init(wilc1000_dev);
 		if (ret < 0) {
 			PRINT_ER("Initializing WILC_Wlan FAILED\n");
 			ret = -EIO;
@@ -1095,7 +1094,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 		}
 
 #if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
-		if (wilc1000_prepare_11b_core(&nwi, wilc1000_dev)) {
+		if (wilc1000_prepare_11b_core(wilc1000_dev)) {
 			PRINT_ER("11b Core is not ready\n");
 			ret = -EIO;
 			goto _fail_threads_;
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 91b626ac8797..2d39a5386718 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -8,6 +8,7 @@
 /* //////////////////////////////////////////////////////////////////////////// */
 
 #include <linux/string.h>
+#include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_if.h"
 #include "wilc_wlan.h"
 
@@ -498,7 +499,7 @@ static int sdio_sync(void)
 	return 1;
 }
 
-static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
+static int sdio_init(struct wilc *inp, wilc_debug_func func)
 {
 	sdio_cmd52_t cmd;
 	int loop;
@@ -507,10 +508,10 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
 	memset(&g_sdio, 0, sizeof(wilc_sdio_t));
 
 	g_sdio.dPrint = func;
-	g_sdio.os_context = inp->os_context.os_private;
+	g_sdio.os_context = inp;
 
-	if (inp->io_func.io_init) {
-		if (!inp->io_func.io_init(g_sdio.os_context)) {
+	if (inp->ops->io_init) {
+		if (!inp->ops->io_init(g_sdio.os_context)) {
 			g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
 			return 0;
 		}
@@ -518,10 +519,10 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
 		return 0;
 	}
 
-	g_sdio.sdio_cmd52	= inp->io_func.u.sdio.sdio_cmd52;
-	g_sdio.sdio_cmd53	= inp->io_func.u.sdio.sdio_cmd53;
-	g_sdio.sdio_set_max_speed	= inp->io_func.u.sdio.sdio_set_max_speed;
-	g_sdio.sdio_set_default_speed	= inp->io_func.u.sdio.sdio_set_default_speed;
+	g_sdio.sdio_cmd52	= inp->ops->u.sdio.sdio_cmd52;
+	g_sdio.sdio_cmd53	= inp->ops->u.sdio.sdio_cmd53;
+	g_sdio.sdio_set_max_speed	= inp->ops->u.sdio.sdio_set_max_speed;
+	g_sdio.sdio_set_default_speed	= inp->ops->u.sdio.sdio_set_default_speed;
 
 	/**
 	 *      function 0 csa enable
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index bb7ee37171ce..4c5659b72f29 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -8,6 +8,7 @@
 /* //////////////////////////////////////////////////////////////////////////// */
 
 #include <linux/string.h>
+#include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_if.h"
 #include "wilc_wlan.h"
 
@@ -724,7 +725,7 @@ static int spi_sync(void)
 	return 1;
 }
 
-static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
+static int spi_init(struct wilc *inp, wilc_debug_func func)
 {
 	u32 reg;
 	u32 chipid;
@@ -743,19 +744,19 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
 	memset(&g_spi, 0, sizeof(wilc_spi_t));
 
 	g_spi.dPrint = func;
-	g_spi.os_context = inp->os_context.os_private;
-	if (inp->io_func.io_init) {
-		if (!inp->io_func.io_init(g_spi.os_context)) {
+	g_spi.os_context = inp;
+	if (inp->ops->io_init) {
+		if (!inp->ops->io_init(g_spi.os_context)) {
 			PRINT_ER("[wilc spi]: Failed io init bus...\n");
 			return 0;
 		}
 	} else {
 		return 0;
 	}
-	g_spi.spi_tx = inp->io_func.u.spi.spi_tx;
-	g_spi.spi_rx = inp->io_func.u.spi.spi_rx;
-	g_spi.spi_trx = inp->io_func.u.spi.spi_trx;
-	g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed;
+	g_spi.spi_tx = inp->ops->u.spi.spi_tx;
+	g_spi.spi_rx = inp->ops->u.spi.spi_rx;
+	g_spi.spi_trx = inp->ops->u.spi.spi_trx;
+	g_spi.spi_max_speed = inp->ops->u.spi.spi_max_speed;
 
 	/**
 	 *      configure protocol
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 28610d889c0c..485df4768e78 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -156,6 +156,7 @@ struct wilc_vif {
 };
 
 struct wilc {
+	const struct wilc1000_ops *ops;
 	int mac_status;
 	int wilc1000_initialized;
 	#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index a147547fb66e..7e1b892f721d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -23,7 +23,7 @@ typedef struct {
 	/**
 	 *      input interface functions
 	 **/
-	wilc_wlan_io_func_t io_func;
+	const struct wilc1000_ops *io_func;
 
 	/**
 	 *      host interface functions
@@ -651,7 +651,7 @@ static inline void chip_wakeup(void)
 	u32 reg, clk_status_reg, trials = 0;
 	u32 sleep_time;
 
-	if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+	if ((g_wlan.io_func->io_type & 0x1) == HIF_SPI) {
 		do {
 			g_wlan.hif_func.hif_read_reg(1, &reg);
 			/* Set bit 1 */
@@ -671,7 +671,7 @@ static inline void chip_wakeup(void)
 			} while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0));
 
 		} while (wilc_get_chipid(true) == 0);
-	} else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO)	 {
+	} else if ((g_wlan.io_func->io_type & 0x1) == HIF_SDIO)	 {
 		g_wlan.hif_func.hif_read_reg(0xf0, &reg);
 		do {
 			/* Set bit 1 */
@@ -731,7 +731,7 @@ static inline void chip_wakeup(void)
 	u32 reg, trials = 0;
 
 	do {
-		if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+		if ((g_wlan.io_func->io_type & 0x1) == HIF_SPI) {
 			g_wlan.hif_func.hif_read_reg(1, &reg);
 			/* Make sure bit 1 is 0 before we start. */
 			g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
@@ -739,7 +739,7 @@ static inline void chip_wakeup(void)
 			g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
 			/* Clear bit 1*/
 			g_wlan.hif_func.hif_write_reg(1, reg  & ~BIT(1));
-		} else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO)	 {
+		} else if ((g_wlan.io_func->io_type & 0x1) == HIF_SDIO)	 {
 			/* Make sure bit 0 is 0 before we start. */
 			g_wlan.hif_func.hif_read_reg(0xf0, &reg);
 			g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
@@ -1465,10 +1465,10 @@ int wilc_wlan_start(void)
 	/**
 	 *      Set the host interface
 	 **/
-	if (p->io_func.io_type == HIF_SDIO) {
+	if (p->io_func->io_type == HIF_SDIO) {
 		reg = 0;
 		reg |= BIT(3); /* bug 4456 and 4557 */
-	} else if (p->io_func.io_type == HIF_SPI) {
+	} else if (p->io_func->io_type == HIF_SPI) {
 		reg = 1;
 	}
 	acquire_bus(ACQUIRE_ONLY);
@@ -1932,7 +1932,7 @@ u8 wilc1000_core_11b_ready(void)
 }
 #endif
 
-int wilc_wlan_init(wilc_wlan_inp_t *inp)
+int wilc_wlan_init(struct wilc *inp)
 {
 
 	int ret = 0;
@@ -1944,11 +1944,11 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp)
 	/**
 	 *      store the input
 	 **/
-	memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, sizeof(wilc_wlan_io_func_t));
+	g_wlan.io_func = inp->ops;
 	/***
 	 *      host interface init
 	 **/
-	if ((inp->io_func.io_type & 0x1) == HIF_SDIO) {
+	if ((inp->ops->io_type & 0x1) == HIF_SDIO) {
 		if (!wilc1000_hif_sdio.hif_init(inp, wilc_debug)) {
 			/* EIO	5 */
 			ret = -5;
@@ -1956,7 +1956,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp)
 		}
 		memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_sdio, sizeof(wilc_hif_func_t));
 	} else {
-		if ((inp->io_func.io_type & 0x1) == HIF_SPI) {
+		if ((inp->ops->io_type & 0x1) == HIF_SPI) {
 			/**
 			 *      TODO:
 			 **/
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 64295a664ea9..4460c482cb7a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -251,8 +251,10 @@ struct rxq_entry_t {
  *
  ********************************************/
 
+struct wilc;
+
 typedef struct {
-	int (*hif_init)(wilc_wlan_inp_t *, wilc_debug_func);
+	int (*hif_init)(struct wilc *, wilc_debug_func);
 	int (*hif_deinit)(void *);
 	int (*hif_read_reg)(u32, u32 *);
 	int (*hif_write_reg)(u32, u32);
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index be972afe6e62..bfa1291e22ed 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -71,7 +71,7 @@ typedef struct {
 	u32 block_size;
 } sdio_cmd53_t;
 
-typedef struct {
+struct wilc1000_ops {
 	int io_type;
 	int (*io_init)(void *);
 	void (*io_deinit)(void *);
@@ -89,7 +89,7 @@ typedef struct {
 			int (*spi_trx)(u8 *, u8 *, u32);
 		} spi;
 	} u;
-} wilc_wlan_io_func_t;
+};
 
 #define WILC_MAC_INDICATE_STATUS	0x1
 #define WILC_MAC_STATUS_INIT		-1
@@ -98,15 +98,6 @@ typedef struct {
 
 #define WILC_MAC_INDICATE_SCAN		0x2
 
-typedef struct {
-	void *os_private;
-} wilc_wlan_os_context_t;
-
-typedef struct {
-	wilc_wlan_os_context_t os_context;
-	wilc_wlan_io_func_t io_func;
-} wilc_wlan_inp_t;
-
 struct tx_complete_data {
 	int size;
 	void *buff;
@@ -937,7 +928,8 @@ typedef enum {
 	WID_MAX				= 0xFFFF
 } WID_T;
 
-int wilc_wlan_init(wilc_wlan_inp_t *inp);
+struct wilc;
+int wilc_wlan_init(struct wilc *inp);
 
 void wilc_bus_set_max_speed(void);
 void wilc_bus_set_default_speed(void);
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252321 — [PATCH 10/19] staging/wilc1000: unify device pointer

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 10/19] staging/wilc1000: unify device pointer
Message-ID<qlO2S-10k-7@gated-at.bofh.it>
In reply to#1252310
struct wilc has two pointers to store the device, one for sdio_func
and one for spi_device. By changing the pointer to a 'struct device',
we can simplify the logic and avoid a few #ifdefs.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/linux_wlan.c         | 29 +++++----------------------
 drivers/staging/wilc1000/linux_wlan_sdio.c    |  5 +++--
 drivers/staging/wilc1000/linux_wlan_spi.c     | 17 +++++++++++++++-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  6 +-----
 4 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index caa85442c12d..4ca045bcf537 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -474,19 +474,11 @@ int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic)
 	/*	the firmare should be located in /lib/firmware in
 	 *      root file system with the name specified above */
 
-#ifdef WILC_SDIO
-	if (request_firmware(&wilc_firmware, firmware, &wilc1000_dev->wilc_sdio_func->dev) != 0) {
+	if (request_firmware(&wilc_firmware, firmware, wilc1000_dev->dev) != 0) {
 		PRINT_ER("%s - firmare not available\n", firmware);
 		ret = -1;
 		goto _fail_;
 	}
-#else
-	if (request_firmware(&wilc_firmware, firmware, &wilc1000_dev->wilc_spidev->dev) != 0) {
-		PRINT_ER("%s - firmare not available\n", firmware);
-		ret = -1;
-		goto _fail_;
-	}
-#endif
 	wilc1000_dev->wilc_firmware = wilc_firmware;
 
 _fail_:
@@ -1008,7 +1000,7 @@ static u8 wilc1000_prepare_11b_core(struct wilc *nic)
 		while (!wilc1000_probe)
 			msleep(100);
 		wilc1000_probe = 0;
-		wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
+		wilc1000_dev->dev = &wilc1000_sdio_func->dev;
 		nic->ops = &wilc1000_sdio_ops;
 		wilc_wlan_init(nic);
 	}
@@ -1031,7 +1023,7 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 	while (!wilc1000_probe)
 		msleep(100);
 	wilc1000_probe = 0;
-	wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
+	wilc1000_dev->dev = &wilc1000_sdio_func->dev;
 	wilc1000_dev->ops = &wilc1000_sdio_ops;
 	ret = wilc_wlan_init(wilc1000_dev);
 
@@ -1214,12 +1206,11 @@ int wilc1000_mac_open(struct net_device *ndev)
 	int i = 0;
 	struct wilc_priv *priv;
 
-#ifdef WILC_SPI
-	if (!wilc1000_dev || !wilc1000_dev->wilc_spidev) {
+	if (!wilc1000_dev || !wilc1000_dev->dev) {
 		netdev_err(ndev, "wilc1000: SPI device not ready\n");
 		return -ENODEV;
 	}
-#endif
+
 	nic = netdev_priv(ndev);
 	priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
 	PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
@@ -1712,16 +1703,6 @@ int wilc_netdev_init(void)
 
 	}
 
-	#ifndef WILC_SDIO
-	if (!wilc1000_spi_init(&wilc1000_dev->wilc_spidev)) {
-		PRINT_ER("Can't initialize SPI\n");
-		return -1; /* ERROR */
-	}
-	wilc1000_dev->wilc_spidev = wilc_spi_dev;
-	#else
-	wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
-	#endif
-
 	return 0;
 }
 
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index badcae57875c..a6ae26739dd8 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -46,7 +46,7 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
 
 int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 {
-	struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
+	struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
 	int ret;
 	u8 data;
 
@@ -78,7 +78,7 @@ int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 
 int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
 {
-	struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
+	struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
 	int size, ret;
 
 	sdio_claim_host(func);
@@ -126,6 +126,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 		PRINT_ER("Couldn't initialize netdev\n");
 		return -1;
 	}
+	wilc1000_dev->dev = &wilc1000_sdio_func->dev;
 
 	printk("Driver Initializing success\n");
 	return 0;
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index c90b741824dc..b5e9a1b9f509 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -9,8 +9,11 @@
 #include <linux/device.h>
 #include <linux/spi/spi.h>
 
+#include "wilc_wfi_netdevice.h"
 #include "linux_wlan_common.h"
 #include "linux_wlan_spi.h"
+#include "wilc_wlan_if.h"
+#include "wilc_wlan.h"
 
 #define USE_SPI_DMA     0       /* johnny add */
 
@@ -409,8 +412,20 @@ int wilc1000_spi_set_max_speed(void)
 
 static int __init init_wilc_spi_driver(void)
 {
+	int ret;
+
 	wilc1000_init_driver();
-	return wilc_netdev_init();
+	ret = wilc_netdev_init();
+	if (ret)
+		return ret;
+
+	if (!wilc1000_spi_init(NULL)) {
+		PRINT_ER("Can't initialize SPI\n");
+		return -ENXIO;
+	}
+	wilc1000_dev->dev = &wilc_spi_dev->dev;
+
+	return ret;
 }
 late_initcall(init_wilc_spi_driver);
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 485df4768e78..1e5e7dcee11d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -185,11 +185,7 @@ struct wilc {
 
 	const struct firmware *wilc_firmware;
 
-#ifdef WILC_SDIO
-	struct sdio_func *wilc_sdio_func;
-#else
-	struct spi_device *wilc_spidev;
-#endif
+	struct device *dev;
 };
 
 typedef struct {
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252322 — [PATCH 04/19] staging/wilc1000: move extern declarations to headers

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 04/19] staging/wilc1000: move extern declarations to headers
Message-ID<qlO2S-10k-9@gated-at.bofh.it>
In reply to#1252310
'extern' declarations belong into a header file rather than
a .c file, to ensure that the definition matches the declaration.

This moves all declarations into a header file that seems
most appropriate for it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/host_interface.c         | 10 +-------
 drivers/staging/wilc1000/host_interface.h         | 10 ++++++++
 drivers/staging/wilc1000/linux_mon.c              |  3 ---
 drivers/staging/wilc1000/linux_wlan.c             | 16 -------------
 drivers/staging/wilc1000/linux_wlan_sdio.c        |  3 ---
 drivers/staging/wilc1000/linux_wlan_spi.c         |  1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 +-----------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 -
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  4 ++++
 drivers/staging/wilc1000/wilc_wlan.c              |  9 +------
 drivers/staging/wilc1000/wilc_wlan.h              | 29 ++++++++++++++++++++++-
 11 files changed, 45 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index c8c5f5c602c7..99c78d395653 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4,16 +4,11 @@
 #include <linux/delay.h>
 #include "host_interface.h"
 #include "coreconfigurator.h"
+#include "wilc_wlan.h"
 #include "wilc_wlan_if.h"
 #include "wilc_msgqueue.h"
 #include <linux/etherdevice.h>
 
-extern u8 wilc1000_connecting;
-
-extern struct timer_list wilc1000_during_ip_timer;
-
-extern u8 wilc1000_initialized;
-
 #define HOST_IF_MSG_SCAN                        0
 #define HOST_IF_MSG_CONNECT                     1
 #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO        2
@@ -268,9 +263,6 @@ static struct host_if_drv *join_req_drv;
 
 static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
 
-extern void wilc1000_chip_sleep_manually(u32 u32SleepTime);
-extern int wilc1000_wlan_get_num_conn_ifcs(void);
-
 static int add_handler_in_list(struct host_if_drv *handler)
 {
 	int i;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 826ed0f30615..1f537ed9d7f3 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -925,4 +925,14 @@ void wilc1000_free_join_params(void *pJoinParams);
 
 s32 wilc1000_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
 
+void wilc1000_resolve_disconnect_aberration(struct host_if_drv *drvHandler);
+
+extern bool wilc1000_optaining_ip;
+extern u8 wilc1000_connected_SSID[6];
+extern u8 wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+
+extern int wilc1000_connecting;
+extern u8 wilc1000_initialized;
+extern struct timer_list wilc1000_during_ip_timer;
+
 #endif
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 52443f039a43..50196c3aa61d 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -26,9 +26,6 @@ struct wilc_wfi_radiotap_cb_hdr {
 
 static struct net_device *wilc_wfi_mon; /* global monitor netdev */
 
-extern int  wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-
-
 static u8 srcAdd[6];
 static u8 bssid[6];
 static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index be4b1b1199f8..50477d70eb24 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -45,13 +45,6 @@
  #define _linux_wlan_device_removal()		{}
 #endif
 
-extern bool wilc1000_optaining_ip;
-extern u16 wilc1000_set_machw_change_vir_if(bool bValue);
-extern void wilc1000_resolve_disconnect_aberration(void *drvHandler);
-extern u8 wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-void wilc1000_wlan_deinit(struct wilc *nic);
-extern struct timer_list wilc1000_during_ip_timer;
-
 static int linux_wlan_device_power(int on_off)
 {
 	PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
@@ -98,14 +91,9 @@ static struct semaphore close_exit_sync;
 
 static int wlan_deinit_locks(struct wilc *nic);
 static void wlan_deinitialize_threads(struct wilc *nic);
-extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
-extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
 
 static void linux_wlan_tx_complete(void *priv, int status);
 static int  mac_init_fn(struct net_device *ndev);
-int  wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int  wilc1000_mac_open(struct net_device *ndev);
-int  wilc1000_mac_close(struct net_device *ndev);
 static struct net_device_stats *mac_stats(struct net_device *dev);
 static int  mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd);
 static void wilc_set_multicast_list(struct net_device *dev);
@@ -1047,11 +1035,7 @@ static void wlan_deinitialize_threads(struct wilc *nic)
 
 #ifdef COMPLEMENT_BOOT
 
-extern volatile int wilc1000_probe;
-extern u8 wilc1000_core_11b_ready(void);
-
 #define READY_CHECK_THRESHOLD		30
-extern void wilc_wlan_global_reset(void);
 static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 {
 	u8 trials = 0;
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 470f4bf372f1..4e8c4e6d499e 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -23,9 +23,6 @@
 
 
 struct sdio_func *wilc1000_sdio_func;
-extern int wilc_netdev_init(void);
-extern void wilc_handle_isr(void);
-
 static unsigned int sdio_default_speed;
 
 #define SDIO_VENDOR_ID_WILC 0x0296
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 8d8310681658..43cfeda97030 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -42,7 +42,6 @@
 static u32 SPEED = MIN_SPEED;
 
 struct spi_device *wilc_spi_dev;
-void wilc1000_spi_deinit(void *vp);
 
 static int __init wilc_bus_probe(struct spi_device *spi)
 {
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 672741632f85..0ed05aafa5bf 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -14,6 +14,7 @@
 #ifdef WILC_SDIO
 #include "linux_wlan_sdio.h"
 #endif
+#include "host_interface.h"
 #include <linux/errno.h>
 
 #define IS_MANAGMEMENT				0x100
@@ -21,21 +22,13 @@
 #define IS_MGMT_STATUS_SUCCES			0x040
 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
-extern int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic);
-extern u16 wilc1000_set_machw_change_vir_if(bool bValue);
-
-extern int wilc1000_mac_open(struct net_device *ndev);
-extern int wilc1000_mac_close(struct net_device *ndev);
-
 static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 static u32 u32LastScannedNtwrksCountShadow;
 struct timer_list wilc1000_during_ip_timer;
 static struct timer_list hAgingTimer;
 static u8 op_ifcs;
-extern u8 wilc1000_connected_SSID[6];
 
 u8 wilc1000_initialized = 1;
-extern bool wilc1000_optaining_ip;
 
 #define CHAN2G(_channel, _freq, _flags) {	 \
 		.band             = IEEE80211_BAND_2GHZ, \
@@ -473,8 +466,6 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet
 }
 
 
-int wilc1000_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
-
 
 /**
  *  @brief      CfgConnectResult
@@ -2156,7 +2147,6 @@ static void WILC_WFI_add_wilcvendorspec(u8 *buff)
  *  @date	01 JUL 2012
  *  @version
  */
-extern bool wilc1000_enable_ps;
 static int mgmt_tx(struct wiphy *wiphy,
 		   struct wireless_dev *wdev,
 		   struct cfg80211_mgmt_tx_params *params,
@@ -2488,9 +2478,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
  *  @date	01 MAR 2012
  *  @version	1.0
  */
-void wilc1000_wlan_deinit(struct wilc *nic);
-int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
-
 static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 			       enum nl80211_iftype type, u32 *flags, struct vif_params *params)
 {
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index a87982cfcd4b..ae2aaea508db 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -103,6 +103,5 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 
 #define TCP_ACK_FILTER_LINK_SPEED_THRESH	54
 #define DEFAULT_LINK_SPEED			72
-void wilc1000_enable_tcp_ack_filter(bool value);
 
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 700f6f343b52..28610d889c0c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -206,6 +206,10 @@ struct WILC_WFI_mon_priv {
 	struct net_device *real_ndev;
 };
 
+int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic);
+void wilc1000_wlan_deinit(struct wilc *nic);
+int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
+
 extern struct wilc *wilc1000_dev;
 extern struct net_device *WILC_WFI_devs[];
 void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 140778d8aab5..a147547fb66e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -8,6 +8,7 @@
 /* //////////////////////////////////////////////////////////////////////////// */
 
 #include "wilc_wlan_if.h"
+#include "wilc_wlan.h"
 #include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_cfg.h"
 
@@ -16,14 +17,6 @@
  *      Global
  *
  ********************************************/
-extern wilc_hif_func_t wilc1000_hif_sdio;
-extern wilc_hif_func_t wilc1000_hif_spi;
-extern void WILC_WFI_mgmt_rx(u8 *buff, u32 size);
-u32 wilc_get_chipid(u8 update);
-u16 wilc1000_set_machw_change_vir_if(bool bValue);
-
-
-
 typedef struct {
 	int quit;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index bd89689fbf10..64295a664ea9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -1,7 +1,7 @@
 #ifndef WILC_WLAN_H
 #define WILC_WLAN_H
 
-
+#include <linux/types.h>
 
 #define ISWILC1000(id)   (((id & 0xfffff000) == 0x100000) ? 1 : 0)
 
@@ -270,6 +270,9 @@ typedef struct {
 	void (*hif_set_default_bus_speed)(void);
 } wilc_hif_func_t;
 
+extern wilc_hif_func_t wilc1000_hif_spi;
+extern wilc_hif_func_t wilc1000_hif_sdio;
+
 /********************************************
  *
  *      Configuration Structure
@@ -309,4 +312,28 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler);
 int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
 int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size,
 			       wilc_tx_complete_func_t func);
+extern void wilc_wlan_global_reset(void);
+
+void wilc1000_enable_tcp_ack_filter(bool value);
+void wilc1000_chip_sleep_manually(u32 u32SleepTime);
+int wilc1000_wlan_get_num_conn_ifcs(void);
+int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
+int wilc_netdev_init(void);
+void wilc_handle_isr(void);
+
+u16 wilc1000_set_machw_change_vir_if(bool bValue);
+
+int wilc1000_mac_open(struct net_device *ndev);
+int wilc1000_mac_close(struct net_device *ndev);
+
+void WILC_WFI_mgmt_rx(u8 *buff, u32 size);
+
+int wilc1000_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
+void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
+u8 wilc1000_core_11b_ready(void);
+
+extern bool wilc1000_enable_ps;
+extern volatile int wilc1000_probe;
+
+
 #endif
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252323 — [PATCH 05/19] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 05/19] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT
Message-ID<qlO2S-10k-11@gated-at.bofh.it>
In reply to#1252310
The linux_wlan.c file uses a set of enums from wilc_wlan_if.h,
with the exception of the NO_ENCRYPT that comes from
wilc_wfi_cfgoperations.h. The two sets of enums clearly have
the same intention but are defined a bit different.

To prepare to clean up the ones in wilc_wfi_cfgoperations.h, this
first changes over the only other user.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 50477d70eb24..d3cc255cd91b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -701,7 +701,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
 	if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
 		goto _fail_;
 
-	c_val[0] = NO_ENCRYPT; /* NO_ENCRYPT, 0x79 */
+	c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
 	if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
 		goto _fail_;
 
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252324 — [PATCH 16/19] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 16/19] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
Message-ID<qlO2S-10k-13@gated-at.bofh.it>
In reply to#1252310
The last remaining user of WILC_SDIO macro checks for the correct
time to wait in an interrupt for the PLL to settle. We can
replace this with a runtime check and remove both WILC_SDIO and
WILC_SPI, as we no longer need conditional compilation based on
the hardware type.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/Makefile    | 3 +--
 drivers/staging/wilc1000/wilc_wlan.c | 5 ++++-
 drivers/staging/wilc1000/wilc_wlan.h | 7 ++-----
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index b96fee8f94f2..9ce30e92ea3a 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,7 +1,6 @@
 obj-$(CONFIG_WILC1000) += wilc1000.o
 
-ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI
+ccflags-$(CONFIG_WILC1000_SDIO) += -DCOMPLEMENT_BOOT
 
 ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
 		-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index d12a4e7df32c..038c9b2eee6c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1238,7 +1238,10 @@ static void wilc_pllupdate_isr_ext(u32 int_stats)
 	g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR);
 
 	/* Waiting for PLL */
-	mdelay(WILC_PLL_TO);
+	if (g_wlan.io_func->io_type == HIF_SDIO)
+		mdelay(WILC_PLL_TO_SDIO);
+	else
+		mdelay(WILC_PLL_TO_SPI);
 
 	/* poll till read a valid data */
 	while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) {
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 2e9b5d50ff7e..2f636534fc5d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -143,11 +143,8 @@
 #define WILC_CFG_RSP_STATUS 2
 #define WILC_CFG_RSP_SCAN 3
 
-#ifdef WILC_SDIO
-#define WILC_PLL_TO	4
-#else
-#define WILC_PLL_TO	2
-#endif
+#define WILC_PLL_TO_SDIO	4
+#define WILC_PLL_TO_SPI		2
 
 
 #define ABORT_INT   BIT(31)
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252326 — [PATCH 14/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 14/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
Message-ID<qlO2S-10k-1@gated-at.bofh.it>
In reply to#1252310
Whether the SDIO function uses an internal or external interrupt
should not be a compiletime decision but be determined at runtime.

This changes the code to pass a GPIO number from the init code
as early as possible, and leaves just one #ifdef WILC_SDIO_IRQ_GPIO
to preserve the previous behavior.

All other locations that check for the interrupt method are turned
into runtime checks based on the gpio number (>=0) or the interrupt
number (>0).

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/Makefile             |   1 -
 drivers/staging/wilc1000/linux_wlan.c         |  66 +++++++---------
 drivers/staging/wilc1000/linux_wlan_sdio.c    |  26 ++++---
 drivers/staging/wilc1000/linux_wlan_spi.c     |   2 +-
 drivers/staging/wilc1000/wilc_sdio.c          | 105 +++++++++++---------------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   5 +-
 drivers/staging/wilc1000/wilc_wlan.c          |   8 +-
 drivers/staging/wilc1000/wilc_wlan.h          |   2 +-
 8 files changed, 94 insertions(+), 121 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 55b2ac2b15a8..b96fee8f94f2 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,7 +1,6 @@
 obj-$(CONFIG_WILC1000) += wilc1000.o
 
 ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_HW_OOB_INTR) += -DWILC_SDIO_IRQ_GPIO
 ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI
 
 ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 980c2c8d300d..beafc543aac3 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -170,7 +170,6 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
 
 }
 
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
 	PRINT_D(INT_DBG, "Interrupt received UH\n");
@@ -208,16 +207,16 @@ static int init_irq(struct wilc *p_nic)
 
 	/*initialize GPIO and register IRQ num*/
 	/*GPIO request*/
-	if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) &&
-	    (gpio_direction_input(GPIO_NUM) == 0)) {
+	if ((gpio_request(nic->gpio, "WILC_INTR") == 0) &&
+	    (gpio_direction_input(nic->gpio) == 0)) {
 #if defined(CUSTOMER_PLATFORM)
 /*
  TODO : save the registerd irq number to the private wilc context in kernel.
  *
- * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+ * ex) nic->dev_irq_num = gpio_to_irq(nic->gpio);
  */
 #else
-		nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+		nic->dev_irq_num = gpio_to_irq(nic->gpio);
 #endif
 	} else {
 		ret = -1;
@@ -228,28 +227,25 @@ static int init_irq(struct wilc *p_nic)
 						  IRQF_TRIGGER_LOW | IRQF_ONESHOT,               /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/
 						  "WILC_IRQ", nic)) < 0) {
 
-		PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
+		PRINT_ER("Failed to request IRQ for GPIO: %d\n", nic->gpio);
 		ret = -1;
 	} else {
 
 		PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n",
-			nic->dev_irq_num, GPIO_NUM);
+			nic->dev_irq_num, nic->gpio);
 	}
 
 	return ret;
 }
-#endif
 
 static void deinit_irq(struct wilc *nic)
 {
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
 	/* Deintialize IRQ */
-	if (&nic->dev_irq_num != 0) {
+	if (nic->gpio >= 0 && &nic->dev_irq_num != 0) {
 		free_irq(nic->dev_irq_num, wilc1000_dev);
 
-		gpio_free(GPIO_NUM);
+		gpio_free(nic->gpio);
 	}
-#endif
 }
 
 /*
@@ -830,11 +826,11 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 #endif
 
 		PRINT_D(INIT_DBG, "Disabling IRQ\n");
-#ifdef WILC_SDIO
-		mutex_lock(&wilc1000_dev->hif_cs);
-		wilc1000_sdio_disable_interrupt();
-		mutex_unlock(&wilc1000_dev->hif_cs);
-#endif
+		if (wilc1000_dev->gpio < 0) {
+			mutex_lock(&wilc1000_dev->hif_cs);
+			wilc1000_sdio_disable_interrupt();
+			mutex_unlock(&wilc1000_dev->hif_cs);
+		}
 		if (&wilc1000_dev->txq_event != NULL)
 			up(&wilc1000_dev->txq_event);
 
@@ -848,14 +844,13 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 
 		PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
 		wilc_wlan_cleanup();
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-  #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
-		PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
-
-		mutex_lock(&wilc1000_dev->hif_cs);
-		wilc1000_sdio_disable_interrupt();
-		mutex_unlock(&wilc1000_dev->hif_cs);
-  #endif
+#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
+		if (wilc1000_dev->gpio < 0) {
+			PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
+
+			mutex_lock(&wilc1000_dev->hif_cs);
+			wilc1000_sdio_disable_interrupt();
+			mutex_unlock(&wilc1000_dev->hif_cs);
 #endif
 
 		/*De-Initialize locks*/
@@ -982,21 +977,17 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 			goto _fail_threads_;
 		}
 
-#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-		if (init_irq(wilc1000_dev)) {
+		if (wilc1000_dev->gpio >= 0 && init_irq(wilc1000_dev)) {
 			PRINT_ER("couldn't initialize IRQ\n");
 			ret = -EIO;
 			goto _fail_threads_;
 		}
-#endif
 
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-		if (wilc1000_sdio_enable_interrupt()) {
+		if (wilc1000_dev->gpio < 0 && wilc1000_sdio_enable_interrupt()) {
 			PRINT_ER("couldn't initialize IRQ\n");
 			ret = -EIO;
 			goto _fail_irq_init_;
 		}
-#endif
 
 		if (wilc1000_wlan_get_firmware(nic)) {
 			PRINT_ER("Can't get firmware\n");
@@ -1048,14 +1039,12 @@ _fail_fw_start_:
 		wilc_wlan_stop();
 
 _fail_irq_enable_:
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-		wilc1000_sdio_disable_interrupt();
+		if (wilc1000_dev->gpio < 0)
+			wilc1000_sdio_disable_interrupt();
 _fail_irq_init_:
-#endif
-#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-		deinit_irq(wilc1000_dev);
+		if (wilc1000_dev->gpio >= 0)
+			deinit_irq(wilc1000_dev);
 
-#endif
 _fail_threads_:
 		wlan_deinitialize_threads(wilc1000_dev);
 _fail_wilc_wlan_:
@@ -1511,7 +1500,7 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
 		WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, buff, size);
 }
 
-int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
+int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops, int gpio)
 {
 
 	int i;
@@ -1526,6 +1515,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
 		return -ENOMEM;
 
 	wilc1000_dev->ops = ops;
+	wilc1000_dev->gpio = gpio;
 
 	register_inetaddr_notifier(&g_dev_notifier);
 
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index bb4a3acf16d0..64c8c5725277 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -7,6 +7,7 @@
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/host.h>
+#include <linux/of_gpio.h>
 
 
 
@@ -36,15 +37,12 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
 };
 
 
-#ifndef WILC_SDIO_IRQ_GPIO
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
 	sdio_release_host(func);
 	wilc_handle_isr();
 	sdio_claim_host(func);
 }
-#endif
-
 
 static int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 {
@@ -161,9 +159,8 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 	ret = wilc_wlan_init(wilc1000_dev);
 
 	wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
-#if !defined WILC_SDIO_IRQ_GPIO
-	wilc1000_sdio_enable_interrupt();
-#endif
+	if (wilc1000_dev->gpio < 0)
+		wilc1000_sdio_enable_interrupt();
 
 	if (wilc1000_wlan_get_firmware(nic)) {
 		PRINT_ER("Can't get firmware\n");
@@ -188,6 +185,8 @@ __fail__:
 
 static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
 {
+	int gpio;
+
 	PRINT_D(INIT_DBG, "probe function\n");
 
 #ifdef COMPLEMENT_BOOT
@@ -198,9 +197,17 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 		return 0;
 	}
 #endif
+
+	gpio = -1;
+	if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
+		gpio = of_get_gpio(func->dev.of_node, 0);
+		if (gpio < 0)
+			gpio = GPIO_NUM;
+	}
+
 	PRINT_D(INIT_DBG, "Initializing netdev\n");
 	wilc1000_sdio_func = func;
-	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops)) {
+	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops, gpio)) {
 		PRINT_ER("Couldn't initialize netdev\n");
 		return -1;
 	}
@@ -228,7 +235,6 @@ static struct sdio_driver wilc_bus = {
 int wilc1000_sdio_enable_interrupt(void)
 {
 	int ret = 0;
-#ifndef WILC_SDIO_IRQ_GPIO
 
 	sdio_claim_host(wilc1000_sdio_func);
 	ret = sdio_claim_irq(wilc1000_sdio_func, wilc_sdio_interrupt);
@@ -238,14 +244,11 @@ int wilc1000_sdio_enable_interrupt(void)
 		PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
 		ret = -EIO;
 	}
-#endif
 	return ret;
 }
 
 void wilc1000_sdio_disable_interrupt(void)
 {
-
-#ifndef WILC_SDIO_IRQ_GPIO
 	int ret;
 
 	PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt IN\n");
@@ -258,7 +261,6 @@ void wilc1000_sdio_disable_interrupt(void)
 	sdio_release_host(wilc1000_sdio_func);
 
 	PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt OUT\n");
-#endif
 }
 
 static int linux_sdio_set_speed(int speed)
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 788531e314c3..c6ea3ef0664f 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -424,7 +424,7 @@ static int __init init_wilc_spi_driver(void)
 	int ret;
 
 	wilc1000_init_driver();
-	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops);
+	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, GPIO_NUM);
 	if (ret)
 		return ret;
 
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 2d39a5386718..69b7c72b76c5 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -16,6 +16,7 @@
 
 typedef struct {
 	void *os_context;
+	bool irq_gpio;
 	u32 block_size;
 	int (*sdio_cmd52)(sdio_cmd52_t *);
 	int (*sdio_cmd53)(sdio_cmd53_t *);
@@ -29,10 +30,8 @@ typedef struct {
 
 static wilc_sdio_t g_sdio;
 
-#ifdef WILC_SDIO_IRQ_GPIO
 static int sdio_write_reg(u32 addr, u32 data);
 static int sdio_read_reg(u32 addr, u32 *data);
-#endif
 
 /********************************************
  *
@@ -135,29 +134,29 @@ _fail_:
 
 static int sdio_clear_int(void)
 {
-#ifndef WILC_SDIO_IRQ_GPIO
-	/* u32 sts; */
-	sdio_cmd52_t cmd;
+	if (!g_sdio.irq_gpio) {
+		/* u32 sts; */
+		sdio_cmd52_t cmd;
 
-	cmd.read_write = 0;
-	cmd.function = 1;
-	cmd.raw = 0;
-	cmd.address = 0x4;
-	cmd.data = 0;
-	g_sdio.sdio_cmd52(&cmd);
+		cmd.read_write = 0;
+		cmd.function = 1;
+		cmd.raw = 0;
+		cmd.address = 0x4;
+		cmd.data = 0;
+		g_sdio.sdio_cmd52(&cmd);
 
-	return cmd.data;
-#else
-	u32 reg;
+		return cmd.data;
+	} else {
+		u32 reg;
 
-	if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, &reg)) {
-		g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0);
-		return 0;
+		if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, &reg)) {
+			g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0);
+			return 0;
+		}
+		reg &= ~0x1;
+		sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
+		return 1;
 	}
-	reg &= ~0x1;
-	sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
-	return 1;
-#endif
 
 }
 
@@ -459,8 +458,7 @@ static int sdio_sync(void)
 		return 0;
 	}
 
-#ifdef WILC_SDIO_IRQ_GPIO
-	{
+	if (g_sdio.irq_gpio) {
 		u32 reg;
 		int ret;
 
@@ -494,7 +492,6 @@ static int sdio_sync(void)
 			return 0;
 		}
 	}
-#endif
 
 	return 1;
 }
@@ -509,6 +506,7 @@ static int sdio_init(struct wilc *inp, wilc_debug_func func)
 
 	g_sdio.dPrint = func;
 	g_sdio.os_context = inp;
+	g_sdio.irq_gpio = (inp->gpio >= 0);
 
 	if (inp->ops->io_init) {
 		if (!inp->ops->io_init(g_sdio.os_context)) {
@@ -674,36 +672,33 @@ static int sdio_read_int(u32 *int_status)
 	/**
 	 *      Read IRQ flags
 	 **/
-#ifndef WILC_SDIO_IRQ_GPIO
-	cmd.function = 1;
-	cmd.address = 0x04;
-	cmd.data = 0;
-	g_sdio.sdio_cmd52(&cmd);
-
-	if (cmd.data & BIT(0))
-		tmp |= INT_0;
-	if (cmd.data & BIT(2))
-		tmp |= INT_1;
-	if (cmd.data & BIT(3))
-		tmp |= INT_2;
-	if (cmd.data & BIT(4))
-		tmp |= INT_3;
-	if (cmd.data & BIT(5))
-		tmp |= INT_4;
-	if (cmd.data & BIT(6))
-		tmp |= INT_5;
-	{
+	if (!g_sdio.irq_gpio) {
 		int i;
 
+		cmd.function = 1;
+		cmd.address = 0x04;
+		cmd.data = 0;
+		g_sdio.sdio_cmd52(&cmd);
+
+		if (cmd.data & BIT(0))
+			tmp |= INT_0;
+		if (cmd.data & BIT(2))
+			tmp |= INT_1;
+		if (cmd.data & BIT(3))
+			tmp |= INT_2;
+		if (cmd.data & BIT(4))
+			tmp |= INT_3;
+		if (cmd.data & BIT(5))
+			tmp |= INT_4;
+		if (cmd.data & BIT(6))
+			tmp |= INT_5;
 		for (i = g_sdio.nint; i < MAX_NUM_INT; i++) {
 			if ((tmp >> (IRG_FLAGS_OFFSET + i)) & 0x1) {
 				g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt (1) : tmp=%x, data=%x\n", tmp, cmd.data);
 				break;
 			}
 		}
-	}
-#else
-	{
+	} else {
 		u32 irq_flags;
 
 		cmd.read_write = 0;
@@ -716,8 +711,6 @@ static int sdio_read_int(u32 *int_status)
 		tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET);
 	}
 
-#endif
-
 	*int_status = tmp;
 
 	return 1;
@@ -730,16 +723,14 @@ static int sdio_clear_int_ext(u32 val)
 	if (g_sdio.has_thrpt_enh3) {
 		u32 reg;
 
-#ifdef WILC_SDIO_IRQ_GPIO
-		{
+		if (g_sdio.irq_gpio) {
 			u32 flags;
 
 			flags = val & (BIT(MAX_NUN_INT_THRPT_ENH2) - 1);
 			reg = flags;
+		} else {
+			reg = 0;
 		}
-#else
-		reg = 0;
-#endif
 		/* select VMM table 0 */
 		if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0)
 			reg |= BIT(5);
@@ -766,8 +757,7 @@ static int sdio_clear_int_ext(u32 val)
 
 		}
 	} else {
-#ifdef WILC_SDIO_IRQ_GPIO
-		{
+		if (g_sdio.irq_gpio) {
 			/* see below. has_thrpt_enh2 uses register 0xf8 to clear interrupts. */
 			/* Cannot clear multiple interrupts. Must clear each interrupt individually */
 			u32 flags;
@@ -807,7 +797,6 @@ static int sdio_clear_int_ext(u32 val)
 				}
 			}
 		}
-#endif /* WILC_SDIO_IRQ_GPIO */
 
 		{
 			u32 vmm_ctl;
@@ -874,8 +863,7 @@ static int sdio_sync_ext(int nint /*  how mant interrupts to enable. */)
 		return 0;
 	}
 
-#ifdef WILC_SDIO_IRQ_GPIO
-	{
+	if (g_sdio.irq_gpio) {
 		u32 reg;
 		int ret, i;
 
@@ -927,7 +915,6 @@ static int sdio_sync_ext(int nint /*  how mant interrupts to enable. */)
 			}
 		}
 	}
-#endif /* WILC_SDIO_IRQ_GPIO */
 	return 1;
 }
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index ec5a8b1215b7..f1f78f51fea0 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -159,9 +159,8 @@ struct wilc {
 	const struct wilc1000_ops *ops;
 	int mac_status;
 	int wilc1000_initialized;
-	#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-	unsigned short dev_irq_num;
-	#endif
+	int gpio;
+	int dev_irq_num;
 	int close;
 	u8 u8NoIfcs;
 	struct wilc_vif strInterfaceInfo[NUM_CONCURRENT_IFC];
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 7e1b892f721d..d12a4e7df32c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1369,9 +1369,6 @@ void wilc_handle_isr(void)
 		wilc_sleeptimer_isr_ext(int_status);
 
 	if (!(int_status & (ALL_INT_EXT))) {
-#ifdef WILC_SDIO
-		PRINT_D(TX_DBG, ">> UNKNOWN_INTERRUPT - 0x%08x\n", int_status);
-#endif
 		wilc_unknown_isr_ext();
 	}
 	release_bus(RELEASE_ALLOW_SLEEP);
@@ -1481,9 +1478,8 @@ int wilc_wlan_start(void)
 		return ret;
 	}
 	reg = 0;
-#ifdef WILC_SDIO_IRQ_GPIO
-	reg |= WILC_HAVE_SDIO_IRQ_GPIO;
-#endif
+	if (p->io_func->io_type == HIF_SDIO && wilc1000_dev->gpio >= 0)
+		reg |= WILC_HAVE_SDIO_IRQ_GPIO;
 
 #ifdef WILC_DISABLE_PMU
 #else
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 10b2a2f9e1b2..2e9b5d50ff7e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -321,7 +321,7 @@ void wilc1000_enable_tcp_ack_filter(bool value);
 void wilc1000_chip_sleep_manually(u32 u32SleepTime);
 int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops);
+int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops, int gpio);
 void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252327 — [PATCH 01/19] staging/wilc1000: remove unused functions

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 01/19] staging/wilc1000: remove unused functions
Message-ID<qlO2S-10k-3@gated-at.bofh.it>
In reply to#1252310
A number of symbols in the wilc1000 driver are completely unused
and can be removed.
This includes two variables that are only written but not read.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/host_interface.c         | 311 ----------------------
 drivers/staging/wilc1000/host_interface.h         | 208 +--------------
 drivers/staging/wilc1000/wilc_sdio.c              |  56 ----
 drivers/staging/wilc1000/wilc_spi.c               | 225 ----------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  35 ---
 drivers/staging/wilc1000/wilc_wlan.c              |   4 -
 6 files changed, 1 insertion(+), 838 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 38fead44cce0..194ca3d3e920 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3421,36 +3421,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_at
 	return s32Error;
 }
 
-s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv,
-			    u8 *pu8PmkidInfoArray,
-			    u32 u32PmkidInfoLen)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_PMKID_INFO;
-	strWID.type = WID_STR;
-	strWID.size = u32PmkidInfoLen;
-	strWID.val = pu8PmkidInfoArray;
-
-	return 0;
-}
-
-s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
-					 u8 *pu8PassPhrase,
-					 u8 u8Psklength)
-{
-	struct wid strWID;
-
-	if ((u8Psklength > 7) && (u8Psklength < 65)) {
-		strWID.id = (u16)WID_11I_PSK;
-		strWID.type = WID_STR;
-		strWID.val = pu8PassPhrase;
-		strWID.size = u8Psklength;
-	}
-
-	return 0;
-}
-
 s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
 {
 	s32 s32Error = 0;
@@ -3492,19 +3462,6 @@ s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
 
 }
 
-s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
-					 u8 *pu8PassPhrase, u8 u8Psklength)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_11I_PSK;
-	strWID.type = WID_STR;
-	strWID.size = u8Psklength;
-	strWID.val = pu8PassPhrase;
-
-	return 0;
-}
-
 s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
 {
 	struct wid strWID;
@@ -3517,18 +3474,6 @@ s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
 	return 0;
 }
 
-s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_START_SCAN_REQ;
-	strWID.type = WID_CHAR;
-	strWID.val = (s8 *)pu8ScanSource;
-	strWID.size = sizeof(char);
-
-	return 0;
-}
-
 s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
 			  const u8 *pu8ssid, size_t ssidLen,
 			  const u8 *pu8IEs, size_t IEsLen,
@@ -3649,31 +3594,6 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
 	return s32Error;
 }
 
-s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_DISCONNECT;
-	strWID.type = WID_CHAR;
-	strWID.val = (s8 *)&assoc_id;
-	strWID.size = sizeof(char);
-
-	return 0;
-}
-
-s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, u8 *pu8AssocReqInfo,
-					u32 u32AssocReqInfoLen)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_ASSOC_REQ_INFO;
-	strWID.type = WID_STR;
-	strWID.val = pu8AssocReqInfo;
-	strWID.size = u32AssocReqInfoLen;
-
-	return 0;
-}
-
 s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
 					u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen)
 {
@@ -3703,19 +3623,6 @@ s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInf
 	return s32Error;
 }
 
-s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, u8 *pu8RxPowerLevel,
-					u32 u32RxPowerLevelLen)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_RX_POWER_LEVEL;
-	strWID.type = WID_STR;
-	strWID.val = pu8RxPowerLevel;
-	strWID.size = u32RxPowerLevelLen;
-
-	return 0;
-}
-
 int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
 {
 	int result;
@@ -3796,33 +3703,6 @@ int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
 	return result;
 }
 
-s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo)
-{
-	s32 s32Error = 0;
-	struct host_if_msg msg;
-
-	if (!hif_drv) {
-		PRINT_ER("driver is null\n");
-		return -EFAULT;
-	}
-
-	memset(&msg, 0, sizeof(struct host_if_msg));
-
-	msg.id = HOST_IF_MSG_GET_CHNL;
-	msg.drv = hif_drv;
-
-	s32Error = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (s32Error)
-		PRINT_ER("wilc mq send fail\n");
-	down(&hif_drv->hSemGetCHNL);
-
-	*pu8ChNo = ch_no;
-
-	return s32Error;
-
-
-}
-
 s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
 			       const u8 *mac, u32 *pu32InactiveTime)
 {
@@ -3854,36 +3734,6 @@ s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
 	return s32Error;
 }
 
-s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr)
-{
-
-	s32 s32Error = 0;
-	struct wid strWID;
-
-	if (!hif_drv) {
-		PRINT_ER("driver is null\n");
-		return -EFAULT;
-	}
-
-	strWID.id = (u16)WID_MEMORY_ADDRESS;
-	strWID.type = WID_INT;
-	strWID.val = (s8 *)pu32TestMemAddr;
-	strWID.size = sizeof(u32);
-
-	s32Error = send_config_pkt(GET_CFG, &strWID, 1,
-				   get_id_from_handler(hif_drv));
-
-	if (s32Error) {
-		PRINT_ER("Failed to get wid value\n");
-		return -EINVAL;
-	} else {
-		PRINT_D(HOSTINF_DBG, "Successfully got wid value\n");
-
-	}
-
-	return s32Error;
-}
-
 s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
 {
 	s32 s32Error = 0;
@@ -3912,34 +3762,6 @@ s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
 	return s32Error;
 }
 
-s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd)
-{
-	struct host_if_msg msg;
-	s32 s32Error = 0;
-	memset(&msg, 0, sizeof(struct host_if_msg));
-
-	msg.id = HOST_IF_MSG_GET_LINKSPEED;
-	msg.drv = hif_drv;
-
-	s32Error = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (s32Error) {
-		PRINT_ER("Failed to send GET_LINKSPEED to message queue ");
-		return -EFAULT;
-	}
-
-	down(&hif_drv->hSemGetLINKSPEED);
-
-
-	if (ps8lnkspd == NULL) {
-		PRINT_ER("LINKSPEED pointer value is null");
-		return -EFAULT;
-	}
-
-	*ps8lnkspd = link_speed;
-
-	return s32Error;
-}
-
 s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
 {
 	s32 s32Error = 0;
@@ -4038,106 +3860,6 @@ s32 hif_set_cfg(struct host_if_drv *hif_drv,
 
 }
 
-s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value)
-{
-	s32 s32Error = 0;
-
-	down(&hif_drv->gtOsCfgValuesSem);
-
-	if (!hif_drv) {
-		PRINT_ER("hif_drv NULL\n");
-		return -EFAULT;
-	}
-	PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n");
-	switch (u16WID)	{
-
-	case WID_BSS_TYPE:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.bss_type;
-		break;
-
-	case WID_AUTH_TYPE:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.auth_type;
-		break;
-
-	case WID_AUTH_TIMEOUT:
-		*pu16WID_Value = hif_drv->strCfgValues.auth_timeout;
-		break;
-
-	case WID_POWER_MANAGEMENT:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.power_mgmt_mode;
-		break;
-
-	case WID_SHORT_RETRY_LIMIT:
-		*pu16WID_Value =       hif_drv->strCfgValues.short_retry_limit;
-		break;
-
-	case WID_LONG_RETRY_LIMIT:
-		*pu16WID_Value = hif_drv->strCfgValues.long_retry_limit;
-		break;
-
-	case WID_FRAG_THRESHOLD:
-		*pu16WID_Value = hif_drv->strCfgValues.frag_threshold;
-		break;
-
-	case WID_RTS_THRESHOLD:
-		*pu16WID_Value = hif_drv->strCfgValues.rts_threshold;
-		break;
-
-	case WID_PREAMBLE:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.preamble_type;
-		break;
-
-	case WID_SHORT_SLOT_ALLOWED:
-		*pu16WID_Value = (u16) hif_drv->strCfgValues.short_slot_allowed;
-		break;
-
-	case WID_11N_TXOP_PROT_DISABLE:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.txop_prot_disabled;
-		break;
-
-	case WID_BEACON_INTERVAL:
-		*pu16WID_Value = hif_drv->strCfgValues.beacon_interval;
-		break;
-
-	case WID_DTIM_PERIOD:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.dtim_period;
-		break;
-
-	case WID_SITE_SURVEY:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.site_survey_enabled;
-		break;
-
-	case WID_SITE_SURVEY_SCAN_TIME:
-		*pu16WID_Value = hif_drv->strCfgValues.site_survey_scan_time;
-		break;
-
-	case WID_ACTIVE_SCAN_TIME:
-		*pu16WID_Value = hif_drv->strCfgValues.active_scan_time;
-		break;
-
-	case WID_PASSIVE_SCAN_TIME:
-		*pu16WID_Value = hif_drv->strCfgValues.passive_scan_time;
-		break;
-
-	case WID_CURRENT_TX_RATE:
-		*pu16WID_Value = hif_drv->strCfgValues.curr_tx_rate;
-		break;
-
-	default:
-		break;
-	}
-
-	up(&hif_drv->gtOsCfgValuesSem);
-
-	return s32Error;
-
-}
-
-void host_int_send_join_leave_info_to_host
-	(u16 assocId, u8 *stationAddr, bool joining)
-{
-}
-
 static void GetPeriodicRSSI(unsigned long arg)
 {
 	struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
@@ -4167,11 +3889,6 @@ static void GetPeriodicRSSI(unsigned long arg)
 }
 
 
-void host_int_send_network_info_to_host
-	(u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi)
-{
-}
-
 static u32 clients_count;
 
 s32 host_int_init(struct host_if_drv **hif_drv_handler)
@@ -5018,34 +4735,6 @@ void host_int_freeJoinParams(void *pJoinParams)
 		PRINT_ER("Unable to FREE null pointer\n");
 }
 
-s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID)
-{
-	s32 s32Error = 0;
-	struct host_if_msg msg;
-	struct ba_session_info *pBASessionInfo = &msg.body.session_info;
-
-	if (!hif_drv) {
-		PRINT_ER("driver is null\n");
-		return -EFAULT;
-	}
-
-	memset(&msg, 0, sizeof(struct host_if_msg));
-
-	msg.id = HOST_IF_MSG_DEL_BA_SESSION;
-
-	memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN);
-	pBASessionInfo->u8Ted = TID;
-	msg.drv = hif_drv;
-
-	s32Error = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (s32Error)
-		PRINT_ER("wilc_mq_send fail\n");
-
-	down(&hif_sema_wait_response);
-
-	return s32Error;
-}
-
 s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv,
 				  char *pBSSID,
 				  char TID)
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 146a60f52cb7..3df74f1bf9ff 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -517,65 +517,6 @@ s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk,
 
 s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray);
 /**
- *  @brief              gets the cached the pmkid info
- *  @details    valid only in BSS STA mode if External Supplicant
- *                              support is enabled. This Function sets the PMKID in firmware
- *                              when host drivr receives the corresponding request from NDIS.
- *                              The firmware then includes theset PMKID in the appropriate
- *                              management frames
- *  @param[in,out] handle to the wifi driver,
- *
- *                                message containing PMKID Info in the following format
- *|-----------------------------------------------------------------|
- *|NumEntries |	BSSID[1] | PMKID[1] |  ...	| BSSID[K] | PMKID[K] |
- *|-----------|------------|----------|-------|----------|----------|
- |	   1	|		6	 |   16		|  ...	|	 6	   |	16	  |
- ||-----------------------------------------------------------------|
- *  @param[in]
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-
-s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray,
-				    u32 u32PmkidInfoLen);
-
-/**
- *  @brief              sets the pass phrase
- *  @details    AP/STA mode. This function gives the pass phrase used to
- *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
- *                              The length of the field can vary from 8 to 64 bytes,
- *                              the lower layer should get the
- *  @param[in,out] handle to the wifi driver,
- *  @param[in]   String containing PSK
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase,
-						 u8 u8Psklength);
-/**
- *  @brief              gets the pass phrase
- *  @details    AP/STA mode. This function gets the pass phrase used to
- *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
- *                              The length of the field can vary from 8 to 64 bytes,
- *                              the lower layer should get the
- *  @param[in,out] handle to the wifi driver,
- *                                String containing PSK
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv,
-						 u8 *pu8PassPhrase, u8 u8Psklength);
-
-/**
  *  @brief              gets mac address
  *  @details
  *  @param[in,out] handle to the wifi driver,
@@ -631,22 +572,6 @@ int host_int_wait_msg_queue_idle(void);
  */
 
 s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
-/**
- *  @brief              gets scan source of the last scan
- *  @details
- *  @param[in,out] handle to the wifi driver,
- *                              Scan Source one of the following values
- *                              DEFAULT_SCAN        0
- *                              USER_SCAN           BIT0
- *                              OBSS_PERIODIC_SCAN  BIT1
- *                              OBSS_ONETIME_SCAN   BIT2
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource);
 
 /**
  *  @brief              sets a join request
@@ -697,46 +622,6 @@ s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
 s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
 
 /**
- *  @brief              disconnects a sta
- *  @details
- *  @param[in,out] handle to the wifi driver,
- *  @param[in]	Association Id of the station to be disconnected
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-s32 host_int_disconnect_station(struct host_if_drv *hWFIDrv, u8 assoc_id);
-/**
- *  @brief              gets a Association request info
- *  @details
- *  @param[in,out] handle to the wifi driver,
- *                              Message containg assoc. req info in the following format
- * ------------------------------------------------------------------------
- |                        Management Frame Format                    |
- ||-------------------------------------------------------------------|
- ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS |
- ||-------------|--------|--|--|-----|----------------|----------|----|
- | 2           |2       |6 |6 |6    |		2       |0 - 2312  | 4  |
- ||-------------------------------------------------------------------|
- |                                                                   |
- |             Association Request Frame - Frame Body                |
- ||-------------------------------------------------------------------|
- | Capability Information | Listen Interval | SSID | Supported Rates |
- ||------------------------|-----------------|------|-----------------|
- |			2            |		 2         | 2-34 |		3-10        |
- | ---------------------------------------------------------------------
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-
-s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo,
-					u32 u32AssocReqInfoLen);
-/**
  *  @brief              gets a Association Response info
  *  @details
  *  @param[in,out] handle to the wifi driver,
@@ -750,23 +635,6 @@ s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo
 
 s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo,
 					u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
-/**
- *  @brief              gets a Association Response info
- *  @details    Valid only in STA mode. This function gives the RSSI
- *                              values observed in all the channels at the time of scanning.
- *                              The length of the field is 1 greater that the total number of
- *                              channels supported. Byte 0 contains the number of channels while
- *                              each of Byte N contains	the observed RSSI value for the channel index N.
- *  @param[in,out] handle to the wifi driver,
- *                              array of scanned channels' RSSI
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, u8 *pu8RxPowerLevel,
-					u32 u32RxPowerLevelLen);
 
 /**
  *  @brief              sets a channel
@@ -786,22 +654,6 @@ s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, u8 *pu8RxPowerLevel
 int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
 
 /**
- *  @brief              gets the current channel index
- *  @details
- *  @param[in,out] handle to the wifi driver,
- *                              current channel index
- *|-----------------------------------------------------------------------|
- |          CHANNEL1      CHANNEL2 ....                     CHANNEL14	|
- |  Input:         1             2                                 14	|
- ||-----------------------------------------------------------------------|
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo);
-/**
  *  @brief              gets the sta rssi
  *  @details    gets the currently maintained RSSI value for the station.
  *                              The received signal strength value in dB.
@@ -815,7 +667,7 @@ s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo);
  *  @version		1.0
  */
 s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
-s32 host_int_get_link_speed(struct host_if_drv *hWFIDrv, s8 *ps8lnkspd);
+
 /**
  *  @brief              scans a set of channels
  *  @details
@@ -852,55 +704,9 @@ s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
  */
 s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal);
 
-/**
- *  @brief              gets configuration wids values
- *  @details
- *  @param[in,out] handle to the wifi driver,
- *                              WID value
- *  @param[in]	WID,
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
 /*****************************************************************************/
 /*							Notification Functions							 */
 /*****************************************************************************/
-/**
- *  @brief              notifies host with join and leave requests
- *  @details    This function prepares an Information frame having the
- *                              information about a joining/leaving station.
- *  @param[in,out] handle to the wifi driver,
- *  @param[in]	6 byte Sta Adress
- *                              Join or leave flag:
- *                              Join = 1,
- *                              Leave =0
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-void host_int_send_join_leave_info_to_host
-	(u16 assocId, u8 *stationAddr, bool joining);
-
-/**
- *  @brief              notifies host with stations found in scan
- *  @details    sends the beacon/probe response from scan
- *  @param[in,out] handle to the wifi driver,
- *  @param[in]	Sta Address,
- *                              Frame length,
- *                              Rssi of the Station found
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-void host_int_send_network_info_to_host
-	(u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi);
 
 /**
  *  @brief              host interface initialization function
@@ -1070,18 +876,6 @@ s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled
  */
 s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
 
-
-/**
- *  @brief           host_int_delBASession
- *  @details       Delete single Rx BA session
- *  @param[in]
- *  @return         Error code.
- *  @author		Abdelrahman Sobhy
- *  @date
- *  @version	1.0
- */
-s32 host_int_delBASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
-
 /**
  *  @brief           host_int_delBASession
  *  @details       Delete all Rx BA session
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 300c571e4e2d..4425b5f369e0 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -160,67 +160,11 @@ static int sdio_clear_int(void)
 
 }
 
-u32 sdio_xfer_cnt(void)
-{
-	u32 cnt = 0;
-	sdio_cmd52_t cmd;
-
-	cmd.read_write = 0;
-	cmd.function = 1;
-	cmd.raw = 0;
-	cmd.address = 0x1C;
-	cmd.data = 0;
-	g_sdio.sdio_cmd52(&cmd);
-	cnt = cmd.data;
-
-	cmd.read_write = 0;
-	cmd.function = 1;
-	cmd.raw = 0;
-	cmd.address = 0x1D;
-	cmd.data = 0;
-	g_sdio.sdio_cmd52(&cmd);
-	cnt |= (cmd.data << 8);
-
-	cmd.read_write = 0;
-	cmd.function = 1;
-	cmd.raw = 0;
-	cmd.address = 0x1E;
-	cmd.data = 0;
-	g_sdio.sdio_cmd52(&cmd);
-	cnt |= (cmd.data << 16);
-
-	return cnt;
-}
-
 /********************************************
  *
  *      Sdio interfaces
  *
  ********************************************/
-int sdio_check_bs(void)
-{
-	sdio_cmd52_t cmd;
-
-	/**
-	 *      poll until BS is 0
-	 **/
-	cmd.read_write = 0;
-	cmd.function = 0;
-	cmd.raw = 0;
-	cmd.address = 0xc;
-	cmd.data = 0;
-	if (!g_sdio.sdio_cmd52(&cmd)) {
-		g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get BS register...\n");
-		goto _fail_;
-	}
-
-	return 1;
-
-_fail_:
-
-	return 0;
-}
-
 static int sdio_write_reg(u32 addr, u32 data)
 {
 #ifdef BIG_ENDIAN
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 599508beabf8..732c3f8c7f32 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -111,163 +111,6 @@ static u8 crc7(u8 crc, const u8 *buffer, u32 len)
 #define DATA_PKT_SZ_8K				(8 * 1024)
 #define DATA_PKT_SZ					DATA_PKT_SZ_8K
 
-static int spi_cmd(u8 cmd, u32 adr, u32 data, u32 sz, u8 clockless)
-{
-	u8 bc[9];
-	int len = 5;
-	int result = N_OK;
-
-	bc[0] = cmd;
-	switch (cmd) {
-	case CMD_SINGLE_READ:                           /* single word (4 bytes) read */
-		bc[1] = (u8)(adr >> 16);
-		bc[2] = (u8)(adr >> 8);
-		bc[3] = (u8)adr;
-		len = 5;
-		break;
-
-	case CMD_INTERNAL_READ:                 /* internal register read */
-		bc[1] = (u8)(adr >> 8);
-		if (clockless)
-			bc[1] |= BIT(7);
-		bc[2] = (u8)adr;
-		bc[3] = 0x00;
-		len = 5;
-		break;
-
-	case CMD_TERMINATE:                                     /* termination */
-		bc[1] = 0x00;
-		bc[2] = 0x00;
-		bc[3] = 0x00;
-		len = 5;
-		break;
-
-	case CMD_REPEAT:                                                /* repeat */
-		bc[1] = 0x00;
-		bc[2] = 0x00;
-		bc[3] = 0x00;
-		len = 5;
-		break;
-
-	case CMD_RESET:                                                 /* reset */
-		bc[1] = 0xff;
-		bc[2] = 0xff;
-		bc[3] = 0xff;
-		len = 5;
-		break;
-
-	case CMD_DMA_WRITE:                                     /* dma write */
-	case CMD_DMA_READ:                                      /* dma read */
-		bc[1] = (u8)(adr >> 16);
-		bc[2] = (u8)(adr >> 8);
-		bc[3] = (u8)adr;
-		bc[4] = (u8)(sz >> 8);
-		bc[5] = (u8)(sz);
-		len = 7;
-		break;
-
-	case CMD_DMA_EXT_WRITE:         /* dma extended write */
-	case CMD_DMA_EXT_READ:                  /* dma extended read */
-		bc[1] = (u8)(adr >> 16);
-		bc[2] = (u8)(adr >> 8);
-		bc[3] = (u8)adr;
-		bc[4] = (u8)(sz >> 16);
-		bc[5] = (u8)(sz >> 8);
-		bc[6] = (u8)(sz);
-		len = 8;
-		break;
-
-	case CMD_INTERNAL_WRITE:                /* internal register write */
-		bc[1] = (u8)(adr >> 8);
-		if (clockless)
-			bc[1] |= BIT(7);
-		bc[2] = (u8)(adr);
-		bc[3] = (u8)(data >> 24);
-		bc[4] = (u8)(data >> 16);
-		bc[5] = (u8)(data >> 8);
-		bc[6] = (u8)(data);
-		len = 8;
-		break;
-
-	case CMD_SINGLE_WRITE:                  /* single word write */
-		bc[1] = (u8)(adr >> 16);
-		bc[2] = (u8)(adr >> 8);
-		bc[3] = (u8)(adr);
-		bc[4] = (u8)(data >> 24);
-		bc[5] = (u8)(data >> 16);
-		bc[6] = (u8)(data >> 8);
-		bc[7] = (u8)(data);
-		len = 9;
-		break;
-
-	default:
-		result = N_FAIL;
-		break;
-	}
-
-	if (result) {
-		if (!g_spi.crc_off)
-			bc[len - 1] = (crc7(0x7f, (const u8 *)&bc[0], len - 1)) << 1;
-		else
-			len -= 1;
-
-		if (!g_spi.spi_tx(bc, len)) {
-			PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n");
-			result = N_FAIL;
-		}
-	}
-
-	return result;
-}
-
-static int spi_cmd_rsp(u8 cmd)
-{
-	u8 rsp;
-	int result = N_OK;
-
-	/**
-	 *      Command/Control response
-	 **/
-	if ((cmd == CMD_RESET) ||
-	    (cmd == CMD_TERMINATE) ||
-	    (cmd == CMD_REPEAT)) {
-		if (!g_spi.spi_rx(&rsp, 1)) {
-			result = N_FAIL;
-			goto _fail_;
-		}
-	}
-
-	if (!g_spi.spi_rx(&rsp, 1)) {
-		PRINT_ER("[wilc spi]: Failed cmd response read, bus error...\n");
-		result = N_FAIL;
-		goto _fail_;
-	}
-
-	if (rsp != cmd) {
-		PRINT_ER("[wilc spi]: Failed cmd response, cmd (%02x), resp (%02x)\n", cmd, rsp);
-		result = N_FAIL;
-		goto _fail_;
-	}
-
-	/**
-	 *      State response
-	 **/
-	if (!g_spi.spi_rx(&rsp, 1)) {
-		PRINT_ER("[wilc spi]: Failed cmd state read, bus error...\n");
-		result = N_FAIL;
-		goto _fail_;
-	}
-
-	if (rsp != 0x00) {
-		PRINT_ER("[wilc spi]: Failed cmd state response state (%02x)\n", rsp);
-		result = N_FAIL;
-	}
-
-_fail_:
-
-	return result;
-}
-
 static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
 {
 	u8 wb[32], rb[32];
@@ -607,74 +450,6 @@ _error_:
 	return result;
 }
 
-static int spi_data_read(u8 *b, u32 sz)
-{
-	int retry, ix, nbytes;
-	int result = N_OK;
-	u8 crc[2];
-	u8 rsp;
-
-	/**
-	 *      Data
-	 **/
-	ix = 0;
-	do {
-		if (sz <= DATA_PKT_SZ)
-			nbytes = sz;
-		else
-			nbytes = DATA_PKT_SZ;
-
-		/**
-		 *      Data Respnose header
-		 **/
-		retry = 10;
-		do {
-			if (!g_spi.spi_rx(&rsp, 1)) {
-				PRINT_ER("[wilc spi]: Failed data response read, bus error...\n");
-				result = N_FAIL;
-				break;
-			}
-			if (((rsp >> 4) & 0xf) == 0xf)
-				break;
-		} while (retry--);
-
-		if (result == N_FAIL)
-			break;
-
-		if (retry <= 0) {
-			PRINT_ER("[wilc spi]: Failed data response read...(%02x)\n", rsp);
-			result = N_FAIL;
-			break;
-		}
-
-		/**
-		 *      Read bytes
-		 **/
-		if (!g_spi.spi_rx(&b[ix], nbytes)) {
-			PRINT_ER("[wilc spi]: Failed data block read, bus error...\n");
-			result = N_FAIL;
-			break;
-		}
-
-		/**
-		 *      Read Crc
-		 **/
-		if (!g_spi.crc_off) {
-			if (!g_spi.spi_rx(crc, 2)) {
-				PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n");
-				result = N_FAIL;
-				break;
-			}
-		}
-
-		ix += nbytes;
-		sz -= nbytes;
-
-	} while (sz);
-
-	return result;
-}
-
 static int spi_data_write(u8 *b, u32 sz)
 {
 	int ix, nbytes;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bcbf1bd29a50..18e40e515a48 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -473,41 +473,6 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet
 }
 
 
-/**
- *  @brief      WILC_WFI_Set_PMKSA
- *  @details  Check if pmksa is cached and set it.
- *  @param[in]
- *  @return     int : Return 0 on Success
- *  @author	mdaftedar
- *  @date	01 MAR 2012
- *  @version	1.0
- */
-int WILC_WFI_Set_PMKSA(u8 *bssid, struct wilc_priv *priv)
-{
-	u32 i;
-	s32 s32Error = 0;
-
-
-	for (i = 0; i < priv->pmkid_list.numpmkid; i++)	{
-
-		if (!memcmp(bssid, priv->pmkid_list.pmkidlist[i].bssid,
-				 ETH_ALEN)) {
-			PRINT_D(CFG80211_DBG, "PMKID successful comparison");
-
-			/*If bssid is found, set the values*/
-			s32Error = host_int_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
-
-			if (s32Error != 0)
-				PRINT_ER("Error in pmkid\n");
-
-			break;
-		}
-	}
-
-	return s32Error;
-
-
-}
 int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
 
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index c73164165323..c8564249092c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -254,8 +254,6 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
 
 }
 
-u32 Statisitcs_totalAcks = 0, Statisitcs_DroppedAcks = 0;
-
 #ifdef	TCP_ACK_FILTER
 struct Ack_session_info;
 struct Ack_session_info {
@@ -319,7 +317,6 @@ static inline int Update_TCP_track_session(u32 index, u32 Ack)
 }
 static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_entry_t  *txqe)
 {
-	Statisitcs_totalAcks++;
 	if (Pending_Acks < MAX_PENDING_ACKS) {
 		Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].ack_num = Ack;
 		Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].txqe = txqe;
@@ -422,7 +419,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
 			tqe = Pending_Acks_info[i].txqe;
 			if (tqe) {
 				wilc_wlan_txq_remove(tqe);
-				Statisitcs_DroppedAcks++;
 				tqe->status = 1;                                /* mark the packet send */
 				if (tqe->tx_complete_func)
 					tqe->tx_complete_func(tqe->priv, tqe->status);
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1255292 — Re: [PATCH 01/19] staging/wilc1000: remove unused functions

FromGreg KH <gregkh@linuxfoundation.org>
Date2015-10-25 09:30 +0100
SubjectRe: [PATCH 01/19] staging/wilc1000: remove unused functions
Message-ID<qnoQF-891-1@gated-at.bofh.it>
In reply to#1252327
On Wed, Oct 21, 2015 at 12:47:20AM +0200, Arnd Bergmann wrote:
> A number of symbols in the wilc1000 driver are completely unused
> and can be removed.
> This includes two variables that are only written but not read.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Due to other patches that were sent before yours for this driver, this
patch doesn't apply :(

Watch out, I'm getting about 50 patches a week for this driver, it's
under _heavy_ development, you will get merge issues...

Can you rebase the series on my staging-testing branch and resend?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252328 — [PATCH 06/19] staging/wilc1000: avoid static definitions in header

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 06/19] staging/wilc1000: avoid static definitions in header
Message-ID<qlO2S-10k-19@gated-at.bofh.it>
In reply to#1252310
The wilc_wfi_cfgoperations.h header defines the ieee80211_txrx_stypes
and cipher_suites variables that are only used in wilc_wfi_cfgoperations.c
and should not be shared in a header file.

This moves over all that data into the .c file, and also moves all
the macro definitions from the file that are also not needed here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 84 +++++++++++++++++++++++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 83 ----------------------
 2 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0ed05aafa5bf..702c40c1df4b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -17,6 +17,90 @@
 #include "host_interface.h"
 #include <linux/errno.h>
 
+/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */
+#define NO_ENCRYPT		0
+#define ENCRYPT_ENABLED		BIT(0)
+#define WEP			BIT(1)
+#define WEP_EXTENDED		BIT(2)
+#define WPA			BIT(3)
+#define WPA2			BIT(4)
+#define AES			BIT(5)
+#define TKIP			BIT(6)
+
+/*Public action frame index IDs*/
+#define FRAME_TYPE_ID			0
+#define ACTION_CAT_ID			24
+#define ACTION_SUBTYPE_ID		25
+#define P2P_PUB_ACTION_SUBTYPE		30
+
+/*Public action frame Attribute IDs*/
+#define ACTION_FRAME			0xd0
+#define GO_INTENT_ATTR_ID		0x04
+#define CHANLIST_ATTR_ID		0x0b
+#define OPERCHAN_ATTR_ID		0x11
+#define PUB_ACTION_ATTR_ID		0x04
+#define P2PELEM_ATTR_ID			0xdd
+
+/*Public action subtype values*/
+#define GO_NEG_REQ			0x00
+#define GO_NEG_RSP			0x01
+#define GO_NEG_CONF			0x02
+#define P2P_INV_REQ			0x03
+#define P2P_INV_RSP			0x04
+#define PUBLIC_ACT_VENDORSPEC		0x09
+#define GAS_INTIAL_REQ			0x0a
+#define GAS_INTIAL_RSP			0x0b
+
+#define INVALID_CHANNEL			0
+
+#define nl80211_SCAN_RESULT_EXPIRE	(3 * HZ)
+#define SCAN_RESULT_EXPIRE		(40 * HZ)
+
+static const u32 cipher_suites[] = {
+	WLAN_CIPHER_SUITE_WEP40,
+	WLAN_CIPHER_SUITE_WEP104,
+	WLAN_CIPHER_SUITE_TKIP,
+	WLAN_CIPHER_SUITE_CCMP,
+	WLAN_CIPHER_SUITE_AES_CMAC,
+};
+
+static const struct ieee80211_txrx_stypes
+	wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
+	[NL80211_IFTYPE_STATION] = {
+		.tx = 0xffff,
+		.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+			BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
+	},
+	[NL80211_IFTYPE_AP] = {
+		.tx = 0xffff,
+		.rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+			BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+			BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+			BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+			BIT(IEEE80211_STYPE_AUTH >> 4) |
+			BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+			BIT(IEEE80211_STYPE_ACTION >> 4)
+	},
+	[NL80211_IFTYPE_P2P_CLIENT] = {
+		.tx = 0xffff,
+		.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+			BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+			BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+			BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+			BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+			BIT(IEEE80211_STYPE_AUTH >> 4) |
+			BIT(IEEE80211_STYPE_DEAUTH >> 4)
+	}
+};
+
+/* Time to stay on the channel */
+#define WILC_WFI_DWELL_PASSIVE 100
+#define WILC_WFI_DWELL_ACTIVE  40
+
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH	54
+#define DEFAULT_LINK_SPEED			72
+
+
 #define IS_MANAGMEMENT				0x100
 #define IS_MANAGMEMENT_CALLBACK			0x080
 #define IS_MGMT_STATUS_SUCCES			0x040
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index ae2aaea508db..158d98c0eb87 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,86 +10,6 @@
 #define NM_WFI_CFGOPERATIONS
 #include "wilc_wfi_netdevice.h"
 
-/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */
-#define NO_ENCRYPT		0
-#define ENCRYPT_ENABLED		BIT(0)
-#define WEP			BIT(1)
-#define WEP_EXTENDED		BIT(2)
-#define WPA			BIT(3)
-#define WPA2			BIT(4)
-#define AES			BIT(5)
-#define TKIP			BIT(6)
-
-/*Public action frame index IDs*/
-#define FRAME_TYPE_ID			0
-#define ACTION_CAT_ID			24
-#define ACTION_SUBTYPE_ID		25
-#define P2P_PUB_ACTION_SUBTYPE		30
-
-/*Public action frame Attribute IDs*/
-#define ACTION_FRAME			0xd0
-#define GO_INTENT_ATTR_ID		0x04
-#define CHANLIST_ATTR_ID		0x0b
-#define OPERCHAN_ATTR_ID		0x11
-#define PUB_ACTION_ATTR_ID		0x04
-#define P2PELEM_ATTR_ID			0xdd
-
-/*Public action subtype values*/
-#define GO_NEG_REQ			0x00
-#define GO_NEG_RSP			0x01
-#define GO_NEG_CONF			0x02
-#define P2P_INV_REQ			0x03
-#define P2P_INV_RSP			0x04
-#define PUBLIC_ACT_VENDORSPEC		0x09
-#define GAS_INTIAL_REQ			0x0a
-#define GAS_INTIAL_RSP			0x0b
-
-#define INVALID_CHANNEL			0
-
-#define nl80211_SCAN_RESULT_EXPIRE	(3 * HZ)
-#define SCAN_RESULT_EXPIRE		(40 * HZ)
-
-static const u32 cipher_suites[] = {
-	WLAN_CIPHER_SUITE_WEP40,
-	WLAN_CIPHER_SUITE_WEP104,
-	WLAN_CIPHER_SUITE_TKIP,
-	WLAN_CIPHER_SUITE_CCMP,
-	WLAN_CIPHER_SUITE_AES_CMAC,
-};
-
-static const struct ieee80211_txrx_stypes
-	wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
-	[NL80211_IFTYPE_STATION] = {
-		.tx = 0xffff,
-		.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
-			BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
-	},
-	[NL80211_IFTYPE_AP] = {
-		.tx = 0xffff,
-		.rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
-			BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
-			BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
-			BIT(IEEE80211_STYPE_DISASSOC >> 4) |
-			BIT(IEEE80211_STYPE_AUTH >> 4) |
-			BIT(IEEE80211_STYPE_DEAUTH >> 4) |
-			BIT(IEEE80211_STYPE_ACTION >> 4)
-	},
-	[NL80211_IFTYPE_P2P_CLIENT] = {
-		.tx = 0xffff,
-		.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
-			BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
-			BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
-			BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
-			BIT(IEEE80211_STYPE_DISASSOC >> 4) |
-			BIT(IEEE80211_STYPE_AUTH >> 4) |
-			BIT(IEEE80211_STYPE_DEAUTH >> 4)
-	}
-};
-
-/* Time to stay on the channel */
-#define WILC_WFI_DWELL_PASSIVE 100
-#define WILC_WFI_DWELL_ACTIVE  40
-
 struct wireless_dev *wilc_create_wiphy(struct net_device *net);
 void wilc_free_wiphy(struct net_device *net);
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
@@ -101,7 +21,4 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 			      u16 frame_type, bool reg);
 
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH	54
-#define DEFAULT_LINK_SPEED			72
-
 #endif
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252330 — [PATCH 09/19] staging/wilc1000: move init/exit functions to driver files

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 09/19] staging/wilc1000: move init/exit functions to driver files
Message-ID<qlO2T-10k-33@gated-at.bofh.it>
In reply to#1252310
The driver interfaces are in linux_wlan_sdio.c and linux_wlan_spi.c, so
this is where the init and exit functions should be. Splitting this up
enables further cleanups, including eventually allowing both modules
to be built together.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/linux_wlan.c      | 49 +++++++-----------------------
 drivers/staging/wilc1000/linux_wlan_sdio.c | 14 +++++++++
 drivers/staging/wilc1000/linux_wlan_spi.c  | 16 ++++++++++
 drivers/staging/wilc1000/wilc_wlan.h       |  4 +++
 4 files changed, 45 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 53cecb892a84..caa85442c12d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1725,59 +1725,38 @@ int wilc_netdev_init(void)
 	return 0;
 }
 
-/*The 1st function called after module inserted*/
-static int __init init_wilc_driver(void)
+void __init wilc1000_init_driver(void)
 {
 #if defined(WILC_DEBUGFS)
-	if (wilc_debugfs_init() < 0) {
+	if (wilc_debugfs_init() < 0)
 		PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
-		return -1;
-	}
 #endif
 
 	printk("IN INIT FUNCTION\n");
 	printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
-
-#ifdef WILC_SDIO
-	{
-		int ret;
-
-		ret = sdio_register_driver(&wilc_bus);
-		if (ret < 0)
-			PRINT_D(INIT_DBG, "init_wilc_driver: Failed register sdio driver\n");
-
-		return ret;
-	}
-#else
-	PRINT_D(INIT_DBG, "Initializing netdev\n");
-	if (wilc_netdev_init())
-		PRINT_ER("Couldn't initialize netdev\n");
-	return 0;
-#endif
 }
-late_initcall(init_wilc_driver);
 
-static void __exit exit_wilc_driver(void)
+void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 {
 	int i = 0;
 	perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
 	#define CLOSE_TIMEOUT (12 * 1000)
 
-	if ((wilc1000_dev != NULL) && (((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
-				       || ((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+	if (wilc1000_dev->strInterfaceInfo[0].wilc_netdev ||
+	    wilc1000_dev->strInterfaceInfo[1].wilc_netdev) {
 		unregister_inetaddr_notifier(&g_dev_notifier);
 
 		for (i = 0; i < NUM_CONCURRENT_IFC; i++)
 			nic[i] = netdev_priv(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
 	}
 
-	if ((wilc1000_dev != NULL) && wilc1000_dev->wilc_firmware != NULL) {
+	if (wilc1000_dev->wilc_firmware) {
 		release_firmware(wilc1000_dev->wilc_firmware);
 		wilc1000_dev->wilc_firmware = NULL;
 	}
 
-	if ((wilc1000_dev != NULL) && (((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
-				       || ((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+	if (wilc1000_dev->strInterfaceInfo[0].wilc_netdev ||
+	    wilc1000_dev->strInterfaceInfo[1].wilc_netdev) {
 		PRINT_D(INIT_DBG, "Waiting for wilc1000_mac_close ....\n");
 
 		if (linux_wlan_lock_timeout(&close_exit_sync, CLOSE_TIMEOUT) < 0)
@@ -1801,15 +1780,10 @@ static void __exit exit_wilc_driver(void)
 			free_netdev(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
 		}
 	}
+}
 
-#ifndef WILC_SDIO
-	PRINT_D(INIT_DBG, "SPI unregsiter...\n");
-	spi_unregister_driver(&wilc_bus);
-#else
-	PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
-	sdio_unregister_driver(&wilc_bus);
-#endif
-
+void __exit wilc1000_exit_driver(void)
+{
 	kfree(wilc1000_dev);
 	wilc1000_dev = NULL;
 	printk("Module_exit Done.\n");
@@ -1818,6 +1792,5 @@ static void __exit exit_wilc_driver(void)
 	wilc_debugfs_remove();
 #endif
 }
-module_exit(exit_wilc_driver);
 
 MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 4e8c4e6d499e..badcae57875c 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -237,4 +237,18 @@ int wilc1000_sdio_set_default_speed(void)
 }
 
 
+static int __init init_wilc_sdio_driver(void)
+{
+	wilc1000_init_driver();
+	return sdio_register_driver(&wilc_bus);
+}
+late_initcall(init_wilc_sdio_driver);
 
+static void __exit exit_wilc_sdio_driver(void)
+{
+	if (wilc1000_dev)
+		wilc_netdev_free(wilc1000_dev);
+	sdio_unregister_driver(&wilc_bus);
+	wilc1000_exit_driver();
+}
+module_exit(exit_wilc_sdio_driver);
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 43cfeda97030..c90b741824dc 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -406,3 +406,19 @@ int wilc1000_spi_set_max_speed(void)
 	PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED);
 	return 1;
 }
+
+static int __init init_wilc_spi_driver(void)
+{
+	wilc1000_init_driver();
+	return wilc_netdev_init();
+}
+late_initcall(init_wilc_spi_driver);
+
+static void __exit exit_wilc_spi_driver(void)
+{
+	if (wilc1000_dev)
+		wilc_netdev_free(wilc1000_dev);
+	spi_unregister_driver(&wilc_bus);
+	wilc1000_exit_driver();
+}
+module_exit(exit_wilc_spi_driver);
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 4460c482cb7a..dd312b0b1abf 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -321,6 +321,8 @@ void wilc1000_chip_sleep_manually(u32 u32SleepTime);
 int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 int wilc_netdev_init(void);
+void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+
 void wilc_handle_isr(void);
 
 u16 wilc1000_set_machw_change_vir_if(bool bValue);
@@ -337,5 +339,7 @@ u8 wilc1000_core_11b_ready(void);
 extern bool wilc1000_enable_ps;
 extern volatile int wilc1000_probe;
 
+void __init wilc1000_init_driver(void);
+void __exit wilc1000_exit_driver(void);
 
 #endif
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252334 — [PATCH 07/19] staging/wilc1000: remove linux_wlan_{device_power,device_detection}

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 07/19] staging/wilc1000: remove linux_wlan_{device_power,device_detection}
Message-ID<qlO2T-10k-35@gated-at.bofh.it>
In reply to#1252310
The driver provides an interface for custom power management
and detection that is meant to be filled by people customizing
the driver. The default implementation of this is empty, and
we don't actually want people to have to modify the source code.

If anybody needs this, they need to describe the respective
hardware specifics using device tree or platform data and make
the driver handle this is a more general way.

This removes the empty stubs.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/linux_wlan.c | 62 -----------------------------------
 1 file changed, 62 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index d3cc255cd91b..eb4c6cba4575 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -32,47 +32,6 @@
 #include "linux_wlan_spi.h"
 #endif
 
-#if defined(CUSTOMER_PLATFORM)
-/*
- TODO : Write power control functions as customer platform.
- */
-#else
-
- #define _linux_wlan_device_power_on()		{}
- #define _linux_wlan_device_power_off()		{}
-
- #define _linux_wlan_device_detection()		{}
- #define _linux_wlan_device_removal()		{}
-#endif
-
-static int linux_wlan_device_power(int on_off)
-{
-	PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
-
-	if (on_off) {
-		_linux_wlan_device_power_on();
-	} else {
-		_linux_wlan_device_power_off();
-	}
-
-	return 0;
-}
-
-static int linux_wlan_device_detection(int on_off)
-{
-	PRINT_D(INIT_DBG, "linux_wlan_device_detection.. (%d)\n", on_off);
-
-#ifdef WILC_SDIO
-	if (on_off) {
-		_linux_wlan_device_detection();
-	} else {
-		_linux_wlan_device_removal();
-	}
-#endif
-
-	return 0;
-}
-
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);
 
 static struct notifier_block g_dev_notifier = {
@@ -1046,12 +1005,6 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 		wilc_wlan_global_reset();
 		sdio_unregister_driver(&wilc_bus);
 
-		linux_wlan_device_detection(0);
-
-		mdelay(100);
-
-		linux_wlan_device_detection(1);
-
 		sdio_register_driver(&wilc_bus);
 
 		while (!wilc1000_probe)
@@ -1076,14 +1029,6 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 
 	sdio_unregister_driver(&wilc_bus);
 
-	linux_wlan_device_detection(0);
-	linux_wlan_device_power(0);
-	msleep(100);
-	linux_wlan_device_power(1);
-	msleep(80);
-	linux_wlan_device_detection(1);
-	msleep(20);
-
 	sdio_register_driver(&wilc_bus);
 
 	/* msleep(1000); */
@@ -1794,10 +1739,6 @@ static int __init init_wilc_driver(void)
 	printk("IN INIT FUNCTION\n");
 	printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
 
-	linux_wlan_device_power(1);
-	msleep(100);
-	linux_wlan_device_detection(1);
-
 #ifdef WILC_SDIO
 	{
 		int ret;
@@ -1877,9 +1818,6 @@ static void __exit exit_wilc_driver(void)
 #if defined(WILC_DEBUGFS)
 	wilc_debugfs_remove();
 #endif
-
-	linux_wlan_device_detection(0);
-	linux_wlan_device_power(0);
 }
 module_exit(exit_wilc_driver);
 
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252335 — [PATCH 13/19] staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 13/19] staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c
Message-ID<qlO2T-10k-39@gated-at.bofh.it>
In reply to#1252310
The COMPLEMENT_BOOT code is used only for SDIO and is aware of
details of the SDIO implementation that don't belong into
the common linux_wlan.c file.

This moves the functions to linux_wlan_sdio.c to get them out of
the way.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/linux_wlan.c         | 95 +++------------------------
 drivers/staging/wilc1000/linux_wlan_sdio.c    | 89 +++++++++++++++++++++++--
 drivers/staging/wilc1000/linux_wlan_sdio.h    |  4 --
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 drivers/staging/wilc1000/wilc_wlan.h          |  4 +-
 drivers/staging/wilc1000/wilc_wlan_if.h       |  5 ++
 6 files changed, 103 insertions(+), 96 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index abcb70bb1bd7..980c2c8d300d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -483,11 +483,7 @@ _fail_:
 
 }
 
-#ifdef COMPLEMENT_BOOT
-static int repeat_power_cycle(perInterface_wlan_t *nic);
-#endif
-
-static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
+int wilc1000_start_firmware(perInterface_wlan_t *nic)
 {
 
 	int ret = 0;
@@ -502,19 +498,17 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
 	/* wait for mac ready */
 	PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
 	ret = linux_wlan_lock_timeout(&wilc1000_dev->sync_event, 5000);
-	if (ret) {
-#ifdef COMPLEMENT_BOOT
+	if (ret && wilc1000_dev->ops->repeat_power_cycle) {
 		static int timeout = 5;
 
 		if (timeout--) {
 			PRINT_D(INIT_DBG, "repeat power cycle[%d]", timeout);
-			ret = repeat_power_cycle(nic);
+			ret = wilc1000_dev->ops->repeat_power_cycle(nic);
 		} else {
 			timeout = 5;
 			ret = -1;
 			goto _fail_;
 		}
-#endif
 		PRINT_D(INIT_DBG, "Firmware start timed out");
 		goto _fail_;
 	}
@@ -527,7 +521,8 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
 _fail_:
 	return ret;
 }
-static int linux_wlan_firmware_download(struct wilc *p_nic)
+
+int wilc1000_firmware_download(struct wilc *p_nic)
 {
 
 	int ret = 0;
@@ -954,77 +949,6 @@ static void wlan_deinitialize_threads(struct wilc *nic)
 	}
 }
 
-#ifdef COMPLEMENT_BOOT
-
-#define READY_CHECK_THRESHOLD		30
-static u8 wilc1000_prepare_11b_core(struct wilc *nic)
-{
-	u8 trials = 0;
-
-	while ((wilc1000_core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++)))) {
-		PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
-		wilc_wlan_cleanup();
-		wilc_wlan_global_reset();
-		sdio_unregister_driver(&wilc_bus);
-
-		sdio_register_driver(&wilc_bus);
-
-		while (!wilc1000_probe)
-			msleep(100);
-		wilc1000_probe = 0;
-		wilc1000_dev->dev = &wilc1000_sdio_func->dev;
-		nic->ops = &wilc1000_sdio_ops;
-		wilc_wlan_init(nic);
-	}
-
-	if (READY_CHECK_THRESHOLD <= trials)
-		return 1;
-	else
-		return 0;
-
-}
-
-static int repeat_power_cycle(perInterface_wlan_t *nic)
-{
-	int ret = 0;
-	sdio_unregister_driver(&wilc_bus);
-
-	sdio_register_driver(&wilc_bus);
-
-	/* msleep(1000); */
-	while (!wilc1000_probe)
-		msleep(100);
-	wilc1000_probe = 0;
-	wilc1000_dev->dev = &wilc1000_sdio_func->dev;
-	wilc1000_dev->ops = &wilc1000_sdio_ops;
-	ret = wilc_wlan_init(wilc1000_dev);
-
-	wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
-	#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-	wilc1000_sdio_enable_interrupt();
-	#endif
-
-	if (wilc1000_wlan_get_firmware(nic)) {
-		PRINT_ER("Can't get firmware\n");
-		ret = -1;
-		goto __fail__;
-	}
-
-	/*Download firmware*/
-	ret = linux_wlan_firmware_download(wilc1000_dev);
-	if (ret < 0) {
-		PRINT_ER("Failed to download firmware\n");
-		goto __fail__;
-	}
-	/* Start firmware*/
-	ret = linux_wlan_start_firmware(nic);
-	if (ret < 0)
-		PRINT_ER("Failed to start firmware\n");
-__fail__:
-	return ret;
-}
-#endif
-
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 {
 	perInterface_wlan_t *nic = p_nic;
@@ -1051,13 +975,12 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 			goto _fail_wilc_wlan_;
 		}
 
-#if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
-		if (wilc1000_prepare_11b_core(wilc1000_dev)) {
+		if (wilc1000_dev->ops->prepare_11b_core &&
+		    wilc1000_dev->ops->prepare_11b_core(wilc1000_dev)) {
 			PRINT_ER("11b Core is not ready\n");
 			ret = -EIO;
 			goto _fail_threads_;
 		}
-#endif
 
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
 		if (init_irq(wilc1000_dev)) {
@@ -1082,7 +1005,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 		}
 
 		/*Download firmware*/
-		ret = linux_wlan_firmware_download(wilc1000_dev);
+		ret = wilc1000_firmware_download(wilc1000_dev);
 		if (ret < 0) {
 			PRINT_ER("Failed to download firmware\n");
 			ret = -EIO;
@@ -1090,7 +1013,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 		}
 
 		/* Start firmware*/
-		ret = linux_wlan_start_firmware(nic);
+		ret = wilc1000_start_firmware(nic);
 		if (ret < 0) {
 			PRINT_ER("Failed to start firmware\n");
 			ret = -EIO;
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 429bdc85ed62..bb4a3acf16d0 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -1,5 +1,6 @@
 #include "wilc_wfi_netdevice.h"
 #include "linux_wlan_sdio.h"
+#include "wilc_wfi_netdevice.h"
 
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/card.h>
@@ -23,7 +24,7 @@
 #endif
 
 
-struct sdio_func *wilc1000_sdio_func;
+static struct sdio_func *wilc1000_sdio_func;
 static unsigned int sdio_default_speed;
 
 #define SDIO_VENDOR_ID_WILC 0x0296
@@ -108,7 +109,83 @@ static int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
 	return 1;
 }
 
-volatile int wilc1000_probe; /* COMPLEMENT_BOOT */
+static const struct wilc1000_ops wilc1000_sdio_ops;
+
+#ifdef COMPLEMENT_BOOT
+/* FIXME: remove all of COMPLEMENT_BOOT */
+
+static struct sdio_driver wilc_bus;
+static volatile int wilc1000_probe;
+
+#define READY_CHECK_THRESHOLD		30
+static u8 wilc1000_prepare_11b_core(struct wilc *nic)
+{
+	u8 trials = 0;
+
+	while ((wilc1000_core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++)))) {
+		PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
+		wilc_wlan_cleanup();
+		wilc_wlan_global_reset();
+		sdio_unregister_driver(&wilc_bus);
+
+		sdio_register_driver(&wilc_bus);
+
+		while (!wilc1000_probe)
+			msleep(100);
+		wilc1000_probe = 0;
+		wilc1000_dev->dev = &wilc1000_sdio_func->dev;
+		nic->ops = &wilc1000_sdio_ops;
+		wilc_wlan_init(nic);
+	}
+
+	if (READY_CHECK_THRESHOLD <= trials)
+		return 1;
+	else
+		return 0;
+
+}
+
+static int repeat_power_cycle(perInterface_wlan_t *nic)
+{
+	int ret = 0;
+	sdio_unregister_driver(&wilc_bus);
+
+	sdio_register_driver(&wilc_bus);
+
+	/* msleep(1000); */
+	while (!wilc1000_probe)
+		msleep(100);
+	wilc1000_probe = 0;
+	wilc1000_dev->dev = &wilc1000_sdio_func->dev;
+	wilc1000_dev->ops = &wilc1000_sdio_ops;
+	ret = wilc_wlan_init(wilc1000_dev);
+
+	wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
+#if !defined WILC_SDIO_IRQ_GPIO
+	wilc1000_sdio_enable_interrupt();
+#endif
+
+	if (wilc1000_wlan_get_firmware(nic)) {
+		PRINT_ER("Can't get firmware\n");
+		ret = -1;
+		goto __fail__;
+	}
+
+	/*Download firmware*/
+	ret = wilc1000_firmware_download(wilc1000_dev);
+	if (ret < 0) {
+		PRINT_ER("Failed to download firmware\n");
+		goto __fail__;
+	}
+	/* Start firmware*/
+	ret = wilc1000_start_firmware(nic);
+	if (ret < 0)
+		PRINT_ER("Failed to start firmware\n");
+__fail__:
+	return ret;
+}
+#endif
+
 static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
 {
 	PRINT_D(INIT_DBG, "probe function\n");
@@ -141,7 +218,7 @@ static void linux_sdio_remove(struct sdio_func *func)
 
 }
 
-struct sdio_driver wilc_bus = {
+static struct sdio_driver wilc_bus = {
 	.name		= SDIO_MODALIAS,
 	.id_table	= wilc_sdio_ids,
 	.probe		= linux_sdio_probe,
@@ -238,10 +315,14 @@ static int wilc1000_sdio_set_default_speed(void)
 	return linux_sdio_set_speed(sdio_default_speed);
 }
 
-const struct wilc1000_ops wilc1000_sdio_ops = {
+static const struct wilc1000_ops wilc1000_sdio_ops = {
 	.io_type = HIF_SDIO,
 	.io_init = wilc1000_sdio_init,
 	.io_deinit = wilc1000_sdio_deinit,
+#ifdef COMPLEMENT_BOOT
+	.repeat_power_cycle = repeat_power_cycle,
+	.prepare_11b_core = wilc1000_prepare_11b_core,
+#endif
 	.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
 	.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
 	.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h
index de79aff9f11c..b4995a3211c7 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -1,9 +1,5 @@
 #include <linux/mmc/sdio_func.h>
 
-extern struct sdio_func *wilc1000_sdio_func;
-extern struct sdio_driver wilc_bus;
-extern const struct wilc1000_ops wilc1000_sdio_ops;
-
 int wilc1000_sdio_enable_interrupt(void);
 void wilc1000_sdio_disable_interrupt(void);
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 1e5e7dcee11d..ec5a8b1215b7 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -188,7 +188,7 @@ struct wilc {
 	struct device *dev;
 };
 
-typedef struct {
+typedef struct wilc_per_interface {
 	u8 u8IfIdx;
 	u8 iftype;
 	int monitor_flag;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 2297e31b5b75..10b2a2f9e1b2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -338,7 +338,9 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
 u8 wilc1000_core_11b_ready(void);
 
 extern bool wilc1000_enable_ps;
-extern volatile int wilc1000_probe;
+
+int wilc1000_firmware_download(struct wilc *p_nic);
+int wilc1000_start_firmware(struct wilc_per_interface *nic);
 
 void __init wilc1000_init_driver(void);
 void __exit wilc1000_exit_driver(void);
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index bfa1291e22ed..a4befcb74c82 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -71,10 +71,15 @@ typedef struct {
 	u32 block_size;
 } sdio_cmd53_t;
 
+struct wilc;
+struct wilc_per_interface;
 struct wilc1000_ops {
 	int io_type;
 	int (*io_init)(void *);
 	void (*io_deinit)(void *);
+	int (*repeat_power_cycle)(struct wilc_per_interface *nic);
+	u8 (*prepare_11b_core)(struct wilc *nic);
+
 	union {
 		struct {
 			int (*sdio_cmd52)(sdio_cmd52_t *);
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252336 — [PATCH 18/19] staging/wilc1000: split out bus specific modules

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 18/19] staging/wilc1000: split out bus specific modules
Message-ID<qlO2S-10k-17@gated-at.bofh.it>
In reply to#1252310
The SPI and SDIO specific code is now separate enough that
we just need to restructure the Makefile and Kconfig logic
a bit and export a couple of symbols from the common module
to have separate bus glue drivers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/Kconfig           | 66 +++++++++++++-----------------
 drivers/staging/wilc1000/Makefile          |  9 ++--
 drivers/staging/wilc1000/linux_wlan.c      |  6 +++
 drivers/staging/wilc1000/linux_wlan_sdio.c |  1 +
 drivers/staging/wilc1000/linux_wlan_spi.c  |  1 +
 drivers/staging/wilc1000/wilc_debugfs.c    |  2 +
 drivers/staging/wilc1000/wilc_wlan.c       |  1 +
 7 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig
index ee51b4278088..2923122346ef 100644
--- a/drivers/staging/wilc1000/Kconfig
+++ b/drivers/staging/wilc1000/Kconfig
@@ -1,41 +1,12 @@
-config WILC1000_DRIVER
-	bool "WILC1000 support (WiFi only)"
-	depends on CFG80211 && WEXT_CORE && INET
-	---help---
-	  This module only support IEEE 802.11n WiFi.
-
-if WILC1000_DRIVER
-
 config WILC1000
 	tristate
-
-choice
-        prompt "Memory Allocation"
-        default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-
-config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-	bool "Preallocate memory at loading driver"
+	select WIRELESS_EXT
 	---help---
-	  This choice supports static allocation of the memory
-	  for the receive buffer. The driver will allocate the RX buffer
-	  during initial time. The driver will also free the buffer
-	  by calling network device stop.
-
-config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY
-        bool "Dynamically allocate memory in real time"
-        ---help---
-	  This choice supports dynamic allocation of the memory
-	  for the receive buffer. The driver will allocate the RX buffer
-	  when it is required.
-endchoice
-
-choice
-	prompt "Bus Type"
-	default WILC1000_SDIO
+	  This module only support IEEE 802.11n WiFi.
 
 config WILC1000_SDIO
-	bool "SDIO support"
-	depends on MMC
+	tristate "Atmel WILC1000 SDIO (WiFi only)"
+	depends on CFG80211 && INET && MMC
 	select WILC1000
 	---help---
 	  This module adds support for the SDIO interface of adapters using
@@ -48,9 +19,9 @@ config WILC1000_SDIO
 	  this if your platform is using the SDIO bus.
 
 config WILC1000_SPI
-	depends on SPI
+	tristate "Atmel WILC1000 SPI (WiFi only)"
+	depends on CFG80211 && INET && SPI
 	select WILC1000
-	bool "SPI support"
 	---help---
 	  This module adds support for the SPI interface of adapters using
 	  WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral
@@ -59,10 +30,31 @@ config WILC1000_SPI
 	  full-duplex slave synchronous serial interface that is available
 	  immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to
 	  VDDIO. Select this if your platform is using the SPI bus.
+
+choice
+        prompt "WILC1000 Memory Allocation"
+        depends on WILC1000
+        default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
+
+config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
+	bool "Preallocate memory at loading driver"
+	---help---
+	  This choice supports static allocation of the memory
+	  for the receive buffer. The driver will allocate the RX buffer
+	  during initial time. The driver will also free the buffer
+	  by calling network device stop.
+
+config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY
+        bool "Dynamically allocate memory in real time"
+        ---help---
+	  This choice supports dynamic allocation of the memory
+	  for the receive buffer. The driver will allocate the RX buffer
+	  when it is required.
 endchoice
 
+
 config WILC1000_HW_OOB_INTR
-	bool "Use out of band interrupt"
+	bool "WILC1000 out of band interrupt"
 	depends on WILC1000_SDIO
 	default n
 	---help---
@@ -71,5 +63,3 @@ config WILC1000_HW_OOB_INTR
 	  mechanism for SDIO host controllers that don't support SDIO interrupt.
 	  Select this option If the SDIO host controller in your platform
 	  doesn't support SDIO time devision interrupt.
-
-endif
diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 9ce30e92ea3a..198d536da57c 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -18,8 +18,11 @@ 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
+obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
+wilc1000-sdio-objs += linux_wlan_sdio.o wilc_sdio.o
+
+obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
+wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 04ebb6310070..8a5f4673c5d0 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -56,6 +56,8 @@ static void wilc_set_multicast_list(struct net_device *dev);
  * and this data should be pointer to net device
  */
 struct wilc *wilc1000_dev;
+EXPORT_SYMBOL_GPL(wilc1000_dev);
+
 bool wilc1000_enable_ps = true;
 
 static const struct net_device_ops wilc_netdev_ops = {
@@ -1590,6 +1592,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
 void __init wilc1000_init_driver(void)
 {
@@ -1601,6 +1604,7 @@ void __init wilc1000_init_driver(void)
 	printk("IN INIT FUNCTION\n");
 	printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
 }
+EXPORT_SYMBOL_GPL(wilc1000_init_driver);
 
 void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 {
@@ -1647,6 +1651,7 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 		}
 	}
 }
+EXPORT_SYMBOL_GPL(wilc_netdev_free);
 
 void __exit wilc1000_exit_driver(void)
 {
@@ -1658,5 +1663,6 @@ void __exit wilc1000_exit_driver(void)
 	wilc_debugfs_remove();
 #endif
 }
+EXPORT_SYMBOL_GPL(wilc1000_exit_driver);
 
 MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1f79d986be5c..1f343ac72530 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -350,3 +350,4 @@ static void __exit exit_wilc_sdio_driver(void)
 	wilc1000_exit_driver();
 }
 module_exit(exit_wilc_sdio_driver);
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 02b922ab86bb..c0e0e6be6b0b 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -447,3 +447,4 @@ static void __exit exit_wilc_spi_driver(void)
 	wilc1000_exit_driver();
 }
 module_exit(exit_wilc_spi_driver);
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index c22f0ca10250..6f37b6491de7 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -27,7 +27,9 @@ static struct dentry *wilc_dir;
 #define DBG_REGION_ALL	(GENERIC_DBG | HOSTAPD_DBG | HOSTINF_DBG | CORECONFIG_DBG | CFG80211_DBG | INT_DBG | TX_DBG | RX_DBG | LOCK_DBG | INIT_DBG | BUS_DBG | MEM_DBG)
 #define DBG_LEVEL_ALL	(DEBUG | INFO | WRN | ERR)
 atomic_t WILC1000_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
+EXPORT_SYMBOL_GPL(WILC1000_REGION);
 atomic_t WILC1000_DEBUG_LEVEL = ATOMIC_INIT(ERR);
+EXPORT_SYMBOL_GPL(WILC1000_DEBUG_LEVEL);
 
 /*
  * --------------------------------------------------------------------------------
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 04d2938a383c..bebc0880cc02 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1376,6 +1376,7 @@ void wilc_handle_isr(void)
 	}
 	release_bus(RELEASE_ALLOW_SLEEP);
 }
+EXPORT_SYMBOL_GPL(wilc_handle_isr);
 
 /********************************************
  *
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252854 — [PATCH] fixup! staging/wilc1000: split out bus specific modules

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 16:30 +0200
Subject[PATCH] fixup! staging/wilc1000: split out bus specific modules
Message-ID<qm2yS-5Ck-7@gated-at.bofh.it>
In reply to#1252336
The patch to split out bus modules causes new valid build warnings without this.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 8a5f4673c5d0..fe3b464f0d5c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1594,7 +1594,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-void __init wilc1000_init_driver(void)
+void wilc1000_init_driver(void)
 {
 #if defined(WILC_DEBUGFS)
 	if (wilc_debugfs_init() < 0)
@@ -1606,7 +1606,7 @@ void __init wilc1000_init_driver(void)
 }
 EXPORT_SYMBOL_GPL(wilc1000_init_driver);
 
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
+void wilc_netdev_free(struct wilc *wilc1000_dev)
 {
 	int i = 0;
 	perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
@@ -1653,7 +1653,7 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_free);
 
-void __exit wilc1000_exit_driver(void)
+void wilc1000_exit_driver(void)
 {
 	kfree(wilc1000_dev);
 	wilc1000_dev = NULL;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index f684d5bf465d..b460b7f6971a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -320,7 +320,7 @@ int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
 		     const struct wilc1000_hif_ops *hif_ops, int gpio);
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+void wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
 
@@ -340,7 +340,7 @@ extern bool wilc1000_enable_ps;
 int wilc1000_firmware_download(struct wilc *p_nic);
 int wilc1000_start_firmware(struct wilc_per_interface *nic);
 
-void __init wilc1000_init_driver(void);
-void __exit wilc1000_exit_driver(void);
+void wilc1000_init_driver(void);
+void wilc1000_exit_driver(void);
 
 #endif



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252337 — [PATCH 02/19] staging/wilc1000: make symbols static if possible

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 02/19] staging/wilc1000: make symbols static if possible
Message-ID<qlO2T-10k-41@gated-at.bofh.it>
In reply to#1252310
All symbols that are only referenced in the file that defines
them can be declared 'static' to avoid namespace pollution,
to produce better object code, and to make the source more
readable.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/Makefile                 |  3 +-
 drivers/staging/wilc1000/coreconfigurator.c       |  6 +--
 drivers/staging/wilc1000/host_interface.c         | 28 +++++++----
 drivers/staging/wilc1000/host_interface.h         | 29 ------------
 drivers/staging/wilc1000/linux_mon.c              |  6 +--
 drivers/staging/wilc1000/linux_wlan.c             | 25 +++++-----
 drivers/staging/wilc1000/linux_wlan_sdio.c        |  4 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 58 +++++++++++------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 -
 drivers/staging/wilc1000/wilc_wlan.c              | 26 ++++++----
 10 files changed, 85 insertions(+), 101 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 64c2f1b83dfb..55b2ac2b15a8 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -8,8 +8,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
 		-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
 		-DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
 
-ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \
-		-Wno-unused-function -DWILC_DEBUGFS
+ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS
 #ccflags-y += -DTCP_ACK_FILTER
 
 ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 427adfd295da..28ab89b3a65d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -287,7 +287,7 @@ static inline u16 get_asoc_id(u8 *data)
 	return asoc_id;
 }
 
-u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
+static u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
 {
 	u16 u16index;
 
@@ -315,7 +315,7 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
 
 /* This function gets the current channel information from
  * the 802.11n beacon/probe response frame */
-u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
 {
 	u16 index;
 
@@ -333,7 +333,7 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
 	return 0;  /* no MIB here */
 }
 
-u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
 {
 	/* Extract current channel information from */
 	/* the beacon/probe response frame          */
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 194ca3d3e920..4e9dfb493b9f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -232,7 +232,7 @@ struct join_bss_param {
 static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
 struct host_if_drv *terminated_handle;
 bool g_obtainingIP;
-u8 P2P_LISTEN_STATE;
+static u8 P2P_LISTEN_STATE;
 static struct task_struct *hif_thread_handler;
 static WILC_MsgQueueHandle hif_msg_q;
 static struct semaphore hif_sema_thread;
@@ -256,10 +256,10 @@ static u32 inactive_time;
 static u8 del_beacon;
 
 static u8 *join_req;
-u8 *info_element;
+static u8 *info_element;
 static u8 mode_11i;
-u8 auth_type;
-u32 join_req_size;
+static u8 auth_type;
+static u32 join_req_size;
 static u32 info_element_size;
 static struct host_if_drv *join_req_drv;
 #define REAL_JOIN_REQ 0
@@ -398,7 +398,9 @@ static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv,
 	return s32Error;
 }
 
-s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx);
+
+static s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 {
 
 	s32 s32Error = 0;
@@ -433,7 +435,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 	return s32Error;
 }
 
-s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+static s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 {
 
 	s32 s32Error = 0;
@@ -812,6 +814,9 @@ static s32 Handle_wait_msg_q_empty(void)
 	return 0;
 }
 
+static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
+			   enum scan_event enuEvent);
+
 static s32 Handle_Scan(struct host_if_drv *hif_drv,
 		       struct scan_attr *pstrHostIFscanAttr)
 {
@@ -1484,6 +1489,11 @@ done:
 	return s32Error;
 }
 
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+				       u8 *pu8AssocRespInfo,
+				       u32 u32MaxAssocRespInfoLen,
+				       u32 *pu32RcvdAssocRespInfoLen);
+
 static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
 				    struct rcvd_async_info *pstrRcvdGnrlAsyncInfo)
 {
@@ -2178,7 +2188,7 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)
 
 }
 
-s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
+static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
 {
 	struct wid strWIDList[5];
 	u32 u32WidsCount = 0, s32Error = 0;
@@ -3594,7 +3604,7 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
 	return s32Error;
 }
 
-s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
 					u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen)
 {
 	s32 s32Error = 0;
@@ -4794,7 +4804,7 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
 
 }
 
-s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
 {
 	s32 s32Error = 0;
 	struct host_if_msg msg;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 3df74f1bf9ff..1661eeb0a2e7 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -622,21 +622,6 @@ s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
 s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
 
 /**
- *  @brief              gets a Association Response info
- *  @details
- *  @param[in,out] handle to the wifi driver,
- *                              Message containg assoc. resp info
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-
-s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo,
-					u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
-
-/**
  *  @brief              sets a channel
  *  @details
  *  @param[in,out] handle to the wifi driver,
@@ -887,18 +872,6 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx)
  */
 s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
 
-
-/**
- *  @brief           host_int_get_ipaddress
- *  @details       get IP address on firmware
- *  @param[in]
- *  @return         Error code.
- *  @author		Abdelrahman Sobhy
- *  @date
- *  @version	1.0
- */
-s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
-
 /**
  *  @brief           host_int_remain_on_channel
  *  @details
@@ -948,8 +921,6 @@ s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool
 int host_int_set_wfi_drv_handler(struct host_if_drv *address);
 int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
 
-static s32 Handle_ScanDone(struct host_if_drv *drvHandler, enum scan_event enuEvent);
-
 void host_int_freeJoinParams(void *pJoinParams);
 
 s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 450af1b77f99..d93594474a2d 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -29,9 +29,9 @@ static struct net_device *wilc_wfi_mon; /* global monitor netdev */
 extern int  mac_xmit(struct sk_buff *skb, struct net_device *dev);
 
 
-u8 srcAdd[6];
-u8 bssid[6];
-u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+static u8 srcAdd[6];
+static u8 bssid[6];
+static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 /**
  *  @brief      WILC_WFI_monitor_rx
  *  @details
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index b879b8be0f3f..1b496e84100e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -239,9 +239,8 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 	}
 	return IRQ_WAKE_THREAD;
 }
-#endif
 
-irqreturn_t isr_bh_routine(int irq, void *userdata)
+static irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
 	struct wilc *nic;
 
@@ -259,7 +258,6 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
 	return IRQ_HANDLED;
 }
 
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
 static int init_irq(struct wilc *p_nic)
 {
 	int ret = 0;
@@ -358,7 +356,7 @@ void linux_wlan_mac_indicate(int flag)
 
 }
 
-struct net_device *GetIfHandler(u8 *pMacHeader)
+static struct net_device *GetIfHandler(u8 *pMacHeader)
 {
 	u8 *Bssid, *Bssid1;
 	int i = 0;
@@ -551,7 +549,7 @@ _fail_:
 }
 
 #ifdef COMPLEMENT_BOOT
-int repeat_power_cycle(perInterface_wlan_t *nic);
+static int repeat_power_cycle(perInterface_wlan_t *nic);
 #endif
 
 static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
@@ -944,7 +942,7 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 	}
 }
 
-int wlan_init_locks(struct wilc *p_nic)
+static int wlan_init_locks(struct wilc *p_nic)
 {
 
 	PRINT_D(INIT_DBG, "Initializing Locks ...\n");
@@ -977,7 +975,8 @@ static int wlan_deinit_locks(struct wilc *nic)
 
 	return 0;
 }
-void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
+
+static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
 {
 
 	PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
@@ -1003,7 +1002,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
 #endif
 }
 
-int wlan_initialize_threads(perInterface_wlan_t *nic)
+static int wlan_initialize_threads(perInterface_wlan_t *nic)
 {
 
 	int ret = 0;
@@ -1053,7 +1052,7 @@ extern u8 core_11b_ready(void);
 
 #define READY_CHECK_THRESHOLD		30
 extern void wilc_wlan_global_reset(void);
-u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
+static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 {
 	u8 trials = 0;
 
@@ -1086,7 +1085,7 @@ u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 
 }
 
-int repeat_power_cycle(perInterface_wlan_t *nic)
+static int repeat_power_cycle(perInterface_wlan_t *nic)
 {
 	int ret = 0;
 	wilc_wlan_inp_t nwi;
@@ -1265,7 +1264,7 @@ _fail_locks_:
  *      - this function will be called automatically by OS when module inserted.
  */
 
-int mac_init_fn(struct net_device *ndev)
+static int mac_init_fn(struct net_device *ndev)
 {
 
 	/*Why we do this !!!*/
@@ -1351,7 +1350,7 @@ _err_:
 	return ret;
 }
 
-struct net_device_stats *mac_stats(struct net_device *dev)
+static struct net_device_stats *mac_stats(struct net_device *dev)
 {
 	perInterface_wlan_t *nic = netdev_priv(dev);
 
@@ -1554,7 +1553,7 @@ int mac_close(struct net_device *ndev)
 	return 0;
 }
 
-int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
+static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 {
 
 	u8 *buff = NULL;
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index ebacd297abca..96558accf877 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -37,14 +37,14 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
 };
 
 
+#ifndef WILC_SDIO_IRQ_GPIO
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
-#ifndef WILC_SDIO_IRQ_GPIO
 	sdio_release_host(func);
 	wilc_handle_isr();
 	sdio_claim_host(func);
-#endif
 }
+#endif
 
 
 int linux_sdio_cmd52(sdio_cmd52_t *cmd)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 18e40e515a48..c54c9fce41e7 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -27,10 +27,10 @@ extern u16 Set_machw_change_vir_if(bool bValue);
 extern int mac_open(struct net_device *ndev);
 extern int mac_close(struct net_device *ndev);
 
-tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
-u32 u32LastScannedNtwrksCountShadow;
+static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
+static u32 u32LastScannedNtwrksCountShadow;
 struct timer_list hDuringIpTimer;
-struct timer_list hAgingTimer;
+static struct timer_list hAgingTimer;
 static u8 op_ifcs;
 extern u8 u8ConnectedSSID[6];
 
@@ -93,15 +93,15 @@ struct p2p_mgmt_data {
 };
 
 /*Global variable used to state the current  connected STA channel*/
-u8 u8WLANChannel = INVALID_CHANNEL;
+static u8 u8WLANChannel = INVALID_CHANNEL;
 
-u8 curr_channel;
+static u8 curr_channel;
 
-u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
-u8 u8P2Plocalrandom = 0x01;
-u8 u8P2Precvrandom = 0x00;
-u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
-bool bWilc_ie;
+static u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
+static u8 u8P2Plocalrandom = 0x01;
+static u8 u8P2Precvrandom = 0x00;
+static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
+static bool bWilc_ie;
 
 static struct ieee80211_supported_band WILC_WFI_band_2ghz = {
 	.channels = WILC_WFI_2ghz_channels,
@@ -116,19 +116,19 @@ struct add_key_params {
 	bool pairwise;
 	u8 *mac_addr;
 };
-struct add_key_params g_add_gtk_key_params;
-struct wilc_wfi_key g_key_gtk_params;
-struct add_key_params g_add_ptk_key_params;
-struct wilc_wfi_key g_key_ptk_params;
-struct wilc_wfi_wep_key g_key_wep_params;
-bool g_ptk_keys_saved;
-bool g_gtk_keys_saved;
-bool g_wep_keys_saved;
+static struct add_key_params g_add_gtk_key_params;
+static struct wilc_wfi_key g_key_gtk_params;
+static struct add_key_params g_add_ptk_key_params;
+static struct wilc_wfi_key g_key_ptk_params;
+static struct wilc_wfi_wep_key g_key_wep_params;
+static bool g_ptk_keys_saved;
+static bool g_gtk_keys_saved;
+static bool g_wep_keys_saved;
 
 #define AGING_TIME	(9 * 1000)
 #define duringIP_TIME 15000
 
-void clear_shadow_scan(void *pUserVoid)
+static void clear_shadow_scan(void *pUserVoid)
 {
 	int i;
 
@@ -150,7 +150,7 @@ void clear_shadow_scan(void *pUserVoid)
 
 }
 
-u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
+static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
 {
 	u8 i;
 	int rssi_v = 0;
@@ -163,7 +163,7 @@ u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
 	return rssi_v;
 }
 
-void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)
+static void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)
 {
 	struct wilc_priv *priv;
 	struct wiphy *wiphy;
@@ -203,7 +203,7 @@ void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)
 
 }
 
-void reset_shadow_found(void *pUserVoid)
+static void reset_shadow_found(void *pUserVoid)
 {
 	int i;
 
@@ -213,7 +213,7 @@ void reset_shadow_found(void *pUserVoid)
 	}
 }
 
-void update_scan_time(void *pUserVoid)
+static void update_scan_time(void *pUserVoid)
 {
 	int i;
 
@@ -259,7 +259,7 @@ static void clear_duringIP(unsigned long arg)
 	g_obtainingIP = false;
 }
 
-int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
+static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
 {
 	int state = -1;
 	int i;
@@ -282,7 +282,7 @@ int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
 	return state;
 }
 
-void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
+static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
 {
 	int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
 	u32 ap_index = 0;
@@ -1759,7 +1759,7 @@ static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
  *  @version
  */
 
-void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
+static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
 {
 	u32 index = 0;
 	u32 i = 0, j = 0;
@@ -1811,7 +1811,7 @@ void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
  *  @date	12 DEC 2012
  *  @version
  */
-void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
+static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
 {
 	u32 index = 0;
 	u32 i = 0, j = 0;
@@ -2142,7 +2142,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
  *  @date	01 JAN 2014
  *  @version	1.0
  */
-void WILC_WFI_add_wilcvendorspec(u8 *buff)
+static void WILC_WFI_add_wilcvendorspec(u8 *buff)
 {
 	memcpy(buff, u8P2P_vendorspec, sizeof(u8P2P_vendorspec));
 }
@@ -3259,7 +3259,7 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
  *  @date	01 MAR 2012
  *  @version	1.0
  */
-struct wireless_dev *WILC_WFI_CfgAlloc(void)
+static struct wireless_dev *WILC_WFI_CfgAlloc(void)
 {
 
 	struct wireless_dev *wdev;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 39cd8e1b5675..e7ea397644de 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -90,7 +90,6 @@ static const struct ieee80211_txrx_stypes
 #define WILC_WFI_DWELL_PASSIVE 100
 #define WILC_WFI_DWELL_ACTIVE  40
 
-struct wireless_dev *WILC_WFI_CfgAlloc(void);
 struct wireless_dev *wilc_create_wiphy(struct net_device *net);
 void wilc_free_wiphy(struct net_device *net);
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index c8564249092c..83fd41a4f521 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -82,7 +82,9 @@ typedef struct {
 
 static wilc_wlan_dev_t g_wlan;
 
+#ifdef WILC_OPTIMIZE_SLEEP_INT
 static inline void chip_allow_sleep(void);
+#endif
 static inline void chip_wakeup(void);
 /********************************************
  *
@@ -138,6 +140,7 @@ static inline void release_bus(BUS_RELEASE_T release)
  *
  ********************************************/
 
+#ifdef TCP_ACK_FILTER
 static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
 {
 
@@ -160,6 +163,7 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
 	p->txq_entries -= 1;
 
 }
+#endif
 
 static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void)
 {
@@ -273,19 +277,19 @@ typedef struct {
 
 
 
-struct Ack_session_info *Free_head;
-struct Ack_session_info *Alloc_head;
+static struct Ack_session_info *Free_head;
+static struct Ack_session_info *Alloc_head;
 
 #define NOT_TCP_ACK			(-1)
 
 #define MAX_TCP_SESSION		25
 #define MAX_PENDING_ACKS		256
-struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION];
-Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS];
+static struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION];
+static Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS];
 
-u32 PendingAcks_arrBase;
-u32 Opened_TCP_session;
-u32 Pending_Acks;
+static u32 PendingAcks_arrBase;
+static u32 Opened_TCP_session;
+static u32 Pending_Acks;
 
 
 
@@ -449,17 +453,19 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
 }
 #endif
 
-bool EnableTCPAckFilter = false;
+static bool EnableTCPAckFilter = false;
 
 void Enable_TCP_ACK_Filter(bool value)
 {
 	EnableTCPAckFilter = value;
 }
 
-bool is_TCP_ACK_Filter_Enabled(void)
+#ifdef TCP_ACK_FILTER
+static bool is_TCP_ACK_Filter_Enabled(void)
 {
 	return EnableTCPAckFilter;
 }
+#endif
 
 static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
 {
@@ -1834,7 +1840,7 @@ void wilc_bus_set_default_speed(void)
 	/* Restore bus speed to default.  */
 	g_wlan.hif_func.hif_set_default_bus_speed();
 }
-u32 init_chip(void)
+static u32 init_chip(void)
 {
 	u32 chipid;
 	u32 reg, ret = 0;
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252341 — [PATCH 12/19] staging/wilc1000: use device pointer for phy creation

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-21 01:00 +0200
Subject[PATCH 12/19] staging/wilc1000: use device pointer for phy creation
Message-ID<qlO2U-10k-49@gated-at.bofh.it>
In reply to#1252310
wilc_create_wiphy tries to get a pointer to a device from the
global wilc1000_sdio_func variable. This is a layering violation
and we can use the wilc1000_dev->dev pointer instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/wilc1000/linux_wlan.c             | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 ++-------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +-
 drivers/staging/wilc1000/wilc_wlan.h              | 1 +
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index aa6f5c7db139..abcb70bb1bd7 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1638,7 +1638,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
 		{
 			struct wireless_dev *wdev;
 			/*Register WiFi*/
-			wdev = wilc_create_wiphy(ndev);
+			wdev = wilc_create_wiphy(ndev, wilc1000_dev->dev);
 
 			/* set netdev, tony */
 			if (dev)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 702c40c1df4b..7405fb8bae42 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -11,9 +11,6 @@
  */
 
 #include "wilc_wfi_cfgoperations.h"
-#ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"
-#endif
 #include "host_interface.h"
 #include <linux/errno.h>
 
@@ -3379,7 +3376,7 @@ _fail_:
  *  @date	01 MAR 2012
  *  @version	1.0
  */
-struct wireless_dev *wilc_create_wiphy(struct net_device *net)
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev)
 {
 	struct wilc_priv *priv;
 	struct wireless_dev *wdev;
@@ -3431,9 +3428,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net)
 		   wdev->wiphy->max_scan_ssids, wdev->wiphy->max_scan_ie_len, wdev->wiphy->signal_type,
 		   wdev->wiphy->interface_modes, wdev->iftype);
 
-	#ifdef WILC_SDIO
-	set_wiphy_dev(wdev->wiphy, &wilc1000_sdio_func->dev);
-	#endif
+	set_wiphy_dev(wdev->wiphy, dev);
 
 	/*Register wiphy structure*/
 	s32Error = wiphy_register(wdev->wiphy);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 158d98c0eb87..ab53d9d59081 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,7 +10,7 @@
 #define NM_WFI_CFGOPERATIONS
 #include "wilc_wfi_netdevice.h"
 
-struct wireless_dev *wilc_create_wiphy(struct net_device *net);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev);
 void wilc_free_wiphy(struct net_device *net);
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
 int wilc_deinit_host_int(struct net_device *net);
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 8c5253cce97c..2297e31b5b75 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -2,6 +2,7 @@
 #define WILC_WLAN_H
 
 #include <linux/types.h>
+#include <linux/netdevice.h>
 
 #define ISWILC1000(id)   (((id & 0xfffff000) == 0x100000) ? 1 : 0)
 
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1252659

Fromglen lee <glen.lee@atmel.com>
Date2015-10-21 12:10 +0200
Message-ID<qlYvh-8ai-29@gated-at.bofh.it>
In reply to#1252310
Hi arnd,

Thanks for the all the patches. :)
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for
other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.

And the global variable g_linux_wlan will be placed in netdevice private data
and finally it will be removed. I already posted some of those patches.

Thanks,
Glen.


On 2015년 10월 21일 07:47, Arnd Bergmann wrote:
> After I screwed up two or three times trying to get the dependencies
> with the SPI and SDIO backends right, I ended up taking the time
> to do the real fix and make both coexist.
>
> This is a series of patches that address various issues with the
> driver, but is mainly targetted at splitting out the spi and sdio
> backends into separate drivers that can be built independent of
> one another.
>
> The last patch is more experimental than the others, hence the
> [RFC] annotation.
>
> Please review and test.
>
> 	Arnd
>
> Arnd Bergmann (19):
>    staging/wilc1000: remove unused functions
>    staging/wilc1000: make symbols static if possible
>    staging/wilc1000: use proper naming for global symbols
>    staging/wilc1000: move extern declarations to headers
>    staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT
>    staging/wilc1000: avoid static definitions in header
>    staging/wilc1000: remove linux_wlan_{device_power,device_detection}
>    staging/wilc1000: move wilc_wlan_inp_t into struct wilc
>    staging/wilc1000: move init/exit functions to driver files
>    staging/wilc1000: unify device pointer
>    staging/wilc1000: move wilc1000_ops to drivers
>    staging/wilc1000: use device pointer for phy creation
>    staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c
>    staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
>    staging/wilc1000: turn enable_irq/disable_irq into callbacks
>    staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
>    staging/wilc1000: pass hif operations through initialization
>    staging/wilc1000: split out bus specific modules
>    [RFC] staging/wilc1000: use more regular probing
>
>   drivers/staging/wilc1000/Kconfig                  |  66 +-
>   drivers/staging/wilc1000/Makefile                 |  16 +-
>   drivers/staging/wilc1000/coreconfigurator.c       |  12 +-
>   drivers/staging/wilc1000/coreconfigurator.h       |  12 +-
>   drivers/staging/wilc1000/host_interface.c         | 501 +++-------------
>   drivers/staging/wilc1000/host_interface.h         | 349 ++---------
>   drivers/staging/wilc1000/linux_mon.c              |  11 +-
>   drivers/staging/wilc1000/linux_wlan.c             | 695 +++++++---------------
>   drivers/staging/wilc1000/linux_wlan_common.h      |  18 +-
>   drivers/staging/wilc1000/linux_wlan_sdio.c        | 202 +++++--
>   drivers/staging/wilc1000/linux_wlan_sdio.h        |  14 -
>   drivers/staging/wilc1000/linux_wlan_spi.c         | 119 ++--
>   drivers/staging/wilc1000/linux_wlan_spi.h         |   8 -
>   drivers/staging/wilc1000/wilc_debugfs.c           |  20 +-
>   drivers/staging/wilc1000/wilc_sdio.c              | 213 +++----
>   drivers/staging/wilc1000/wilc_spi.c               | 276 +--------
>   drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 495 +++++++--------
>   drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  87 +--
>   drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  21 +-
>   drivers/staging/wilc1000/wilc_wlan.c              | 180 +++---
>   drivers/staging/wilc1000/wilc_wlan.h              |  49 +-
>   drivers/staging/wilc1000/wilc_wlan_cfg.c          |   6 +-
>   drivers/staging/wilc1000/wilc_wlan_if.h           |  23 +-
>   23 files changed, 1171 insertions(+), 2222 deletions(-)
>   delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web