Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 857c7b00 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman
Browse files

staging/wilc1000: move init/exit functions to driver files



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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4bd7baf0
Loading
Loading
Loading
Loading
+1 −50
Original line number Diff line number Diff line
@@ -1398,7 +1398,7 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
		WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
}

void wl_wlan_cleanup(struct wilc *wilc)
void wilc_netdev_cleanup(struct wilc *wilc)
{
	int i = 0;
	perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];
@@ -1517,52 +1517,3 @@ int wilc_netdev_init(struct wilc **wilc)

	return 0;
}

static int __init init_wilc_driver(void)
{
#ifdef WILC_SPI
	struct wilc *wilc;
#endif

#if defined(WILC_DEBUGFS)
	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(&wilc))
		PRINT_ER("Couldn't initialize netdev\n");
	return 0;
#endif
}
late_initcall(init_wilc_driver);

static void __exit exit_wilc_driver(void)
{
#ifndef WILC_SDIO
	PRINT_D(INIT_DBG, "SPI unregister...\n");
	spi_unregister_driver(&wilc_bus);
#else
	PRINT_D(INIT_DBG, "SDIO unregister...\n");
	sdio_unregister_driver(&wilc_bus);
#endif
}
module_exit(exit_wilc_driver);

MODULE_LICENSE("GPL");
+10 −0
Original line number Diff line number Diff line
@@ -121,6 +121,16 @@ extern atomic_t WILC_DEBUG_LEVEL;
		printk("ERR [%s: %d]", __func__, __LINE__);		\
		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") */
+14 −2
Original line number Diff line number Diff line
@@ -146,11 +146,11 @@ static void linux_sdio_remove(struct sdio_func *func)
	struct wilc_sdio *wl_sdio;

	wl_sdio = sdio_get_drvdata(func);
	wl_wlan_cleanup(wl_sdio->wilc);
	wilc_netdev_cleanup(wl_sdio->wilc);
	kfree(wl_sdio);
}

struct sdio_driver wilc_bus = {
static struct sdio_driver wilc_bus = {
	.name		= SDIO_MODALIAS,
	.id_table	= wilc_sdio_ids,
	.probe		= linux_sdio_probe,
@@ -237,4 +237,16 @@ int wilc_sdio_set_default_speed(void)
}


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");
+3 −3
Original line number Diff line number Diff line
extern struct sdio_func *wilc_sdio_func;
extern struct sdio_driver wilc_bus;

#include <linux/mmc/sdio_func.h>

extern struct sdio_func *wilc_sdio_func;

int wilc_sdio_init(void);
int wilc_sdio_cmd52(sdio_cmd52_t *cmd);
int wilc_sdio_cmd53(sdio_cmd53_t *cmd);

int wilc_sdio_enable_interrupt(void);
void wilc_sdio_disable_interrupt(void);
int wilc_sdio_set_max_speed(void);
+22 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@

#include "linux_wlan_common.h"
#include "linux_wlan_spi.h"
#include "wilc_wfi_netdevice.h"

#define USE_SPI_DMA     0       /* johnny add */

@@ -68,7 +69,7 @@ static const struct of_device_id wilc1000_of_match[] = {
MODULE_DEVICE_TABLE(of, wilc1000_of_match);
#endif

struct spi_driver wilc_bus __refdata = {
static struct spi_driver wilc_bus __refdata = {
	.driver = {
		.name = MODALIAS,
#ifdef CONFIG_OF
@@ -393,3 +394,23 @@ 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)
{
	wilc_debugfs_init();
	return wilc_netdev_init(&wilc);
}
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");
Loading