From: Arnd Bergmann <arnd@arndb.de>
To: linux-wireless@vger.kernel.org
Cc: Rachel Kim <rachel.kim@atmel.com>,
devel@driverdev.osuosl.org, Chris Park <chris.park@atmel.com>,
gregkh@linuxfoundation.org,
Stanislav Kholmanskikh <kholmanskikh.s.s@gmail.com>,
Johnny Kim <johnny.kim@atmel.com>,
linux-kernel@vger.kernel.org, Tony Cho <tony.cho@atmel.com>,
Glen Lee <glen.lee@atmel.com>, Leo Kim <leo.kim@atmel.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 15/19] staging/wilc1000: turn enable_irq/disable_irq into callbacks
Date: Wed, 21 Oct 2015 00:47:34 +0200 [thread overview]
Message-ID: <1445381258-1455986-16-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1445381258-1455986-1-git-send-email-arnd@arndb.de>
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 wilc1000_sdio_enable_interrupt()
and wilc1000_sdio_disable_interrupt() now go through a function pointer
in wilc1000_ops. 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.
The linux_wlan_sdio.h file is now unused and gets deleted.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/staging/wilc1000/linux_wlan.c | 21 ++++++++++++---------
drivers/staging/wilc1000/linux_wlan_sdio.c | 23 +++++++++++++----------
drivers/staging/wilc1000/linux_wlan_sdio.h | 5 -----
drivers/staging/wilc1000/wilc_wlan_if.h | 2 ++
4 files changed, 27 insertions(+), 24 deletions(-)
delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index beafc543aac3..7b0ac31f04a2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -26,8 +26,6 @@
#include <linux/version.h>
#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 = {
@@ -826,9 +824,10 @@ void wilc1000_wlan_deinit(struct wilc *nic)
#endif
PRINT_D(INIT_DBG, "Disabling IRQ\n");
- if (wilc1000_dev->gpio < 0) {
+ if (wilc1000_dev->gpio < 0 &&
+ wilc1000_dev->ops->disable_interrupt) {
mutex_lock(&wilc1000_dev->hif_cs);
- wilc1000_sdio_disable_interrupt();
+ wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
mutex_unlock(&wilc1000_dev->hif_cs);
}
if (&wilc1000_dev->txq_event != NULL)
@@ -845,11 +844,12 @@ void wilc1000_wlan_deinit(struct wilc *nic)
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup();
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
- if (wilc1000_dev->gpio < 0) {
+ if (wilc1000_dev->gpio < 0 &&
+ wilc1000_dev->ops->disable_interrupt) {
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
mutex_lock(&wilc1000_dev->hif_cs);
- wilc1000_sdio_disable_interrupt();
+ wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
mutex_unlock(&wilc1000_dev->hif_cs);
#endif
@@ -983,7 +983,9 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
goto _fail_threads_;
}
- if (wilc1000_dev->gpio < 0 && wilc1000_sdio_enable_interrupt()) {
+ if (wilc1000_dev->gpio < 0 &&
+ wilc1000_dev->ops->enable_interrupt &&
+ wilc1000_dev->ops->enable_interrupt(wilc1000_dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
@@ -1039,8 +1041,9 @@ _fail_fw_start_:
wilc_wlan_stop();
_fail_irq_enable_:
- if (wilc1000_dev->gpio < 0)
- wilc1000_sdio_disable_interrupt();
+ if (wilc1000_dev->gpio < 0 &&
+ wilc1000_dev->ops->disable_interrupt)
+ wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
_fail_irq_init_:
if (wilc1000_dev->gpio >= 0)
deinit_irq(wilc1000_dev);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 64c8c5725277..86251b907197 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -1,5 +1,4 @@
#include "wilc_wfi_netdevice.h"
-#include "linux_wlan_sdio.h"
#include "wilc_wfi_netdevice.h"
#include <linux/mmc/sdio_func.h>
@@ -160,7 +159,7 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
if (wilc1000_dev->gpio < 0)
- wilc1000_sdio_enable_interrupt();
+ wilc1000_dev->ops->enable_interrupt(wilc1000_dev);
if (wilc1000_wlan_get_firmware(nic)) {
PRINT_ER("Can't get firmware\n");
@@ -232,13 +231,14 @@ static struct sdio_driver wilc_bus = {
.remove = linux_sdio_remove,
};
-int wilc1000_sdio_enable_interrupt(void)
+static int wilc1000_sdio_enable_interrupt(struct wilc *dev)
{
+ struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret = 0;
- sdio_claim_host(wilc1000_sdio_func);
- ret = sdio_claim_irq(wilc1000_sdio_func, wilc_sdio_interrupt);
- sdio_release_host(wilc1000_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);
@@ -247,18 +247,19 @@ int wilc1000_sdio_enable_interrupt(void)
return ret;
}
-void wilc1000_sdio_disable_interrupt(void)
+static void wilc1000_sdio_disable_interrupt(struct wilc *dev)
{
+ struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret;
PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt IN\n");
- sdio_claim_host(wilc1000_sdio_func);
- ret = sdio_release_irq(wilc1000_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(wilc1000_sdio_func);
+ sdio_release_host(func);
PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt OUT\n");
}
@@ -325,6 +326,8 @@ static const struct wilc1000_ops wilc1000_sdio_ops = {
.repeat_power_cycle = repeat_power_cycle,
.prepare_11b_core = wilc1000_prepare_11b_core,
#endif
+ .enable_interrupt = wilc1000_sdio_enable_interrupt,
+ .disable_interrupt = wilc1000_sdio_disable_interrupt,
.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
deleted file mode 100644
index b4995a3211c7..000000000000
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/mmc/sdio_func.h>
-
-int wilc1000_sdio_enable_interrupt(void);
-void wilc1000_sdio_disable_interrupt(void);
-
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index a4befcb74c82..2fdf411d6e13 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -79,6 +79,8 @@ struct wilc1000_ops {
void (*io_deinit)(void *);
int (*repeat_power_cycle)(struct wilc_per_interface *nic);
u8 (*prepare_11b_core)(struct wilc *nic);
+ int (*enable_interrupt)(struct wilc *nic);
+ void (*disable_interrupt)(struct wilc *nic);
union {
struct {
--
2.1.0.rc2
next prev parent reply other threads:[~2015-10-20 22:48 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 22:47 [PATCH 00/19] staging/wilc1000 cleanups Arnd Bergmann
2015-10-20 22:47 ` [PATCH 01/19] staging/wilc1000: remove unused functions Arnd Bergmann
2015-10-25 1:20 ` Greg KH
2015-10-20 22:47 ` [PATCH 02/19] staging/wilc1000: make symbols static if possible Arnd Bergmann
2015-10-20 22:47 ` [PATCH 03/19] staging/wilc1000: use proper naming for global symbols Arnd Bergmann
2015-10-20 22:47 ` [PATCH 04/19] staging/wilc1000: move extern declarations to headers Arnd Bergmann
2015-10-20 22:47 ` [PATCH 05/19] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT Arnd Bergmann
2015-10-20 22:47 ` [PATCH 06/19] staging/wilc1000: avoid static definitions in header Arnd Bergmann
2015-10-20 22:47 ` [PATCH 07/19] staging/wilc1000: remove linux_wlan_{device_power,device_detection} Arnd Bergmann
2015-10-20 22:47 ` [PATCH 08/19] staging/wilc1000: move wilc_wlan_inp_t into struct wilc Arnd Bergmann
2015-10-20 22:47 ` [PATCH 09/19] staging/wilc1000: move init/exit functions to driver files Arnd Bergmann
2015-10-20 22:47 ` [PATCH 10/19] staging/wilc1000: unify device pointer Arnd Bergmann
2015-10-20 22:47 ` [PATCH 11/19] staging/wilc1000: move wilc1000_ops to drivers Arnd Bergmann
2015-10-20 22:47 ` [PATCH 12/19] staging/wilc1000: use device pointer for phy creation Arnd Bergmann
2015-10-20 22:47 ` [PATCH 13/19] staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c Arnd Bergmann
2015-10-20 22:47 ` [PATCH 14/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO Arnd Bergmann
2015-10-20 22:47 ` Arnd Bergmann [this message]
2015-10-20 22:47 ` [PATCH 16/19] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros Arnd Bergmann
2015-10-20 22:47 ` [PATCH 17/19] staging/wilc1000: pass hif operations through initialization Arnd Bergmann
2015-10-20 22:47 ` [PATCH 18/19] staging/wilc1000: split out bus specific modules Arnd Bergmann
2015-10-21 14:20 ` [PATCH] fixup! " Arnd Bergmann
2015-10-20 22:47 ` [PATCH 19/19] [RFC] staging/wilc1000: use more regular probing Arnd Bergmann
2015-10-21 10:06 ` [PATCH 00/19] staging/wilc1000 cleanups glen lee
2015-10-21 10:53 ` Arnd Bergmann
2015-10-22 12:23 ` Arnd Bergmann
2015-10-23 1:37 ` glen lee
2015-10-23 7:51 ` Tony Cho
2015-10-27 7:10 ` Tony Cho
2015-11-02 21:34 ` Arnd Bergmann
2015-11-16 14:04 [PATCH 00/19 v5] " Arnd Bergmann
2015-11-16 14:05 ` [PATCH 15/19] staging/wilc1000: turn enable_irq/disable_irq into callbacks Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445381258-1455986-16-git-send-email-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=chris.park@atmel.com \
--cc=devel@driverdev.osuosl.org \
--cc=glen.lee@atmel.com \
--cc=gregkh@linuxfoundation.org \
--cc=johnny.kim@atmel.com \
--cc=kholmanskikh.s.s@gmail.com \
--cc=leo.kim@atmel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=rachel.kim@atmel.com \
--cc=tony.cho@atmel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®