2016-02-19 08:39:47

by Leo Kim

[permalink] [raw]
Subject: [PATCH 1/6] staging: wilc1000: removes wilc_dbg()

This patch removes wilc_dbg function because it's not any more.

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 4 ----
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 --
drivers/staging/wilc1000/wilc_wlan.c | 2 --
3 files changed, 8 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 660bf63..b0cd21b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -224,10 +224,6 @@ static void deinit_irq(struct net_device *dev)
}
}

-void wilc_dbg(u8 *buff)
-{
-}
-
int wilc_lock_timeout(struct wilc *nic, void *vp, u32 timeout)
{
/* FIXME: replace with mutex_lock or wait_for_completion */
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 3077f5d4..786f5fd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -228,8 +228,6 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif);

void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
void wilc_mac_indicate(struct wilc *wilc, int flag);
-void wilc_dbg(u8 *buff);
-
int wilc_lock_timeout(struct wilc *wilc, void *, u32 timeout);
void wilc_netdev_cleanup(struct wilc *wilc);
int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio,
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 0cd3ed8..81a40e8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -15,8 +15,6 @@ static void wilc_debug(u32 flag, char *fmt, ...)
va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
-
- wilc_dbg(buf);
}
}

--
1.9.1



2016-02-19 08:40:05

by Leo Kim

[permalink] [raw]
Subject: [PATCH 4/6] staging: wilc1000: removes unnecessary wilc_debug print log

This patch removes unnecessary wilc_debug print log.
The print log was written when if condition fail.
The condition is chip-id check function.
Also, replaces this condition with normal function.

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index a51c66b..4873106 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -508,9 +508,7 @@ void chip_wakeup(struct wilc *wilc)

do {
usleep_range(2 * 1000, 2 * 1000);
- if ((wilc_get_chipid(wilc, true) == 0))
- wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n");
-
+ wilc_get_chipid(wilc, true);
} while ((wilc_get_chipid(wilc, true) == 0) && ((++trials % 3) == 0));

} while (wilc_get_chipid(wilc, true) == 0);
--
1.9.1


2016-02-20 01:06:15

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/6] staging: wilc1000: removes wilc_dbg()

On Fri, Feb 19, 2016 at 05:37:07PM +0900, Leo Kim wrote:
> This patch removes wilc_dbg function because it's not any more.
>
> Signed-off-by: Leo Kim <[email protected]>
> ---
> drivers/staging/wilc1000/linux_wlan.c | 4 ----
> drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 --
> drivers/staging/wilc1000/wilc_wlan.c | 2 --
> 3 files changed, 8 deletions(-)

I didn't apply the other series, so I can't apply this one, please
resend this after fixing it up as part of the other series.

thanks,

greg k-h

2016-02-19 11:05:00

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 4/6] staging: wilc1000: removes unnecessary wilc_debug print log

On Fri, Feb 19, 2016 at 05:37:10PM +0900, Leo Kim wrote:
> This patch removes unnecessary wilc_debug print log.
> The print log was written when if condition fail.
> The condition is chip-id check function.
> Also, replaces this condition with normal function.
>
> Signed-off-by: Leo Kim <[email protected]>
> ---
> drivers/staging/wilc1000/wilc_wlan.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
> index a51c66b..4873106 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -508,9 +508,7 @@ void chip_wakeup(struct wilc *wilc)
>
> do {
> usleep_range(2 * 1000, 2 * 1000);
> - if ((wilc_get_chipid(wilc, true) == 0))
> - wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n");
> -
> + wilc_get_chipid(wilc, true);

Why do we need this function when we call it again on the next line?

> } while ((wilc_get_chipid(wilc, true) == 0) && ((++trials % 3) == 0));
^^^^^^^^^^^^^^^

Also what the heck is ((++trials % 3) == 0))??? It looks like we are
supposed to retry 3 times but actually we don't retry at all. :P

regards,
dan carpenter


2016-02-19 08:40:10

by Leo Kim

[permalink] [raw]
Subject: [PATCH 5/6] staging: wilc1000: removes unnecessary variable of wilc_mac_cfg_t structure

This patch removes unnecessary variable of wilc_mac_cfg_t structure.
The variable is debug print function pointer.
Removes all what used this variable.

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan_cfg.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 2bb684a..e73381d 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -20,8 +20,6 @@
********************************************/

typedef struct {
- wilc_debug_func dPrint;
-
int mac_status;
u8 mac_address[7];
u8 ip_address[5];
@@ -389,8 +387,6 @@ int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size)
ret = wilc_wlan_cfg_set_str(frame, offset, id, buf, size);
} else if (type == 4) { /* binary command */
ret = wilc_wlan_cfg_set_bin(frame, offset, id, buf, size);
- } else {
- g_mac.dPrint(N_ERR, "illegal id\n");
}

return ret;
@@ -481,8 +477,6 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size)
}
i++;
} while (1);
- } else {
- g_mac.dPrint(N_ERR, "[CFG]: illegal type (%08x)\n", wid);
}

return ret;
@@ -540,6 +534,5 @@ int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
int wilc_wlan_cfg_init(wilc_debug_func func)
{
memset((void *)&g_mac, 0, sizeof(wilc_mac_cfg_t));
- g_mac.dPrint = func;
return 1;
}
--
1.9.1


2016-02-19 08:40:16

by Leo Kim

[permalink] [raw]
Subject: [PATCH 6/6] staging: wilc1000: wilc_wlan_cfg_init: changes unused argument

This patch changes the argument of the wilc_wlan_cfg_init function,
wilc_debug to void type because wilc_debug function is not used any more.
In addition, finally removes wilc_debug and related variables.

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 17 +----------------
drivers/staging/wilc1000/wilc_wlan_cfg.c | 2 +-
drivers/staging/wilc1000/wilc_wlan_cfg.h | 2 +-
3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 4873106..461abfc 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -3,21 +3,6 @@
#include "wilc_wfi_netdevice.h"
#include "wilc_wlan_cfg.h"

-static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ;
-
-/* FIXME: replace with dev_debug() */
-static void wilc_debug(u32 flag, char *fmt, ...)
-{
- char buf[256];
- va_list args;
-
- if (flag & dbgflag) {
- va_start(args, fmt);
- vsprintf(buf, fmt, args);
- va_end(args);
- }
-}
-
static CHIP_PS_STATE_T chip_ps_state = CHIP_WAKEDUP;

static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire)
@@ -1460,7 +1445,7 @@ int wilc_wlan_init(struct net_device *dev)
goto _fail_;
}

- if (!wilc_wlan_cfg_init(wilc_debug)) {
+ if (!wilc_wlan_cfg_init()) {
ret = -ENOBUFS;
goto _fail_;
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index e73381d..631bbf1 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -531,7 +531,7 @@ int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
return ret;
}

-int wilc_wlan_cfg_init(wilc_debug_func func)
+int wilc_wlan_cfg_init(void)
{
memset((void *)&g_mac, 0, sizeof(wilc_mac_cfg_t));
return 1;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 5f74eb8..00e5dd5 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -36,6 +36,6 @@ int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id);
int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size);
int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
struct wilc_cfg_rsp *rsp);
-int wilc_wlan_cfg_init(wilc_debug_func func);
+int wilc_wlan_cfg_init(void);

#endif
--
1.9.1


2016-02-19 08:39:58

by Leo Kim

[permalink] [raw]
Subject: [PATCH 3/6] staging: wilc1000: removes unnecessary wilc_debug print log

This patch removes unnecessary wilc_debug print log and the check routine.

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 2719c3d..a51c66b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -529,9 +529,6 @@ void chip_wakeup(struct wilc *wilc)

wilc->hif_func->hif_read_reg(wilc, 0xf1,
&clk_status_reg);
-
- if ((clk_status_reg & 0x1) == 0)
- wilc_debug(N_ERR, "clocks still OFF. Wake up failed\n");
}
if ((clk_status_reg & 0x1) == 0) {
wilc->hif_func->hif_write_reg(wilc, 0xf0,
--
1.9.1


2016-02-19 08:39:53

by Leo Kim

[permalink] [raw]
Subject: [PATCH 2/6] staging: wilc1000: replaces wilc_debug with netdev_err

This patches replaces wilc_debug with netdev_err.

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 81a40e8..2719c3d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1401,18 +1401,18 @@ static u32 init_chip(struct net_device *dev)
if ((chipid & 0xfff) != 0xa0) {
ret = wilc->hif_func->hif_read_reg(wilc, 0x1118, &reg);
if (!ret) {
- wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1118 ...\n");
+ netdev_err(dev, "fail read reg 0x1118\n");
return ret;
}
reg |= BIT(0);
ret = wilc->hif_func->hif_write_reg(wilc, 0x1118, reg);
if (!ret) {
- wilc_debug(N_ERR, "[wilc start]: fail write reg 0x1118 ...\n");
+ netdev_err(dev, "fail write reg 0x1118\n");
return ret;
}
ret = wilc->hif_func->hif_write_reg(wilc, 0xc0000, 0x71);
if (!ret) {
- wilc_debug(N_ERR, "[wilc start]: fail write reg 0xc0000 ...\n");
+ netdev_err(dev, "fail write reg 0xc0000\n");
return ret;
}
}
--
1.9.1