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


Groups > linux.kernel > #1270206 > unrolled thread

[PATCH 00/19 v5] staging/wilc1000 cleanups

Started byArnd Bergmann <arnd@arndb.de>
First post2015-11-16 15:20 +0100
Last post2015-11-16 15:20 +0100
Articles 7 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/19 v5] staging/wilc1000 cleanups Arnd Bergmann <arnd@arndb.de> - 2015-11-16 15:20 +0100
    [PATCH 16/19] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros Arnd Bergmann <arnd@arndb.de> - 2015-11-16 15:20 +0100
    [PATCH 18/19] staging/wilc1000: use more regular probing Arnd Bergmann <arnd@arndb.de> - 2015-11-16 15:20 +0100
    [PATCH 17/19] staging/wilc1000: split out bus specific modules Arnd Bergmann <arnd@arndb.de> - 2015-11-16 15:20 +0100
    [PATCH 13/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO Arnd Bergmann <arnd@arndb.de> - 2015-11-16 15:20 +0100
    [PATCH 02/19] staging/wilc1000: make symbols static if possible Arnd Bergmann <arnd@arndb.de> - 2015-11-16 15:20 +0100
    [PATCH 07/19] staging/wilc1000: remove linux_wlan_{device_power,device_detection} Arnd Bergmann <arnd@arndb.de> - 2015-11-16 15:20 +0100

#1270206 — [PATCH 00/19 v5] staging/wilc1000 cleanups

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-16 15:20 +0100
Subject[PATCH 00/19 v5] staging/wilc1000 cleanups
Message-ID<qvsDL-8kq-3@gated-at.bofh.it>
As suggested by Glen Lee, I'm sending the patches once more with the
two one-line fixes in "staging/wilc1000: pass hif operations through
initialization".

I have rebased on top of today's staging-testing, but no other changes
were necessary, so this is otherwise identical to the version that
Glen has successfully tested.

Please disregard the earlier version and apply this one.

	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: pass io_type to wilc_netdev_init
  staging/wilc1000: use device pointer for phy creation
  staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
  staging/wilc1000: pass hif operations through initialization
  staging/wilc1000: turn enable_irq/disable_irq into callbacks
  staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
  staging/wilc1000: split out bus specific modules
  staging/wilc1000: use more regular probing
  staging/wilc1000: pass struct wilc to most linux_wlan.c functions

 drivers/staging/wilc1000/Kconfig                  |  66 +--
 drivers/staging/wilc1000/Makefile                 |  14 +-
 drivers/staging/wilc1000/coreconfigurator.c       |  14 +-
 drivers/staging/wilc1000/coreconfigurator.h       |  16 +-
 drivers/staging/wilc1000/host_interface.c         | 591 ++++++----------------
 drivers/staging/wilc1000/host_interface.h         | 118 ++---
 drivers/staging/wilc1000/linux_mon.c              |  11 +-
 drivers/staging/wilc1000/linux_wlan.c             | 374 +++++---------
 drivers/staging/wilc1000/linux_wlan_common.h      |  22 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c        | 122 ++---
 drivers/staging/wilc1000/linux_wlan_sdio.h        |  19 +-
 drivers/staging/wilc1000/linux_wlan_spi.c         | 117 ++---
 drivers/staging/wilc1000/linux_wlan_spi.h         |  14 +-
 drivers/staging/wilc1000/wilc_debugfs.c           |  26 +-
 drivers/staging/wilc1000/wilc_sdio.c              | 254 ++++------
 drivers/staging/wilc1000/wilc_spi.c               | 293 ++---------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 443 ++++++++--------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  87 +---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  40 +-
 drivers/staging/wilc1000/wilc_wlan.c              | 232 ++++-----
 drivers/staging/wilc1000/wilc_wlan.h              |  40 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c          |   6 +-
 drivers/staging/wilc1000/wilc_wlan_if.h           |  11 +-
 23 files changed, 1047 insertions(+), 1883 deletions(-)

-- 
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]


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

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-16 15:20 +0100
Subject[PATCH 16/19] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
Message-ID<qvsNs-8o3-27@gated-at.bofh.it>
In reply to#1270206
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 fe480c76c521..dcba27bd3bce 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 5e37ec65d3bb..f72f976906cc 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1067,7 +1067,10 @@ static void wilc_pllupdate_isr_ext(u32 int_stats)
 
 	g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR);
 
-	mdelay(WILC_PLL_TO);
+	if (g_wlan.io_type == HIF_SDIO)
+		mdelay(WILC_PLL_TO_SDIO);
+	else
+		mdelay(WILC_PLL_TO_SPI);
 
 	while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) {
 		PRINT_D(TX_DBG, "PLL update retrying\n");
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 44a590f80def..90ef650e722d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -134,11 +134,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]


#1270216 — [PATCH 18/19] staging/wilc1000: use more regular probing

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-16 15:20 +0100
Subject[PATCH 18/19] staging/wilc1000: use more regular probing
Message-ID<qvsNs-8o3-37@gated-at.bofh.it>
In reply to#1270206
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 wilc_sdio_func and wilc_spi_dev
variables in favor of retrieving them from the wilc_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        |   6 +-
 drivers/staging/wilc1000/linux_wlan_common.h |  12 ---
 drivers/staging/wilc1000/linux_wlan_sdio.c   |  30 +++----
 drivers/staging/wilc1000/linux_wlan_spi.c    | 122 +++++++++------------------
 drivers/staging/wilc1000/wilc_debugfs.c      |   6 +-
 5 files changed, 58 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 0d6c22ca7920..c3b521e085f2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1408,10 +1408,6 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 	}
 
 	kfree(wilc);
-
-#if defined(WILC_DEBUGFS)
-	wilc_debugfs_remove();
-#endif
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
 
@@ -1491,3 +1487,5 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h
index f2ea8280b8f8..72b524a98cba 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -38,9 +38,6 @@ enum debug_region {
 #define FIRM_DBG                (1 << Firmware_debug)
 
 #if defined (WILC_DEBUGFS)
-int wilc_debugfs_init(void);
-void wilc_debugfs_remove(void);
-
 extern atomic_t WILC_REGION;
 extern atomic_t WILC_DEBUG_LEVEL;
 
@@ -122,15 +119,6 @@ extern atomic_t WILC_DEBUG_LEVEL;
 		printk(__VA_ARGS__);					\
 	} while (0)
 
-static inline int wilc_debugfs_init(void)
-{
-	return 0;
-}
-
-static inline void wilc_debugfs_remove(void)
-{
-}
-
 #endif
 
 #define FN_IN   /* PRINT_D(">>> \n") */
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 9072de43bcd9..1f366b5f0d2d 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -135,12 +135,14 @@ static void linux_sdio_remove(struct sdio_func *func)
 	wilc_netdev_cleanup(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");
 
 int wilc_sdio_enable_interrupt(struct wilc *dev)
 {
@@ -178,14 +180,15 @@ void wilc_sdio_disable_interrupt(struct wilc *dev)
 static int linux_sdio_set_speed(int speed)
 {
 	struct mmc_ios ios;
+	struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev);
 
-	sdio_claim_host(wilc_sdio_func);
+	sdio_claim_host(func);
 
-	memcpy((void *)&ios, (void *)&wilc_sdio_func->card->host->ios, sizeof(struct mmc_ios));
-	wilc_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;
-	wilc_sdio_func->card->host->ops->set_ios(wilc_sdio_func->card->host, &ios);
-	sdio_release_host(wilc_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;
@@ -193,7 +196,8 @@ static int linux_sdio_set_speed(int speed)
 
 static int linux_sdio_get_speed(void)
 {
-	return wilc_sdio_func->card->host->ios.clock;
+	struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev);
+	return func->card->host->ios.clock;
 }
 
 int wilc_sdio_init(void)
@@ -218,16 +222,4 @@ int wilc_sdio_set_default_speed(void)
 	return linux_sdio_set_speed(sdio_default_speed);
 }
 
-static int __init init_wilc_sdio_driver(void)
-{
-	return sdio_register_driver(&wilc_bus);
-}
-late_initcall(init_wilc_sdio_driver);
-
-static void __exit exit_wilc_sdio_driver(void)
-{
-	sdio_unregister_driver(&wilc_bus);
-}
-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 a7a52593156a..1d8922d6eb6a 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 "linux_wlan_spi.h"
 #include "wilc_wfi_netdevice.h"
@@ -43,59 +44,53 @@
 
 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)
+static int wilc_bus_probe(struct spi_device *spi)
 {
+	int ret, gpio;
+	struct wilc *wilc;
 
-	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(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
+	if (ret)
+		return ret;
+
+	spi_set_drvdata(spi, wilc);
+	wilc->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_cleanup(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
 
-static struct spi_driver wilc_bus __refdata = {
+struct spi_driver wilc1000_spi_driver = {
 	.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");
 
 int wilc_spi_init(void)
 {
-	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)
@@ -106,6 +101,7 @@ int wilc_spi_init(void)
 
 int wilc_spi_write(u8 *b, u32 len)
 {
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 
 	if (len > 0 && b != NULL) {
@@ -132,11 +128,11 @@ int wilc_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");
 				}
@@ -157,11 +153,11 @@ int wilc_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");
 			}
@@ -183,7 +179,7 @@ int wilc_spi_write(u8 *b, u32 len)
 #else
 int wilc_spi_write(u8 *b, u32 len)
 {
-
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 	struct spi_message msg;
 
@@ -204,12 +200,12 @@ int wilc_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");
 		}
@@ -234,6 +230,7 @@ int wilc_spi_write(u8 *b, u32 len)
 
 int wilc_spi_read(u8 *rb, u32 rlen)
 {
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 
 	if (rlen > 0) {
@@ -260,11 +257,11 @@ int wilc_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");
 				}
@@ -284,11 +281,11 @@ int wilc_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");
 			}
@@ -308,7 +305,7 @@ int wilc_spi_read(u8 *rb, u32 rlen)
 #else
 int wilc_spi_read(u8 *rb, u32 rlen)
 {
-
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 
 	if (rlen > 0) {
@@ -329,12 +326,12 @@ int wilc_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");
 		}
@@ -353,7 +350,7 @@ int wilc_spi_read(u8 *rb, u32 rlen)
 
 int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 {
-
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 
 	if (rlen > 0) {
@@ -370,11 +367,11 @@ int wilc_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");
 		}
@@ -395,40 +392,3 @@ int wilc_spi_set_max_speed(void)
 	PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED);
 	return 1;
 }
-
-static struct wilc *wilc;
-
-static int __init init_wilc_spi_driver(void)
-{
-	int ret;
-
-	wilc_debugfs_init();
-
-	ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
-	if (ret) {
-		wilc_debugfs_remove();
-		return ret;
-	}
-
-	if (!wilc_spi_init() || !wilc_spi_dev) {
-		PRINT_ER("Can't initialize SPI\n");
-		wilc_netdev_cleanup(wilc);
-		wilc_debugfs_remove();
-		return -ENXIO;
-	}
-	wilc_dev->dev = &wilc_spi_dev->dev;
-
-	return ret;
-}
-late_initcall(init_wilc_spi_driver);
-
-static void __exit exit_wilc_spi_driver(void)
-{
-	if (wilc)
-		wilc_netdev_cleanup(wilc);
-	spi_unregister_driver(&wilc_bus);
-	wilc_debugfs_remove();
-}
-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 158a1df17195..27c653a0cdf9 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -138,7 +138,7 @@ static struct wilc_debugfs_info_t debugfs_info[] = {
 	{ "wilc_debug_region",	0666,	(INIT_DBG | GENERIC_DBG | CFG80211_DBG), FOPS(NULL, wilc_debug_region_read, wilc_debug_region_write, NULL), },
 };
 
-int wilc_debugfs_init(void)
+static int __init wilc_debugfs_init(void)
 {
 	int i;
 
@@ -173,11 +173,13 @@ int wilc_debugfs_init(void)
 	}
 	return 0;
 }
+module_init(wilc_debugfs_init);
 
-void wilc_debugfs_remove(void)
+static void __exit wilc_debugfs_remove(void)
 {
 	debugfs_remove_recursive(wilc_dir);
 }
+module_exit(wilc_debugfs_remove);
 
 #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]


#1270217 — [PATCH 17/19] staging/wilc1000: split out bus specific modules

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-16 15:20 +0100
Subject[PATCH 17/19] staging/wilc1000: split out bus specific modules
Message-ID<qvsNs-8o3-39@gated-at.bofh.it>
In reply to#1270206
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       |  7 +++-
 drivers/staging/wilc1000/linux_wlan.c   |  4 ++
 drivers/staging/wilc1000/wilc_debugfs.c |  2 +
 drivers/staging/wilc1000/wilc_wlan.c    |  1 +
 5 files changed, 40 insertions(+), 40 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 dcba27bd3bce..198d536da57c 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -21,5 +21,8 @@ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
 			wilc_wlan_cfg.o wilc_debugfs.o \
 			wilc_wlan.o
 
-wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o wilc_sdio.o
-wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o wilc_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 1b6e1eec2446..0d6c22ca7920 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -44,6 +44,8 @@ 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);
 struct wilc *wilc_dev;
+EXPORT_SYMBOL_GPL(wilc_dev);
+
 bool wilc_enable_ps = true;
 
 static const struct net_device_ops wilc_netdev_ops = {
@@ -1411,6 +1413,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 	wilc_debugfs_remove();
 #endif
 }
+EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
 
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 		     int gpio, const struct wilc_hif_func *ops)
@@ -1487,3 +1490,4 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(wilc_netdev_init);
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index d70f96f475b8..158a1df17195 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 WILC_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
+EXPORT_SYMBOL_GPL(WILC_REGION);
 atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
+EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
 
 /*
  * --------------------------------------------------------------------------------
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index f72f976906cc..a71901c22653 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1181,6 +1181,7 @@ void wilc_handle_isr(void *wilc)
 	}
 	release_bus(RELEASE_ALLOW_SLEEP);
 }
+EXPORT_SYMBOL_GPL(wilc_handle_isr);
 
 int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size)
 {
-- 
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]


#1270218 — [PATCH 13/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-16 15:20 +0100
Subject[PATCH 13/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
Message-ID<qvsNs-8o3-41@gated-at.bofh.it>
In reply to#1270206
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         |  69 ++++++++---------
 drivers/staging/wilc1000/linux_wlan_sdio.c    |  18 ++---
 drivers/staging/wilc1000/linux_wlan_spi.c     |   2 +-
 drivers/staging/wilc1000/wilc_sdio.c          | 105 +++++++++++---------------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   7 +-
 drivers/staging/wilc1000/wilc_wlan.c          |   8 +-
 7 files changed, 92 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 9696f69bda48..fe480c76c521 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 08c3be8728b2..e81e90678d0f 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -161,7 +161,6 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
 	return NOTIFY_DONE;
 }
 
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
 	perInterface_wlan_t *nic;
@@ -207,9 +206,9 @@ static int init_irq(struct net_device *dev)
 	nic = netdev_priv(dev);
 	wl = nic->wilc;
 
-	if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) &&
-	    (gpio_direction_input(GPIO_NUM) == 0)) {
-		wl->dev_irq_num = gpio_to_irq(GPIO_NUM);
+	if ((gpio_request(wl->gpio, "WILC_INTR") == 0) &&
+	    (gpio_direction_input(wl->gpio) == 0)) {
+		wl->dev_irq_num = gpio_to_irq(wl->gpio);
 	} else {
 		ret = -1;
 		PRINT_ER("could not obtain gpio for WILC_INTR\n");
@@ -220,16 +219,16 @@ static int init_irq(struct net_device *dev)
 					      isr_bh_routine,
 					      IRQF_TRIGGER_LOW | IRQF_ONESHOT,
 					      "WILC_IRQ", dev) < 0) {
-		PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
+		PRINT_ER("Failed to request IRQ for GPIO: %d\n", wl->gpio);
+		gpio_free(wl->gpio);
 		ret = -1;
 	} else {
 		PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n",
-			wl->dev_irq_num, GPIO_NUM);
+			wl->dev_irq_num, wl->gpio);
 	}
 
 	return ret;
 }
-#endif
 
 static void deinit_irq(struct net_device *dev)
 {
@@ -239,13 +238,11 @@ static void deinit_irq(struct net_device *dev)
 	nic = netdev_priv(dev);
 	wilc = nic->wilc;
 
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
-	if (&wilc->dev_irq_num != 0) {
+	/* Deintialize IRQ */
+	if (wilc->dev_irq_num) {
 		free_irq(wilc->dev_irq_num, wilc);
-
-		gpio_free(GPIO_NUM);
+		gpio_free(wilc->gpio);
 	}
-#endif
 }
 
 void linux_wlan_dbg(u8 *buff)
@@ -742,11 +739,11 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 #endif
 
 		PRINT_D(INIT_DBG, "Disabling IRQ\n");
-#ifdef WILC_SDIO
-		mutex_lock(&wl->hif_cs);
-		wilc_sdio_disable_interrupt();
-		mutex_unlock(&wl->hif_cs);
-#endif
+		if (!wl->dev_irq_num) {
+			mutex_lock(&wl->hif_cs);
+			wilc_sdio_disable_interrupt();
+			mutex_unlock(&wl->hif_cs);
+		}
 		if (&wl->txq_event)
 			up(&wl->txq_event);
 
@@ -760,14 +757,14 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 
 		PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
 		wilc_wlan_cleanup(dev);
-#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(&wl->hif_cs);
-		wilc_sdio_disable_interrupt();
-		mutex_unlock(&wl->hif_cs);
-  #endif
+#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
+		if (!wl->dev_irq_num) {
+			PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
+
+			mutex_lock(&wl->hif_cs);
+			wilc_sdio_disable_interrupt();
+			mutex_unlock(&wl->hif_cs);
+		}
 #endif
 
 		PRINT_D(INIT_DBG, "Deinitializing Locks\n");
@@ -887,13 +884,11 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 			goto _fail_locks_;
 		}
 
-#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-		if (init_irq(dev)) {
+		if (wl->gpio >= 0 && init_irq(dev)) {
 			PRINT_ER("couldn't initialize IRQ\n");
 			ret = -EIO;
 			goto _fail_locks_;
 		}
-#endif
 
 		ret = wlan_initialize_threads(dev);
 		if (ret < 0) {
@@ -902,13 +897,11 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 			goto _fail_wilc_wlan_;
 		}
 
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-		if (wilc_sdio_enable_interrupt()) {
+		if (!wl->dev_irq_num && wilc_sdio_enable_interrupt()) {
 			PRINT_ER("couldn't initialize IRQ\n");
 			ret = -EIO;
 			goto _fail_irq_init_;
 		}
-#endif
 
 		if (wilc_wlan_get_firmware(dev)) {
 			PRINT_ER("Can't get firmware\n");
@@ -957,14 +950,12 @@ _fail_fw_start_:
 		wilc_wlan_stop();
 
 _fail_irq_enable_:
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-		wilc_sdio_disable_interrupt();
+		if (!wl->dev_irq_num)
+			wilc_sdio_disable_interrupt();
 _fail_irq_init_:
-#endif
-#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-		deinit_irq(dev);
+		if (wl->dev_irq_num)
+			deinit_irq(dev);
 
-#endif
 		wlan_deinitialize_threads(dev);
 _fail_wilc_wlan_:
 		wilc_wlan_cleanup(dev);
@@ -1417,7 +1408,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 #endif
 }
 
-int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type)
+int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, int gpio)
 {
 	int i;
 	perInterface_wlan_t *nic;
@@ -1431,6 +1422,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type)
 
 	*wilc = wilc_dev;
 	wilc_dev->io_type = io_type;
+	wilc_dev->gpio = gpio;
+
 	register_inetaddr_notifier(&g_dev_notifier);
 
 	for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 874a859cad21..732b0d66366b 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -6,6 +6,7 @@
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/host.h>
+#include <linux/of_gpio.h>
 
 
 
@@ -34,15 +35,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_get_drvdata(func));
 	sdio_claim_host(func);
 }
-#endif
-
 
 int wilc_sdio_cmd52(sdio_cmd52_t *cmd)
 {
@@ -110,11 +108,18 @@ int wilc_sdio_cmd53(sdio_cmd53_t *cmd)
 static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
 {
 	struct wilc *wilc;
+	int gpio;
 
+	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");
 	wilc_sdio_func = func;
-	if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO)) {
+	if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio)) {
 		PRINT_ER("Couldn't initialize netdev\n");
 		return -1;
 	}
@@ -140,7 +145,6 @@ static struct sdio_driver wilc_bus = {
 int wilc_sdio_enable_interrupt(void)
 {
 	int ret = 0;
-#ifndef WILC_SDIO_IRQ_GPIO
 
 	sdio_claim_host(wilc_sdio_func);
 	ret = sdio_claim_irq(wilc_sdio_func, wilc_sdio_interrupt);
@@ -150,14 +154,11 @@ int wilc_sdio_enable_interrupt(void)
 		PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
 		ret = -EIO;
 	}
-#endif
 	return ret;
 }
 
 void wilc_sdio_disable_interrupt(void)
 {
-
-#ifndef WILC_SDIO_IRQ_GPIO
 	int ret;
 
 	PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt IN\n");
@@ -170,7 +171,6 @@ void wilc_sdio_disable_interrupt(void)
 	sdio_release_host(wilc_sdio_func);
 
 	PRINT_D(INIT_DBG, "wilc_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 a459c502a8a8..f4dda4a6fa7b 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -404,7 +404,7 @@ static int __init init_wilc_spi_driver(void)
 
 	wilc_debugfs_init();
 
-	ret = wilc_netdev_init(&wilc, NULL, HIF_SPI);
+	ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM);
 	if (ret) {
 		wilc_debugfs_remove();
 		return ret;
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 7fca3b23b485..8441fcccccc4 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -16,6 +16,7 @@
 #define WILC_SDIO_BLOCK_SIZE 512
 
 typedef struct {
+	bool irq_gpio;
 	u32 block_size;
 	wilc_debug_func dPrint;
 	int nint;
@@ -25,10 +26,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
 
 /********************************************
  *
@@ -131,29 +130,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;
-	wilc_sdio_cmd52(&cmd);
+		cmd.read_write = 0;
+		cmd.function = 1;
+		cmd.raw = 0;
+		cmd.address = 0x4;
+		cmd.data = 0;
+		wilc_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
 
 }
 
@@ -455,8 +454,7 @@ static int sdio_sync(void)
 		return 0;
 	}
 
-#ifdef WILC_SDIO_IRQ_GPIO
-	{
+	if (g_sdio.irq_gpio) {
 		u32 reg;
 		int ret;
 
@@ -490,7 +488,6 @@ static int sdio_sync(void)
 			return 0;
 		}
 	}
-#endif
 
 	return 1;
 }
@@ -504,6 +501,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func)
 	memset(&g_sdio, 0, sizeof(wilc_sdio_t));
 
 	g_sdio.dPrint = func;
+	g_sdio.irq_gpio = (wilc->dev_irq_num);
 
 	if (!wilc_sdio_init()) {
 		g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
@@ -662,36 +660,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;
-	wilc_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;
+		wilc_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;
@@ -704,8 +699,6 @@ static int sdio_read_int(u32 *int_status)
 		tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET);
 	}
 
-#endif
-
 	*int_status = tmp;
 
 	return 1;
@@ -718,16 +711,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);
@@ -754,8 +745,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;
@@ -795,7 +785,6 @@ static int sdio_clear_int_ext(u32 val)
 				}
 			}
 		}
-#endif /* WILC_SDIO_IRQ_GPIO */
 
 		{
 			u32 vmm_ctl;
@@ -862,8 +851,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;
 
@@ -915,7 +903,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 eae9ce175351..92f4cb71608d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -158,10 +158,9 @@ struct wilc_vif {
 struct wilc {
 	int io_type;
 	int mac_status;
+	int gpio;
 	bool initialized;
-	#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-	unsigned short dev_irq_num;
-	#endif
+	int dev_irq_num;
 	int close;
 	u8 vif_num;
 	struct wilc_vif vif[NUM_CONCURRENT_IFC];
@@ -213,7 +212,7 @@ void linux_wlan_rx_complete(void);
 void linux_wlan_dbg(u8 *buff);
 int linux_wlan_lock_timeout(void *vp, u32 timeout);
 void wilc_netdev_cleanup(struct wilc *wilc);
-int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type);
+int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio);
 void wilc1000_wlan_deinit(struct net_device *dev);
 void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
 u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 2958689a13c6..3d53550149fb 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1174,9 +1174,6 @@ void wilc_handle_isr(void *wilc)
 		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);
@@ -1267,9 +1264,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_type == HIF_SDIO && wilc_dev->dev_irq_num)
+		reg |= WILC_HAVE_SDIO_IRQ_GPIO;
 
 #ifdef WILC_DISABLE_PMU
 #else
-- 
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]


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

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-16 15:20 +0100
Subject[PATCH 02/19] staging/wilc1000: make symbols static if possible
Message-ID<qvsNt-8o3-43@gated-at.bofh.it>
In reply to#1270206
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       |  4 +-
 drivers/staging/wilc1000/host_interface.c         | 35 ++++++++------
 drivers/staging/wilc1000/host_interface.h         |  8 ----
 drivers/staging/wilc1000/linux_mon.c              |  6 +--
 drivers/staging/wilc1000/linux_wlan.c             | 19 ++++----
 drivers/staging/wilc1000/linux_wlan_sdio.c        |  4 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 56 +++++++++++------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 -
 drivers/staging/wilc1000/wilc_wlan.c              | 23 ++++++----
 10 files changed, 81 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 650123df0b4c..9696f69bda48 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 fd7240c9da3e..eef06cdcc905 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -285,7 +285,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;
 
@@ -313,7 +313,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;
 
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 6c205b97293d..93bdb224f973 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -234,7 +234,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;
@@ -259,10 +259,10 @@ static u8 del_beacon;
 static u32 clients_count;
 
 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
@@ -396,7 +396,9 @@ static s32 handle_set_operation_mode(struct host_if_drv *hif_drv,
 	return result;
 }
 
-s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx);
+
+static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx)
 {
 	s32 result = 0;
 	struct wid wid;
@@ -430,7 +432,7 @@ s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx)
 	return result;
 }
 
-s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx)
+static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx)
 {
 	s32 result = 0;
 	struct wid wid;
@@ -817,6 +819,9 @@ static void Handle_wait_msg_q_empty(void)
 	up(&hif_sema_wait_response);
 }
 
+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)
 {
@@ -1483,6 +1488,11 @@ done:
 	return result;
 }
 
+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)
 {
@@ -2140,7 +2150,7 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)
 	up(&hif_drv->sem_get_link_speed);
 }
 
-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, result = 0;
@@ -3534,11 +3544,10 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
 	return result;
 }
 
-
-s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
-				u8 *pu8AssocRespInfo,
-				u32 u32MaxAssocRespInfoLen,
-				u32 *pu32RcvdAssocRespInfoLen)
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+				       u8 *pu8AssocRespInfo,
+				       u32 u32MaxAssocRespInfoLen,
+				       u32 *pu32RcvdAssocRespInfoLen)
 {
 	s32 result = 0;
 	struct wid wid;
@@ -4706,7 +4715,7 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
 	return result;
 }
 
-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 result = 0;
 	struct host_if_msg msg;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index c1ed2e236ee2..312da75fc02e 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -338,10 +338,6 @@ s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
 			  u8 u8channel, void *pJoinParams);
 s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
 s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
-s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv,
-				u8 *pu8AssocRespInfo,
-				u32 u32MaxAssocRespInfoLen,
-				u32 *pu32RcvdAssocRespInfoLen);
 int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
 s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
 s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
@@ -379,7 +375,6 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv,
 s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv,
 				  char *pBSSID,
 				  char TID);
-s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
 s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv,
 			       u32 u32SessionID,
 			       u32 u32duration,
@@ -394,9 +389,6 @@ s32 host_int_frame_register(struct host_if_drv *hWFIDrv,
 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,
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 589a11fd977c..2d518acb4af3 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 086f1dbfb157..b95dba74a37d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -225,9 +225,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)
 {
 	perInterface_wlan_t *nic;
 	struct wilc *wilc;
@@ -246,7 +245,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 net_device *dev)
 {
 	int ret = 0;
@@ -333,7 +331,7 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag)
 	}
 }
 
-struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
+static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
 {
 	u8 *bssid, *bssid1;
 	int i = 0;
@@ -839,7 +837,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 	}
 }
 
-int wlan_init_locks(struct net_device *dev)
+static int wlan_init_locks(struct net_device *dev)
 {
 	perInterface_wlan_t *nic;
 	struct wilc *wl;
@@ -884,7 +882,7 @@ static int wlan_deinit_locks(struct net_device *dev)
 	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");
 
@@ -895,7 +893,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
 #endif
 }
 
-int wlan_initialize_threads(struct net_device *dev)
+static int wlan_initialize_threads(struct net_device *dev)
 {
 	perInterface_wlan_t *nic;
 	struct wilc *wilc;
@@ -921,7 +919,6 @@ static void wlan_deinitialize_threads(struct net_device *dev)
 {
 	perInterface_wlan_t *nic;
 	struct wilc *wl;
-
 	nic = netdev_priv(dev);
 	wl = nic->wilc;
 
@@ -1049,7 +1046,7 @@ _fail_locks_:
 	return ret;
 }
 
-int mac_init_fn(struct net_device *ndev)
+static int mac_init_fn(struct net_device *ndev)
 {
 	netif_start_queue(ndev);
 	netif_stop_queue(ndev);
@@ -1131,7 +1128,7 @@ int mac_open(struct net_device *ndev)
 	return 0;
 }
 
-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);
 
@@ -1325,7 +1322,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;
 	s8 rssi;
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 9e8ba04ca9c8..a0640ebe904e 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -39,18 +39,18 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
 };
 
 
+#ifndef WILC_SDIO_IRQ_GPIO
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
 	struct wilc_sdio *wl_sdio;
 
 	wl_sdio = sdio_get_drvdata(func);
 
-#ifndef WILC_SDIO_IRQ_GPIO
 	sdio_release_host(func);
 	wilc_handle_isr(wl_sdio->wilc);
 	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 849f86b5ff30..842f0e4bec97 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -24,10 +24,10 @@
 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];
 
@@ -90,15 +90,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,
@@ -113,19 +113,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;
 
@@ -147,7 +147,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;
@@ -160,7 +160,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;
@@ -200,7 +200,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;
 
@@ -210,7 +210,7 @@ void reset_shadow_found(void *pUserVoid)
 	}
 }
 
-void update_scan_time(void *pUserVoid)
+static void update_scan_time(void *pUserVoid)
 {
 	int i;
 
@@ -256,7 +256,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;
@@ -279,7 +279,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;
@@ -1766,7 +1766,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;
@@ -1818,7 +1818,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;
@@ -3285,7 +3285,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 d7bdca1f4c5b..9f9a9aeb3655 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 f702cca2095a..5c8c59257f58 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -40,7 +40,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);
 static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ;
 
@@ -81,6 +83,7 @@ static inline void release_bus(BUS_RELEASE_T release)
 	mutex_unlock(&g_linux_wlan->hif_cs);
 }
 
+#ifdef TCP_ACK_FILTER
 static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
 {
 	wilc_wlan_dev_t *p = &g_wlan;
@@ -99,6 +102,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(struct net_device *dev)
@@ -209,16 +213,17 @@ struct pending_acks_info {
 	struct txq_entry_t  *txqe;
 };
 
+
 #define NOT_TCP_ACK			(-1)
 
 #define MAX_TCP_SESSION		25
 #define MAX_PENDING_ACKS		256
-struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION];
-struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS];
+static struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION];
+static struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS];
 
-u32 pending_base;
-u32 tcp_session;
-u32 pending_acks;
+static u32 pending_base;
+static u32 tcp_session;
+static u32 pending_acks;
 
 static inline int init_tcp_tracking(void)
 {
@@ -386,17 +391,19 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 }
 #endif
 
-bool enabled = false;
+static bool enabled = false;
 
 void enable_tcp_ack_filter(bool value)
 {
 	enabled = value;
 }
 
-bool is_tcp_ack_filter_enabled(void)
+#ifdef TCP_ACK_FILTER
+static bool is_tcp_ack_filter_enabled(void)
 {
 	return enabled;
 }
+#endif
 
 static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
 {
@@ -1582,7 +1589,7 @@ void wilc_bus_set_default_speed(void)
 	g_wlan.hif_func.hif_set_default_bus_speed();
 }
 
-u32 init_chip(struct net_device *dev)
+static u32 init_chip(struct net_device *dev)
 {
 	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]


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

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-16 15:20 +0100
Subject[PATCH 07/19] staging/wilc1000: remove linux_wlan_{device_power,device_detection}
Message-ID<qvsNt-8o3-47@gated-at.bofh.it>
In reply to#1270206
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 | 40 -----------------------------------
 1 file changed, 40 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 040caa0d0d0b..6e1ef99fc856 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -31,40 +31,6 @@
 #include "linux_wlan_spi.h"
 #endif
 
- #define _linux_wlan_device_power_on()		{}
- #define _linux_wlan_device_power_off()		{}
-
- #define _linux_wlan_device_detection()		{}
- #define _linux_wlan_device_removal()		{}
-
-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 = {
@@ -1476,8 +1442,6 @@ void wl_wlan_cleanup(struct wilc *wilc)
 #if defined(WILC_DEBUGFS)
 	wilc_debugfs_remove();
 #endif
-	linux_wlan_device_detection(0);
-	linux_wlan_device_power(0);
 }
 
 int wilc_netdev_init(struct wilc **wilc)
@@ -1579,10 +1543,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;
-- 
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] | [standalone]


Back to top | Article view | linux.kernel


csiph-web