mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 00:24:41 -04:00
staging/wilc1000: turn enable_irq/disable_irq into callbacks
As a preparation for turning the SDIO side of wilc1000 into a separate module, this removes the last direct caller from the core module into the sdio specific portion. All calls to wilc_sdio_enable_interrupt() and wilc_sdio_disable_interrupt() now go through a function pointer in wilc_hif_func. We also change arguments slightly to pass the device, as we are already touching those lines and the change will be needed later to remove the global variables. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7d37a4a1b4
commit
5547c1f09c
5 changed files with 30 additions and 21 deletions
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
#include <linux/semaphore.h>
|
||||
|
||||
#include "linux_wlan_sdio.h"
|
||||
|
||||
static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);
|
||||
|
||||
static struct notifier_block g_dev_notifier = {
|
||||
|
|
@ -739,9 +737,10 @@ void wilc1000_wlan_deinit(struct net_device *dev)
|
|||
#endif
|
||||
|
||||
PRINT_D(INIT_DBG, "Disabling IRQ\n");
|
||||
if (!wl->dev_irq_num) {
|
||||
if (!wl->dev_irq_num &&
|
||||
wl->ops->disable_interrupt) {
|
||||
mutex_lock(&wl->hif_cs);
|
||||
wilc_sdio_disable_interrupt();
|
||||
wl->ops->disable_interrupt(wl);
|
||||
mutex_unlock(&wl->hif_cs);
|
||||
}
|
||||
if (&wl->txq_event)
|
||||
|
|
@ -758,11 +757,13 @@ void wilc1000_wlan_deinit(struct net_device *dev)
|
|||
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
|
||||
wilc_wlan_cleanup(dev);
|
||||
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
|
||||
if (!wl->dev_irq_num) {
|
||||
if (!wl->dev_irq_num &&
|
||||
wl->ops->disable_interrupt) {
|
||||
|
||||
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
|
||||
|
||||
mutex_lock(&wl->hif_cs);
|
||||
wilc_sdio_disable_interrupt();
|
||||
wl->ops->disable_interrupt(wl);
|
||||
mutex_unlock(&wl->hif_cs);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -897,7 +898,9 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
|
|||
goto _fail_wilc_wlan_;
|
||||
}
|
||||
|
||||
if (!wl->dev_irq_num && wilc_sdio_enable_interrupt()) {
|
||||
if (!wl->dev_irq_num &&
|
||||
wl->ops->enable_interrupt &&
|
||||
wl->ops->enable_interrupt(wl)) {
|
||||
PRINT_ER("couldn't initialize IRQ\n");
|
||||
ret = -EIO;
|
||||
goto _fail_irq_init_;
|
||||
|
|
@ -950,8 +953,9 @@ _fail_fw_start_:
|
|||
wilc_wlan_stop();
|
||||
|
||||
_fail_irq_enable_:
|
||||
if (!wl->dev_irq_num)
|
||||
wilc_sdio_disable_interrupt();
|
||||
if (!wl->dev_irq_num &&
|
||||
wl->ops->disable_interrupt)
|
||||
wl->ops->disable_interrupt(wl);
|
||||
_fail_irq_init_:
|
||||
if (wl->dev_irq_num)
|
||||
deinit_irq(dev);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "wilc_wfi_netdevice.h"
|
||||
#include "linux_wlan_sdio.h"
|
||||
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#include <linux/mmc/card.h>
|
||||
|
|
@ -8,7 +7,7 @@
|
|||
#include <linux/mmc/host.h>
|
||||
#include <linux/of_gpio.h>
|
||||
|
||||
|
||||
#include "linux_wlan_sdio.h"
|
||||
|
||||
#define SDIO_MODALIAS "wilc1000_sdio"
|
||||
|
||||
|
|
@ -143,13 +142,14 @@ static struct sdio_driver wilc_bus = {
|
|||
.remove = linux_sdio_remove,
|
||||
};
|
||||
|
||||
int wilc_sdio_enable_interrupt(void)
|
||||
int wilc_sdio_enable_interrupt(struct wilc *dev)
|
||||
{
|
||||
struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
|
||||
int ret = 0;
|
||||
|
||||
sdio_claim_host(wilc_sdio_func);
|
||||
ret = sdio_claim_irq(wilc_sdio_func, wilc_sdio_interrupt);
|
||||
sdio_release_host(wilc_sdio_func);
|
||||
sdio_claim_host(func);
|
||||
ret = sdio_claim_irq(func, wilc_sdio_interrupt);
|
||||
sdio_release_host(func);
|
||||
|
||||
if (ret < 0) {
|
||||
PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
|
||||
|
|
@ -158,18 +158,19 @@ int wilc_sdio_enable_interrupt(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void wilc_sdio_disable_interrupt(void)
|
||||
void wilc_sdio_disable_interrupt(struct wilc *dev)
|
||||
{
|
||||
struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
|
||||
int ret;
|
||||
|
||||
PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt IN\n");
|
||||
|
||||
sdio_claim_host(wilc_sdio_func);
|
||||
ret = sdio_release_irq(wilc_sdio_func);
|
||||
sdio_claim_host(func);
|
||||
ret = sdio_release_irq(func);
|
||||
if (ret < 0) {
|
||||
PRINT_ER("can't release sdio_irq, err(%d)\n", ret);
|
||||
}
|
||||
sdio_release_host(wilc_sdio_func);
|
||||
sdio_release_host(func);
|
||||
|
||||
PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt OUT\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ 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_enable_interrupt(struct wilc *);
|
||||
void wilc_sdio_disable_interrupt(struct wilc *);
|
||||
int wilc_sdio_set_max_speed(void);
|
||||
int wilc_sdio_set_default_speed(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -929,5 +929,7 @@ const struct wilc_hif_func wilc_hif_sdio = {
|
|||
.hif_sync_ext = sdio_sync_ext,
|
||||
.hif_set_max_bus_speed = sdio_set_max_speed,
|
||||
.hif_set_default_bus_speed = sdio_set_default_speed,
|
||||
.enable_interrupt = wilc_sdio_enable_interrupt,
|
||||
.disable_interrupt = wilc_sdio_disable_interrupt,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,8 @@ struct wilc_hif_func {
|
|||
int (*hif_sync_ext)(int);
|
||||
void (*hif_set_max_bus_speed)(void);
|
||||
void (*hif_set_default_bus_speed)(void);
|
||||
int (*enable_interrupt)(struct wilc *nic);
|
||||
void (*disable_interrupt)(struct wilc *nic);
|
||||
};
|
||||
|
||||
extern const struct wilc_hif_func wilc_hif_spi;
|
||||
|
|
|
|||
Loading…
Reference in a new issue