wilc1000 sdio has two different files such as wilc_sdio and linux_wlan_sdio.
linux_wlan_sdio is for linux and wilc_sdio is implemented os independently at
the beginning. The drivers is now for LINUX so we will integrate them into one
file like spi.c and sdio.c.
This is first series to tidy up sdio/spi before integrate them.
Glen Lee (26):
staging: wilc1000: separate hif_sdio and hif_spi into different module
staging: wilc1000: remove function pointer sdio_cmd52
staging: wilc1000: remove sdio_cmd52 of wilc_wlan_io_func_t
staging: wilc1000: remove function pointer sdio_cmd53
staging: wilc1000: remove sdio_cmd53 of wilc_wlan_io_func_t
staging: wilc1000: remove function pointer sdio_set_max_speed
staging: wilc1000: remove sdio_set_max_speed
staging: wilc1000: remove function pointer sdio_set_default_speed
staging: wilc1000: remove varialbe sdio_set_default_speed
staging: wilc1000: call linux_sdio_init instead of io_init
staging: wilc1000: wilc_spi.c: add prefix wilc in all function name
staging: wilc1000: remove function pointer spi_tx of wilc_spi_t
staging: wilc1000: remove function pointer spi_tx of
wilc_wlan_io_function_t
staging: wilc1000: remove function pointer spi_rx of wilc_spi_t
staging: wilc1000: remove function pointer spi_rx of
wilc_wlan_io_func_t
staging: wilc1000: remove function pointer spi_trx
staging: wilc1000: remove spi_trx of wilc_wlan_io_func_t
staging: wilc1000: remove function pointer spi_max_speed
staging: wilc1000: remove spi_max_speed of wilc_wlan_io_func_t
staging: wilc1000: remove function pointer io_init
staging: wilc1000: remove unused function pointer io_deinit
staging: wilc1000: linux_sdio_init: remove parameter pv
staging: wilc1000: linux_spi_init: remove parameter vp
staging: wilc1000: remove os_context
staging: wilc1000: change parameter type of hif_init
staging: wilc1000: remove os_private
drivers/staging/wilc1000/Makefile | 6 +-
drivers/staging/wilc1000/linux_wlan.c | 16 +--
drivers/staging/wilc1000/linux_wlan_sdio.c | 2 +-
drivers/staging/wilc1000/linux_wlan_sdio.h | 2 +-
drivers/staging/wilc1000/linux_wlan_spi.c | 2 +-
drivers/staging/wilc1000/linux_wlan_spi.h | 2 +-
drivers/staging/wilc1000/wilc_sdio.c | 89 +++++++---------
drivers/staging/wilc1000/wilc_spi.c | 162 ++++++++++++++---------------
drivers/staging/wilc1000/wilc_wlan.c | 40 +++----
drivers/staging/wilc1000/wilc_wlan.h | 4 +-
drivers/staging/wilc1000/wilc_wlan_if.h | 21 ----
11 files changed, 146 insertions(+), 200 deletions(-)
--
1.9.1
This patch removes function pointer io_init of wilc_wlan_io_func_t and it's
related codes, and call the function linux_spi_init directly.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 --
drivers/staging/wilc1000/wilc_spi.c | 8 +++-----
drivers/staging/wilc1000/wilc_wlan_if.h | 1 -
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 3aa636a..119f55d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -892,11 +892,9 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
#ifdef WILC_SDIO
nwi->io_func.io_type = HIF_SDIO;
- nwi->io_func.io_init = linux_sdio_init;
nwi->io_func.io_deinit = linux_sdio_deinit;
#else
nwi->io_func.io_type = HIF_SPI;
- nwi->io_func.io_init = linux_spi_init;
nwi->io_func.io_deinit = linux_spi_deinit;
#endif
}
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index bda7b10..30b1744 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -966,11 +966,9 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
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)) {
- PRINT_ER("[wilc spi]: Failed io init bus...\n");
- return 0;
- }
+ if (!linux_spi_init(g_spi.os_context)) {
+ PRINT_ER("[wilc spi]: Failed io init bus...\n");
+ return 0;
} else {
return 0;
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 0f15795..d0b5bc3 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -74,7 +74,6 @@ typedef struct {
typedef struct {
int io_type;
- int (*io_init)(void *);
void (*io_deinit)(void *);
} wilc_wlan_io_func_t;
--
1.9.1
This patch removes sdio_cmd52 of wilc_wlan_io_func_t which is not used.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 -
drivers/staging/wilc1000/wilc_wlan_if.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index c94cb13..ce5463e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -894,7 +894,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
nwi->io_func.io_type = HIF_SDIO;
nwi->io_func.io_init = linux_sdio_init;
nwi->io_func.io_deinit = linux_sdio_deinit;
- nwi->io_func.u.sdio.sdio_cmd52 = linux_sdio_cmd52;
nwi->io_func.u.sdio.sdio_cmd53 = linux_sdio_cmd53;
nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_max_speed;
nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 12cbc4b..cd83098 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -78,7 +78,6 @@ typedef struct {
void (*io_deinit)(void *);
union {
struct {
- int (*sdio_cmd52)(sdio_cmd52_t *);
int (*sdio_cmd53)(sdio_cmd53_t *);
int (*sdio_set_max_speed)(void);
int (*sdio_set_default_speed)(void);
--
1.9.1
This patch removes function pointer spi_max_speed of wilc_spi_t and just call
the function linux_spi_set_max_speed directly.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_spi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 789635b..bda7b10 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -14,7 +14,6 @@
typedef struct {
void *os_context;
- int (*spi_max_speed)(void);
wilc_debug_func dPrint;
int crc_off;
int nint;
@@ -975,7 +974,6 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
} else {
return 0;
}
- g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed;
/**
* configure protocol
@@ -1025,7 +1023,7 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
static void wilc_spi_max_bus_speed(void)
{
- g_spi.spi_max_speed();
+ linux_spi_set_max_speed();
}
static void wilc_spi_default_bus_speed(void)
--
1.9.1
Just call linux_sdio_init instead of io_init function pointer.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_sdio.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 6f48839..0d88b6e 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -562,11 +562,9 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
g_sdio.dPrint = func;
g_sdio.os_context = inp->os_context.os_private;
- if (inp->io_func.io_init) {
- if (!inp->io_func.io_init(g_sdio.os_context)) {
- g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
- return 0;
- }
+ if (!linux_sdio_init(g_sdio.os_context)) {
+ g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
+ return 0;
} else {
return 0;
}
--
1.9.1
This patch removes function pointer io_deinit which is never used, and delete
it's related codes also.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 --
drivers/staging/wilc1000/wilc_wlan_if.h | 1 -
2 files changed, 3 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 119f55d..00bc890 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -892,10 +892,8 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
#ifdef WILC_SDIO
nwi->io_func.io_type = HIF_SDIO;
- nwi->io_func.io_deinit = linux_sdio_deinit;
#else
nwi->io_func.io_type = HIF_SPI;
- nwi->io_func.io_deinit = linux_spi_deinit;
#endif
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index d0b5bc3..b43e439 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -74,7 +74,6 @@ typedef struct {
typedef struct {
int io_type;
- void (*io_deinit)(void *);
} wilc_wlan_io_func_t;
#define WILC_MAC_INDICATE_STATUS 0x1
--
1.9.1
This patch changes parameter type wilc_wlan_inp_t with struct wilc and
modify it's related code. Pass wilc to the functions as well.
wilc will be used in later patch.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_sdio.c | 3 ++-
drivers/staging/wilc1000/wilc_spi.c | 3 ++-
drivers/staging/wilc1000/wilc_wlan.c | 8 ++++++--
drivers/staging/wilc1000/wilc_wlan.h | 4 ++--
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index a5307a7..8aacf55 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -11,6 +11,7 @@
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
#include "linux_wlan_sdio.h"
+#include "wilc_wfi_netdevice.h"
#define WILC_SDIO_BLOCK_SIZE 512
@@ -550,7 +551,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 *wilc, wilc_debug_func func)
{
sdio_cmd52_t cmd;
int loop;
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 5a6bbfd..3741836 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -11,6 +11,7 @@
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
#include "linux_wlan_spi.h"
+#include "wilc_wfi_netdevice.h"
typedef struct {
wilc_debug_func dPrint;
@@ -945,7 +946,7 @@ static int wilc_spi_sync(void)
return 1;
}
-static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
+static int wilc_spi_init(struct wilc *wilc, wilc_debug_func func)
{
u32 reg;
u32 chipid;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 2ce5870..9d257b0 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1655,6 +1655,10 @@ _fail_:
int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
{
int ret = 0;
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;
+
+ wilc = nic->wilc;
PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n");
@@ -1663,14 +1667,14 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
sizeof(wilc_wlan_io_func_t));
#ifdef WILC_SDIO
- if (!hif_sdio.hif_init(inp, wilc_debug)) {
+ if (!hif_sdio.hif_init(wilc, wilc_debug)) {
ret = -EIO;
goto _fail_;
}
memcpy((void *)&g_wlan.hif_func, &hif_sdio,
sizeof(struct wilc_hif_func));
#else
- if (!hif_spi.hif_init(inp, wilc_debug)) {
+ if (!hif_spi.hif_init(wilc, wilc_debug)) {
ret = -EIO;
goto _fail_;
}
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index ff4872f..64fd019 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -235,9 +235,9 @@ struct rxq_entry_t {
* Host IF Structure
*
********************************************/
-
+struct wilc;
struct wilc_hif_func {
- 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);
--
1.9.1
This patch removes spi_rx of wilc_wlan_io_func_t and it's related codes since
it is not used anymore.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 -
drivers/staging/wilc1000/wilc_wlan_if.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index fb2fea5..7a20765 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -898,7 +898,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
nwi->io_func.io_type = HIF_SPI;
nwi->io_func.io_init = linux_spi_init;
nwi->io_func.io_deinit = linux_spi_deinit;
- nwi->io_func.u.spi.spi_rx = linux_spi_read;
nwi->io_func.u.spi.spi_trx = linux_spi_write_read;
nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed;
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 4c05a46a..b820a11 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -79,7 +79,6 @@ typedef struct {
union {
struct {
int (*spi_max_speed)(void);
- int (*spi_rx)(u8 *, u32);
int (*spi_trx)(u8 *, u8 *, u32);
} spi;
} u;
--
1.9.1
This patch removes function pointer spi_tx of wilc_spi_t and call
linux_spi_write directly.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_spi.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 946bda7..fd0d762 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -10,10 +10,10 @@
#include <linux/string.h>
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
+#include "linux_wlan_spi.h"
typedef struct {
void *os_context;
- int (*spi_tx)(u8 *, u32);
int (*spi_rx)(u8 *, u32);
int (*spi_trx)(u8 *, u8 *, u32);
int (*spi_max_speed)(void);
@@ -211,7 +211,7 @@ static int spi_cmd(u8 cmd, u32 adr, u32 data, u32 sz, u8 clockless)
else
len -= 1;
- if (!g_spi.spi_tx(bc, len)) {
+ if (!linux_spi_write(bc, len)) {
PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n");
result = N_FAIL;
}
@@ -709,7 +709,7 @@ static int spi_data_write(u8 *b, u32 sz)
order = 0x2;
}
cmd |= order;
- if (!g_spi.spi_tx(&cmd, 1)) {
+ if (!linux_spi_write(&cmd, 1)) {
PRINT_ER("[wilc spi]: Failed data block cmd write, bus error...\n");
result = N_FAIL;
break;
@@ -718,7 +718,7 @@ static int spi_data_write(u8 *b, u32 sz)
/**
* Write data
**/
- if (!g_spi.spi_tx(&b[ix], nbytes)) {
+ if (!linux_spi_write(&b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block write, bus error...\n");
result = N_FAIL;
break;
@@ -728,7 +728,7 @@ static int spi_data_write(u8 *b, u32 sz)
* Write Crc
**/
if (!g_spi.crc_off) {
- if (!g_spi.spi_tx(crc, 2)) {
+ if (!linux_spi_write(crc, 2)) {
PRINT_ER("[wilc spi]: Failed data block crc write, bus error...\n");
result = N_FAIL;
break;
@@ -977,7 +977,6 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
} 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;
--
1.9.1
On Fri, Nov 06, 2015 at 02:45:22PM -0800, Greg KH wrote:
> On Fri, Nov 06, 2015 at 06:39:58PM +0900, Glen Lee wrote:
> > hif_sdio and hif_spi objects are compiled all the time even though one of SPI
> > or SDIO is selected. This patch separates hif_sdio and hif_spi into different
> > modules using ifdef define.
> > After rework SPI and SDIO modules with only one hif interface, the define
> > WILC_SDIO will be removed. This is first path of this series.
> >
> > Signed-off-by: Glen Lee <[email protected]>
> > ---
> > drivers/staging/wilc1000/Makefile | 6 +++---
> > drivers/staging/wilc1000/wilc_wlan.c | 36 +++++++++++++++++-------------------
> > 2 files changed, 20 insertions(+), 22 deletions(-)
>
> This patch doesn't apply at all, I think we are out of sync now. Please
> refresh and redo this series against my staging-testing branch and
> resend.
Oops, no, I was out of sync, nevermind, I figured it out...
This patch removes function pointer sdio_set_max_speed of wilc_sdio_t and
call the function directly.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_sdio.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 1176946..0ce2ecc 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -17,7 +17,6 @@
typedef struct {
void *os_context;
u32 block_size;
- int (*sdio_set_max_speed)(void);
int (*sdio_set_default_speed)(void);
wilc_debug_func dPrint;
int nint;
@@ -573,7 +572,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
return 0;
}
- 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;
/**
@@ -678,7 +676,7 @@ _fail_:
static void sdio_set_max_speed(void)
{
- g_sdio.sdio_set_max_speed();
+ linux_sdio_set_max_speed();
}
static void sdio_set_default_speed(void)
--
1.9.1
On Fri, Nov 06, 2015 at 06:39:58PM +0900, Glen Lee wrote:
> hif_sdio and hif_spi objects are compiled all the time even though one of SPI
> or SDIO is selected. This patch separates hif_sdio and hif_spi into different
> modules using ifdef define.
> After rework SPI and SDIO modules with only one hif interface, the define
> WILC_SDIO will be removed. This is first path of this series.
>
> Signed-off-by: Glen Lee <[email protected]>
> ---
> drivers/staging/wilc1000/Makefile | 6 +++---
> drivers/staging/wilc1000/wilc_wlan.c | 36 +++++++++++++++++-------------------
> 2 files changed, 20 insertions(+), 22 deletions(-)
This patch doesn't apply at all, I think we are out of sync now. Please
refresh and redo this series against my staging-testing branch and
resend.
thanks,
greg k-h
This patch removes spi_max_speed of wilc_wlan_io_func_t which is not used
anymore and removes union u and struct spi, which does not have members in it.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 -
drivers/staging/wilc1000/wilc_wlan_if.h | 5 -----
2 files changed, 6 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 935314c5..3aa636a 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -898,7 +898,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
nwi->io_func.io_type = HIF_SPI;
nwi->io_func.io_init = linux_spi_init;
nwi->io_func.io_deinit = linux_spi_deinit;
- nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed;
#endif
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index be73b02..0f15795 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -76,11 +76,6 @@ typedef struct {
int io_type;
int (*io_init)(void *);
void (*io_deinit)(void *);
- union {
- struct {
- int (*spi_max_speed)(void);
- } spi;
- } u;
} wilc_wlan_io_func_t;
#define WILC_MAC_INDICATE_STATUS 0x1
--
1.9.1
This patch removes unused variable os_private and delete
struct wilc_wlan_os_context_t since there is no members in it. Remove it's
related code also.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 --
drivers/staging/wilc1000/wilc_wlan_if.h | 5 -----
2 files changed, 7 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index fcc669c..086f1db 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -888,8 +888,6 @@ 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;
#else
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index b43e439..5980ece 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -84,11 +84,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;
--
1.9.1
This patch removes function pointer spi_tx of wilc_wlan_io_func_t because
it is not used anymore.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 -
drivers/staging/wilc1000/wilc_wlan_if.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index b37ef4d..fb2fea5 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -898,7 +898,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
nwi->io_func.io_type = HIF_SPI;
nwi->io_func.io_init = linux_spi_init;
nwi->io_func.io_deinit = linux_spi_deinit;
- nwi->io_func.u.spi.spi_tx = linux_spi_write;
nwi->io_func.u.spi.spi_rx = linux_spi_read;
nwi->io_func.u.spi.spi_trx = linux_spi_write_read;
nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 4568457..4c05a46a 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -79,7 +79,6 @@ typedef struct {
union {
struct {
int (*spi_max_speed)(void);
- int (*spi_tx)(u8 *, u32);
int (*spi_rx)(u8 *, u32);
int (*spi_trx)(u8 *, u8 *, u32);
} spi;
--
1.9.1
This patch removes spi_trx of wilc_wlan_io_func_t which is not used anymore.
Delete it's related codes also.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 -
drivers/staging/wilc1000/wilc_wlan_if.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 7a20765..935314c5 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -898,7 +898,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
nwi->io_func.io_type = HIF_SPI;
nwi->io_func.io_init = linux_spi_init;
nwi->io_func.io_deinit = linux_spi_deinit;
- nwi->io_func.u.spi.spi_trx = linux_spi_write_read;
nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed;
#endif
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index b820a11..be73b02 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -79,7 +79,6 @@ typedef struct {
union {
struct {
int (*spi_max_speed)(void);
- int (*spi_trx)(u8 *, u8 *, u32);
} spi;
} u;
} wilc_wlan_io_func_t;
--
1.9.1
This patch removes function pointer sdio_cmd52 of wilc_sdio_t and just call
the function directly.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_sdio.c | 53 ++++++++++++++++++------------------
1 file changed, 26 insertions(+), 27 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index cfa76b2..a2d6318 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -10,13 +10,13 @@
#include <linux/string.h>
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
+#include "linux_wlan_sdio.h"
#define WILC_SDIO_BLOCK_SIZE 512
typedef struct {
void *os_context;
u32 block_size;
- int (*sdio_cmd52)(sdio_cmd52_t *);
int (*sdio_cmd53)(sdio_cmd53_t *);
int (*sdio_set_max_speed)(void);
int (*sdio_set_default_speed)(void);
@@ -51,21 +51,21 @@ static int sdio_set_func0_csa_address(u32 adr)
cmd.raw = 0;
cmd.address = 0x10c;
cmd.data = (u8)adr;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c data...\n");
goto _fail_;
}
cmd.address = 0x10d;
cmd.data = (u8)(adr >> 8);
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10d data...\n");
goto _fail_;
}
cmd.address = 0x10e;
cmd.data = (u8)(adr >> 16);
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10e data...\n");
goto _fail_;
}
@@ -84,14 +84,14 @@ static int sdio_set_func0_block_size(u32 block_size)
cmd.raw = 0;
cmd.address = 0x10;
cmd.data = (u8)block_size;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10 data...\n");
goto _fail_;
}
cmd.address = 0x11;
cmd.data = (u8)(block_size >> 8);
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x11 data...\n");
goto _fail_;
}
@@ -116,13 +116,13 @@ static int sdio_set_func1_block_size(u32 block_size)
cmd.raw = 0;
cmd.address = 0x110;
cmd.data = (u8)block_size;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x110 data...\n");
goto _fail_;
}
cmd.address = 0x111;
cmd.data = (u8)(block_size >> 8);
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x111 data...\n");
goto _fail_;
}
@@ -143,7 +143,7 @@ static int sdio_clear_int(void)
cmd.raw = 0;
cmd.address = 0x4;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ linux_sdio_cmd52(&cmd);
return cmd.data;
#else
@@ -170,7 +170,7 @@ u32 sdio_xfer_cnt(void)
cmd.raw = 0;
cmd.address = 0x1C;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ linux_sdio_cmd52(&cmd);
cnt = cmd.data;
cmd.read_write = 0;
@@ -178,7 +178,7 @@ u32 sdio_xfer_cnt(void)
cmd.raw = 0;
cmd.address = 0x1D;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ linux_sdio_cmd52(&cmd);
cnt |= (cmd.data << 8);
cmd.read_write = 0;
@@ -186,7 +186,7 @@ u32 sdio_xfer_cnt(void)
cmd.raw = 0;
cmd.address = 0x1E;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ linux_sdio_cmd52(&cmd);
cnt |= (cmd.data << 16);
return cnt;
@@ -209,7 +209,7 @@ int sdio_check_bs(void)
cmd.raw = 0;
cmd.address = 0xc;
cmd.data = 0;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get BS register...\n");
goto _fail_;
}
@@ -235,7 +235,7 @@ static int sdio_write_reg(u32 addr, u32 data)
cmd.raw = 0;
cmd.address = addr;
cmd.data = data;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr);
goto _fail_;
}
@@ -363,7 +363,7 @@ static int sdio_read_reg(u32 addr, u32 *data)
cmd.function = 0;
cmd.raw = 0;
cmd.address = addr;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr);
goto _fail_;
}
@@ -574,7 +574,6 @@ 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;
@@ -587,7 +586,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
cmd.raw = 1;
cmd.address = 0x100;
cmd.data = 0x80;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, enable csa...\n");
goto _fail_;
}
@@ -609,7 +608,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
cmd.raw = 1;
cmd.address = 0x2;
cmd.data = 0x2;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio] Fail cmd 52, set IOE register...\n");
goto _fail_;
}
@@ -624,7 +623,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
loop = 3;
do {
cmd.data = 0;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get IOR register...\n");
goto _fail_;
}
@@ -653,7 +652,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
cmd.raw = 1;
cmd.address = 0x4;
cmd.data = 0x3;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!linux_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set IEN register...\n");
goto _fail_;
}
@@ -703,7 +702,7 @@ static int sdio_read_size(u32 *size)
cmd.raw = 0;
cmd.address = 0xf2;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ linux_sdio_cmd52(&cmd);
tmp = cmd.data;
/* cmd.read_write = 0; */
@@ -711,7 +710,7 @@ static int sdio_read_size(u32 *size)
/* cmd.raw = 0; */
cmd.address = 0xf3;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ linux_sdio_cmd52(&cmd);
tmp |= (cmd.data << 8);
*size = tmp;
@@ -733,7 +732,7 @@ static int sdio_read_int(u32 *int_status)
cmd.function = 1;
cmd.address = 0x04;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ linux_sdio_cmd52(&cmd);
if (cmd.data & BIT(0))
tmp |= INT_0;
@@ -766,7 +765,7 @@ static int sdio_read_int(u32 *int_status)
cmd.raw = 0;
cmd.address = 0xf7;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ linux_sdio_cmd52(&cmd);
irq_flags = cmd.data & 0x1f;
tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET);
}
@@ -813,7 +812,7 @@ static int sdio_clear_int_ext(u32 val)
cmd.address = 0xf8;
cmd.data = reg;
- ret = g_sdio.sdio_cmd52(&cmd);
+ ret = linux_sdio_cmd52(&cmd);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__);
goto _fail_;
@@ -842,7 +841,7 @@ static int sdio_clear_int_ext(u32 val)
cmd.address = 0xf8;
cmd.data = BIT(i);
- ret = g_sdio.sdio_cmd52(&cmd);
+ ret = linux_sdio_cmd52(&cmd);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__);
goto _fail_;
@@ -886,7 +885,7 @@ static int sdio_clear_int_ext(u32 val)
cmd.raw = 0;
cmd.address = 0xf6;
cmd.data = vmm_ctl;
- ret = g_sdio.sdio_cmd52(&cmd);
+ ret = linux_sdio_cmd52(&cmd);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf6 data (%d) ...\n", __LINE__);
goto _fail_;
--
1.9.1
This patch removes sdio_set_default_speed of wilc_wlan_io_func_t which is
not used anymore and also remove struct sdio since it is empty.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 -
drivers/staging/wilc1000/wilc_wlan_if.h | 3 ---
2 files changed, 4 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 9ecf307..b37ef4d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -894,7 +894,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
nwi->io_func.io_type = HIF_SDIO;
nwi->io_func.io_init = linux_sdio_init;
nwi->io_func.io_deinit = linux_sdio_deinit;
- nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed;
#else
nwi->io_func.io_type = HIF_SPI;
nwi->io_func.io_init = linux_spi_init;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 2caad28..4568457 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -78,9 +78,6 @@ typedef struct {
void (*io_deinit)(void *);
union {
struct {
- int (*sdio_set_default_speed)(void);
- } sdio;
- struct {
int (*spi_max_speed)(void);
int (*spi_tx)(u8 *, u32);
int (*spi_rx)(u8 *, u32);
--
1.9.1
This patch add prefix wilc for all functions name because the function name
such as spi_write, spi_read and spi_sync are same as linux spi function.
Hence, this should be done before restructuring wilc_spi.c and
linux_wlan_spi.c later.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_spi.c | 108 ++++++++++++++++++------------------
1 file changed, 54 insertions(+), 54 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index b09b3bd..946bda7 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -25,8 +25,8 @@ typedef struct {
static wilc_spi_t g_spi;
-static int spi_read(u32, u8 *, u32);
-static int spi_write(u32, u8 *, u32);
+static int wilc_spi_read(u32, u8 *, u32);
+static int wilc_spi_write(u32, u8 *, u32);
/********************************************
*
@@ -790,7 +790,7 @@ static int spi_internal_read(u32 adr, u32 *data)
*
********************************************/
-static int spi_write_reg(u32 addr, u32 data)
+static int wilc_spi_write_reg(u32 addr, u32 data)
{
int result = N_OK;
u8 cmd = CMD_SINGLE_WRITE;
@@ -813,7 +813,7 @@ static int spi_write_reg(u32 addr, u32 data)
return result;
}
-static int spi_write(u32 addr, u8 *buf, u32 size)
+static int wilc_spi_write(u32 addr, u8 *buf, u32 size)
{
int result;
u8 cmd = CMD_DMA_EXT_WRITE;
@@ -841,7 +841,7 @@ static int spi_write(u32 addr, u8 *buf, u32 size)
return 1;
}
-static int spi_read_reg(u32 addr, u32 *data)
+static int wilc_spi_read_reg(u32 addr, u32 *data)
{
int result = N_OK;
u8 cmd = CMD_SINGLE_READ;
@@ -867,7 +867,7 @@ static int spi_read_reg(u32 addr, u32 *data)
return 1;
}
-static int spi_read(u32 addr, u8 *buf, u32 size)
+static int wilc_spi_read(u32 addr, u8 *buf, u32 size)
{
u8 cmd = CMD_DMA_EXT_READ;
int result;
@@ -890,20 +890,20 @@ static int spi_read(u32 addr, u8 *buf, u32 size)
*
********************************************/
-static int spi_clear_int(void)
+static int wilc_spi_clear_int(void)
{
u32 reg;
- if (!spi_read_reg(WILC_HOST_RX_CTRL_0, ®)) {
+ if (!wilc_spi_read_reg(WILC_HOST_RX_CTRL_0, ®)) {
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0);
return 0;
}
reg &= ~0x1;
- spi_write_reg(WILC_HOST_RX_CTRL_0, reg);
+ wilc_spi_write_reg(WILC_HOST_RX_CTRL_0, reg);
return 1;
}
-static int spi_deinit(void *pv)
+static int wilc_spi_deinit(void *pv)
{
/**
* TODO:
@@ -911,7 +911,7 @@ static int spi_deinit(void *pv)
return 1;
}
-static int spi_sync(void)
+static int wilc_spi_sync(void)
{
u32 reg;
int ret;
@@ -919,13 +919,13 @@ static int spi_sync(void)
/**
* interrupt pin mux select
**/
- ret = spi_read_reg(WILC_PIN_MUX_0, ®);
+ ret = wilc_spi_read_reg(WILC_PIN_MUX_0, ®);
if (!ret) {
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0);
return 0;
}
reg |= BIT(8);
- ret = spi_write_reg(WILC_PIN_MUX_0, reg);
+ ret = wilc_spi_write_reg(WILC_PIN_MUX_0, reg);
if (!ret) {
PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0);
return 0;
@@ -934,13 +934,13 @@ static int spi_sync(void)
/**
* interrupt enable
**/
- ret = spi_read_reg(WILC_INTR_ENABLE, ®);
+ ret = wilc_spi_read_reg(WILC_INTR_ENABLE, ®);
if (!ret) {
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE);
return 0;
}
reg |= BIT(16);
- ret = spi_write_reg(WILC_INTR_ENABLE, reg);
+ ret = wilc_spi_write_reg(WILC_INTR_ENABLE, reg);
if (!ret) {
PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE);
return 0;
@@ -949,7 +949,7 @@ static int spi_sync(void)
return 1;
}
-static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
+static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
{
u32 reg;
u32 chipid;
@@ -958,7 +958,7 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
if (isinit) {
- if (!spi_read_reg(0x1000, &chipid)) {
+ if (!wilc_spi_read_reg(0x1000, &chipid)) {
PRINT_ER("[wilc spi]: Fail cmd read chip id...\n");
return 0;
}
@@ -1015,7 +1015,7 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
/**
* make sure can read back chip id correctly
**/
- if (!spi_read_reg(0x1000, &chipid)) {
+ if (!wilc_spi_read_reg(0x1000, &chipid)) {
PRINT_ER("[wilc spi]: Fail cmd read chip id...\n");
return 0;
}
@@ -1028,16 +1028,16 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
return 1;
}
-static void spi_max_bus_speed(void)
+static void wilc_spi_max_bus_speed(void)
{
g_spi.spi_max_speed();
}
-static void spi_default_bus_speed(void)
+static void wilc_spi_default_bus_speed(void)
{
}
-static int spi_read_size(u32 *size)
+static int wilc_spi_read_size(u32 *size)
{
int ret;
@@ -1048,7 +1048,7 @@ static int spi_read_size(u32 *size)
u32 tmp;
u32 byte_cnt;
- ret = spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt);
+ ret = wilc_spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt);
if (!ret) {
PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n");
goto _fail_;
@@ -1065,7 +1065,7 @@ _fail_:
-static int spi_read_int(u32 *int_status)
+static int wilc_spi_read_int(u32 *int_status)
{
int ret;
@@ -1075,7 +1075,7 @@ static int spi_read_int(u32 *int_status)
u32 tmp;
u32 byte_cnt;
- ret = spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt);
+ ret = wilc_spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt);
if (!ret) {
PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n");
goto _fail_;
@@ -1091,11 +1091,11 @@ static int spi_read_int(u32 *int_status)
happended = 0;
- spi_read_reg(0x1a90, &irq_flags);
+ wilc_spi_read_reg(0x1a90, &irq_flags);
tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET);
if (g_spi.nint > 5) {
- spi_read_reg(0x1a94, &irq_flags);
+ wilc_spi_read_reg(0x1a94, &irq_flags);
tmp |= (((irq_flags >> 0) & 0x7) << (IRG_FLAGS_OFFSET + 5));
}
@@ -1121,7 +1121,7 @@ _fail_:
return ret;
}
-static int spi_clear_int_ext(u32 val)
+static int wilc_spi_clear_int_ext(u32 val)
{
int ret;
@@ -1138,13 +1138,13 @@ static int spi_clear_int_ext(u32 val)
for (i = 0; i < g_spi.nint; i++) {
/* No matter what you write 1 or 0, it will clear interrupt. */
if (flags & 1)
- ret = spi_write_reg(0x10c8 + i * 4, 1);
+ ret = wilc_spi_write_reg(0x10c8 + i * 4, 1);
if (!ret)
break;
flags >>= 1;
}
if (!ret) {
- PRINT_ER("[wilc spi]: Failed spi_write_reg, set reg %x ...\n", 0x10c8 + i * 4);
+ PRINT_ER("[wilc spi]: Failed wilc_spi_write_reg, set reg %x ...\n", 0x10c8 + i * 4);
goto _fail_;
}
for (i = g_spi.nint; i < MAX_NUM_INT; i++) {
@@ -1165,7 +1165,7 @@ static int spi_clear_int_ext(u32 val)
if ((val & SEL_VMM_TBL1) == SEL_VMM_TBL1)
tbl_ctl |= BIT(1);
- ret = spi_write_reg(WILC_VMM_TBL_CTL, tbl_ctl);
+ ret = wilc_spi_write_reg(WILC_VMM_TBL_CTL, tbl_ctl);
if (!ret) {
PRINT_ER("[wilc spi]: fail write reg vmm_tbl_ctl...\n");
goto _fail_;
@@ -1175,7 +1175,7 @@ static int spi_clear_int_ext(u32 val)
/**
* enable vmm transfer.
**/
- ret = spi_write_reg(WILC_VMM_CORE_CTL, 1);
+ ret = wilc_spi_write_reg(WILC_VMM_CORE_CTL, 1);
if (!ret) {
PRINT_ER("[wilc spi]: fail write reg vmm_core_ctl...\n");
goto _fail_;
@@ -1187,7 +1187,7 @@ _fail_:
return ret;
}
-static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
+static int wilc_spi_sync_ext(int nint /* how mant interrupts to enable. */)
{
u32 reg;
int ret, i;
@@ -1202,13 +1202,13 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
/**
* interrupt pin mux select
**/
- ret = spi_read_reg(WILC_PIN_MUX_0, ®);
+ ret = wilc_spi_read_reg(WILC_PIN_MUX_0, ®);
if (!ret) {
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0);
return 0;
}
reg |= BIT(8);
- ret = spi_write_reg(WILC_PIN_MUX_0, reg);
+ ret = wilc_spi_write_reg(WILC_PIN_MUX_0, reg);
if (!ret) {
PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0);
return 0;
@@ -1217,7 +1217,7 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
/**
* interrupt enable
**/
- ret = spi_read_reg(WILC_INTR_ENABLE, ®);
+ ret = wilc_spi_read_reg(WILC_INTR_ENABLE, ®);
if (!ret) {
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE);
return 0;
@@ -1226,13 +1226,13 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
for (i = 0; (i < 5) && (nint > 0); i++, nint--) {
reg |= (BIT((27 + i)));
}
- ret = spi_write_reg(WILC_INTR_ENABLE, reg);
+ ret = wilc_spi_write_reg(WILC_INTR_ENABLE, reg);
if (!ret) {
PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE);
return 0;
}
if (nint) {
- ret = spi_read_reg(WILC_INTR2_ENABLE, ®);
+ ret = wilc_spi_read_reg(WILC_INTR2_ENABLE, ®);
if (!ret) {
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR2_ENABLE);
return 0;
@@ -1242,7 +1242,7 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
reg |= BIT(i);
}
- ret = spi_read_reg(WILC_INTR2_ENABLE, ®);
+ ret = wilc_spi_read_reg(WILC_INTR2_ENABLE, ®);
if (!ret) {
PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR2_ENABLE);
return 0;
@@ -1257,20 +1257,20 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
*
********************************************/
struct wilc_hif_func 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,
+ wilc_spi_init,
+ wilc_spi_deinit,
+ wilc_spi_read_reg,
+ wilc_spi_write_reg,
+ wilc_spi_read,
+ wilc_spi_write,
+ wilc_spi_sync,
+ wilc_spi_clear_int,
+ wilc_spi_read_int,
+ wilc_spi_clear_int_ext,
+ wilc_spi_read_size,
+ wilc_spi_write,
+ wilc_spi_read,
+ wilc_spi_sync_ext,
+ wilc_spi_max_bus_speed,
+ wilc_spi_default_bus_speed,
};
--
1.9.1
This patch removes function pointer spi_rx of wilc_spi_t and just call
linux_spi_read instead.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_spi.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index fd0d762..f584d7e 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -14,7 +14,6 @@
typedef struct {
void *os_context;
- int (*spi_rx)(u8 *, u32);
int (*spi_trx)(u8 *, u8 *, u32);
int (*spi_max_speed)(void);
wilc_debug_func dPrint;
@@ -231,13 +230,13 @@ static int spi_cmd_rsp(u8 cmd)
if ((cmd == CMD_RESET) ||
(cmd == CMD_TERMINATE) ||
(cmd == CMD_REPEAT)) {
- if (!g_spi.spi_rx(&rsp, 1)) {
+ if (!linux_spi_read(&rsp, 1)) {
result = N_FAIL;
goto _fail_;
}
}
- if (!g_spi.spi_rx(&rsp, 1)) {
+ if (!linux_spi_read(&rsp, 1)) {
PRINT_ER("[wilc spi]: Failed cmd response read, bus error...\n");
result = N_FAIL;
goto _fail_;
@@ -252,7 +251,7 @@ static int spi_cmd_rsp(u8 cmd)
/**
* State response
**/
- if (!g_spi.spi_rx(&rsp, 1)) {
+ if (!linux_spi_read(&rsp, 1)) {
PRINT_ER("[wilc spi]: Failed cmd state read, bus error...\n");
result = N_FAIL;
goto _fail_;
@@ -524,7 +523,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
/**
* Read bytes
**/
- if (!g_spi.spi_rx(&b[ix], nbytes)) {
+ if (!linux_spi_read(&b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -534,7 +533,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
* Read Crc
**/
if (!g_spi.crc_off) {
- if (!g_spi.spi_rx(crc, 2)) {
+ if (!linux_spi_read(crc, 2)) {
PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -565,7 +564,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
**/
retry = 10;
do {
- if (!g_spi.spi_rx(&rsp, 1)) {
+ if (!linux_spi_read(&rsp, 1)) {
PRINT_ER("[wilc spi]: Failed data response read, bus error...\n");
result = N_FAIL;
break;
@@ -581,7 +580,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
/**
* Read bytes
**/
- if (!g_spi.spi_rx(&b[ix], nbytes)) {
+ if (!linux_spi_read(&b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block read, bus error...\n");
result = N_FAIL;
break;
@@ -591,7 +590,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
* Read Crc
**/
if (!g_spi.crc_off) {
- if (!g_spi.spi_rx(crc, 2)) {
+ if (!linux_spi_read(crc, 2)) {
PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n");
result = N_FAIL;
break;
@@ -629,7 +628,7 @@ static int spi_data_read(u8 *b, u32 sz)
**/
retry = 10;
do {
- if (!g_spi.spi_rx(&rsp, 1)) {
+ if (!linux_spi_read(&rsp, 1)) {
PRINT_ER("[wilc spi]: Failed data response read, bus error...\n");
result = N_FAIL;
break;
@@ -650,7 +649,7 @@ static int spi_data_read(u8 *b, u32 sz)
/**
* Read bytes
**/
- if (!g_spi.spi_rx(&b[ix], nbytes)) {
+ if (!linux_spi_read(&b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block read, bus error...\n");
result = N_FAIL;
break;
@@ -660,7 +659,7 @@ static int spi_data_read(u8 *b, u32 sz)
* Read Crc
**/
if (!g_spi.crc_off) {
- if (!g_spi.spi_rx(crc, 2)) {
+ if (!linux_spi_read(crc, 2)) {
PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n");
result = N_FAIL;
break;
@@ -977,7 +976,6 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
} else {
return 0;
}
- 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;
--
1.9.1
This patch removes variable os_context of wilc_sdio_t and wilc_spi_t because
os_context is not used, and delete it's related code.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_sdio.c | 2 --
drivers/staging/wilc1000/wilc_spi.c | 2 --
2 files changed, 4 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 01a8e5b..a5307a7 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -15,7 +15,6 @@
#define WILC_SDIO_BLOCK_SIZE 512
typedef struct {
- void *os_context;
u32 block_size;
wilc_debug_func dPrint;
int nint;
@@ -560,7 +559,6 @@ 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;
if (!linux_sdio_init()) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index fe16d70..5a6bbfd 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -13,7 +13,6 @@
#include "linux_wlan_spi.h"
typedef struct {
- void *os_context;
wilc_debug_func dPrint;
int crc_off;
int nint;
@@ -965,7 +964,6 @@ static int wilc_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 (!linux_spi_init()) {
PRINT_ER("[wilc spi]: Failed io init bus...\n");
return 0;
--
1.9.1
This patch removes function parameter pv which is not used and modify it's
related codes.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan_sdio.c | 2 +-
drivers/staging/wilc1000/linux_wlan_sdio.h | 2 +-
drivers/staging/wilc1000/wilc_sdio.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index bf05e22..e854d37 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -214,7 +214,7 @@ static int linux_sdio_get_speed(void)
return local_sdio_func->card->host->ios.clock;
}
-int linux_sdio_init(void *pv)
+int linux_sdio_init(void)
{
/**
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h
index 4b515f5..6f42bc7 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -3,7 +3,7 @@ extern struct sdio_driver wilc_bus;
#include <linux/mmc/sdio_func.h>
-int linux_sdio_init(void *);
+int linux_sdio_init(void);
void linux_sdio_deinit(void *);
int linux_sdio_cmd52(sdio_cmd52_t *cmd);
int linux_sdio_cmd53(sdio_cmd53_t *cmd);
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 0d88b6e..01a8e5b 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -562,7 +562,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
g_sdio.dPrint = func;
g_sdio.os_context = inp->os_context.os_private;
- if (!linux_sdio_init(g_sdio.os_context)) {
+ if (!linux_sdio_init()) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
return 0;
} else {
--
1.9.1
This patch removes function pointer sdio_cmd53 of wilc_sdio_t and just call
the function directly.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_sdio.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index a2d6318..1176946 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -17,7 +17,6 @@
typedef struct {
void *os_context;
u32 block_size;
- int (*sdio_cmd53)(sdio_cmd53_t *);
int (*sdio_set_max_speed)(void);
int (*sdio_set_default_speed)(void);
wilc_debug_func dPrint;
@@ -257,7 +256,7 @@ static int sdio_write_reg(u32 addr, u32 data)
cmd.buffer = (u8 *)&data;
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!linux_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, write reg (%08x)...\n", addr);
goto _fail_;
}
@@ -320,7 +319,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!linux_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr);
goto _fail_;
}
@@ -341,7 +340,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!linux_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes send...\n", addr);
goto _fail_;
}
@@ -384,7 +383,7 @@ static int sdio_read_reg(u32 addr, u32 *data)
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!linux_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, read reg (%08x)...\n", addr);
goto _fail_;
}
@@ -451,7 +450,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!linux_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr);
goto _fail_;
}
@@ -472,7 +471,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!linux_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes read...\n", addr);
goto _fail_;
}
@@ -574,7 +573,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
return 0;
}
- 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;
--
1.9.1
This patch removes function pointer spi_trx and call linux_spi_write_read
directly.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_spi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index f584d7e..789635b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -14,7 +14,6 @@
typedef struct {
void *os_context;
- int (*spi_trx)(u8 *, u8 *, u32);
int (*spi_max_speed)(void);
wilc_debug_func dPrint;
int crc_off;
@@ -408,7 +407,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
}
rix = len;
- if (!g_spi.spi_trx(wb, rb, len2)) {
+ if (!linux_spi_write_read(wb, rb, len2)) {
PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n");
result = N_FAIL;
return result;
@@ -976,7 +975,6 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
} else {
return 0;
}
- g_spi.spi_trx = inp->io_func.u.spi.spi_trx;
g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed;
/**
--
1.9.1
This patch removes function pointer sdio_set_default_speed of wilc_sdio_t
and call linux_sdio_set_default_speed() directly.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_sdio.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 0ce2ecc..6f48839 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -17,7 +17,6 @@
typedef struct {
void *os_context;
u32 block_size;
- int (*sdio_set_default_speed)(void);
wilc_debug_func dPrint;
int nint;
#define MAX_NUN_INT_THRPT_ENH2 (5) /* Max num interrupts allowed in registers 0xf7, 0xf8 */
@@ -572,8 +571,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
return 0;
}
- g_sdio.sdio_set_default_speed = inp->io_func.u.sdio.sdio_set_default_speed;
-
/**
* function 0 csa enable
**/
@@ -681,7 +678,7 @@ static void sdio_set_max_speed(void)
static void sdio_set_default_speed(void)
{
- g_sdio.sdio_set_default_speed();
+ linux_sdio_set_default_speed();
}
static int sdio_read_size(u32 *size)
--
1.9.1
This patch removes function parameter vp which is not used and modify it's
related codes.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 +-
drivers/staging/wilc1000/linux_wlan_spi.c | 2 +-
drivers/staging/wilc1000/linux_wlan_spi.h | 2 +-
drivers/staging/wilc1000/wilc_spi.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 00bc890..fcc669c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1566,7 +1566,7 @@ int wilc_netdev_init(struct wilc **wilc)
}
#ifndef WILC_SDIO
- if (!linux_spi_init(&g_linux_wlan->wilc_spidev)) {
+ if (!linux_spi_init()) {
PRINT_ER("Can't initialize SPI\n");
return -1;
}
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 039d061..73c788f 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -93,7 +93,7 @@ void linux_spi_deinit(void *vp)
-int linux_spi_init(void *vp)
+int linux_spi_init(void)
{
int ret = 1;
static int called;
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h
index 7356785..b956100 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -5,7 +5,7 @@
extern struct spi_device *wilc_spi_dev;
extern struct spi_driver wilc_bus;
-int linux_spi_init(void *vp);
+int linux_spi_init(void);
void linux_spi_deinit(void *vp);
int linux_spi_write(u8 *b, u32 len);
int linux_spi_read(u8 *rb, u32 rlen);
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 30b1744..fe16d70 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -966,7 +966,7 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
g_spi.dPrint = func;
g_spi.os_context = inp->os_context.os_private;
- if (!linux_spi_init(g_spi.os_context)) {
+ if (!linux_spi_init()) {
PRINT_ER("[wilc spi]: Failed io init bus...\n");
return 0;
} else {
--
1.9.1
hif_sdio and hif_spi objects are compiled all the time even though one of SPI
or SDIO is selected. This patch separates hif_sdio and hif_spi into different
modules using ifdef define.
After rework SPI and SDIO modules with only one hif interface, the define
WILC_SDIO will be removed. This is first path of this series.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/Makefile | 6 +++---
drivers/staging/wilc1000/wilc_wlan.c | 36 +++++++++++++++++-------------------
2 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 64c2f1b..650123d 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -21,8 +21,8 @@ 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
+wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o wilc_sdio.o
+wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o wilc_spi.o
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index b6d784b..2ce5870 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -2,8 +2,11 @@
#include "wilc_wfi_netdevice.h"
#include "wilc_wlan_cfg.h"
+#ifdef WILC_SDIO
extern struct wilc_hif_func hif_sdio;
+#else
extern struct wilc_hif_func hif_spi;
+#endif
u32 wilc_get_chipid(u8 update);
typedef struct {
@@ -1659,26 +1662,21 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func,
sizeof(wilc_wlan_io_func_t));
- if ((inp->io_func.io_type & 0x1) == HIF_SDIO) {
- if (!hif_sdio.hif_init(inp, wilc_debug)) {
- ret = -EIO;
- goto _fail_;
- }
- memcpy((void *)&g_wlan.hif_func, &hif_sdio,
- sizeof(struct wilc_hif_func));
- } else {
- if ((inp->io_func.io_type & 0x1) == HIF_SPI) {
- if (!hif_spi.hif_init(inp, wilc_debug)) {
- ret = -EIO;
- goto _fail_;
- }
- memcpy((void *)&g_wlan.hif_func, &hif_spi,
- sizeof(struct wilc_hif_func));
- } else {
- ret = -EIO;
- goto _fail_;
- }
+#ifdef WILC_SDIO
+ if (!hif_sdio.hif_init(inp, wilc_debug)) {
+ ret = -EIO;
+ goto _fail_;
}
+ memcpy((void *)&g_wlan.hif_func, &hif_sdio,
+ sizeof(struct wilc_hif_func));
+#else
+ if (!hif_spi.hif_init(inp, wilc_debug)) {
+ ret = -EIO;
+ goto _fail_;
+ }
+ memcpy((void *)&g_wlan.hif_func, &hif_spi,
+ sizeof(struct wilc_hif_func));
+#endif
if (!wilc_wlan_cfg_init(wilc_debug)) {
ret = -ENOBUFS;
--
1.9.1
This patch removes sdio_set_max_speed of wilc_wlan_io_func_t which is not
used any more.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 -
drivers/staging/wilc1000/wilc_wlan_if.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 7258313..9ecf307 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -894,7 +894,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
nwi->io_func.io_type = HIF_SDIO;
nwi->io_func.io_init = linux_sdio_init;
nwi->io_func.io_deinit = linux_sdio_deinit;
- nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_max_speed;
nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed;
#else
nwi->io_func.io_type = HIF_SPI;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 92cee45..2caad28 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -78,7 +78,6 @@ typedef struct {
void (*io_deinit)(void *);
union {
struct {
- int (*sdio_set_max_speed)(void);
int (*sdio_set_default_speed)(void);
} sdio;
struct {
--
1.9.1
This patch removes sdio_cmd53 of wilc_wlan_io_func_t which is not used.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 -
drivers/staging/wilc1000/wilc_wlan_if.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index ce5463e..7258313 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -894,7 +894,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
nwi->io_func.io_type = HIF_SDIO;
nwi->io_func.io_init = linux_sdio_init;
nwi->io_func.io_deinit = linux_sdio_deinit;
- nwi->io_func.u.sdio.sdio_cmd53 = linux_sdio_cmd53;
nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_max_speed;
nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed;
#else
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index cd83098..92cee45 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -78,7 +78,6 @@ typedef struct {
void (*io_deinit)(void *);
union {
struct {
- int (*sdio_cmd53)(sdio_cmd53_t *);
int (*sdio_set_max_speed)(void);
int (*sdio_set_default_speed)(void);
} sdio;
--
1.9.1