2016-01-27 02:57:09

by Glen Lee

[permalink] [raw]
Subject: [PATCH 01/13] staging: wilc1000: wilc_frmw_to_linux(): fixes null check

From: Leo Kim <[email protected]>

Null checking wilc_netdev and skb->dev are already done in the begining of the
function and they are just print printing error log, so delete them.
Null checking wilc is needed before is used so add null ckeck before it is
used.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index ee779ee..db91a21 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1342,6 +1342,9 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
struct net_device *wilc_netdev;
struct wilc_vif *vif;

+ if (!wilc)
+ return;
+
wilc_netdev = get_if_handler(wilc, buff);
if (!wilc_netdev)
return;
@@ -1358,14 +1361,8 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
PRINT_ER("Low memory - packet droped\n");
return;
}
-
- if (!wilc || !wilc_netdev)
- PRINT_ER("wilc_netdev in wilc is NULL");
skb->dev = wilc_netdev;

- if (!skb->dev)
- PRINT_ER("skb->dev is NULL\n");
-
memcpy(skb_put(skb, frame_len), buff_to_send, frame_len);

skb->protocol = eth_type_trans(skb, wilc_netdev);
--
1.9.1



2016-01-27 02:58:11

by Glen Lee

[permalink] [raw]
Subject: [PATCH 11/13] staging: wilc1000: removes void function return

From: Leo Kim <[email protected]>

This patch removes the warning reported by checkpatch.pl
for void function return statements are not generally useful.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index c16cc40..5c87105 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1047,8 +1047,6 @@ static void wilc_set_multicast_list(struct net_device *dev)
}

wilc_setup_multicast_filter(vif, true, (dev->mc.count));
-
- return;
}

static void linux_wlan_tx_complete(void *priv, int status)
--
1.9.1


2016-01-27 02:57:59

by Glen Lee

[permalink] [raw]
Subject: [PATCH 09/13] staging: wilc1000: removes unnecessary debug logs

From: Leo Kim <[email protected]>

This patch removes unnecessary debug logs.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 154 ++++++----------------------------
1 file changed, 24 insertions(+), 130 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index f03daff..e8b4533 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -70,47 +70,32 @@ static int dev_state_ev_handler(struct notifier_block *this,
u8 null_ip[4] = {0};
char wlan_dev_name[5] = "wlan0";

- if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev) {
- PRINT_D(GENERIC_DBG, "dev_iface = NULL\n");
+ if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev)
return NOTIFY_DONE;
- }

if (memcmp(dev_iface->ifa_label, "wlan0", 5) &&
- memcmp(dev_iface->ifa_label, "p2p0", 4)) {
- PRINT_D(GENERIC_DBG, "Interface is neither WLAN0 nor P2P0\n");
+ memcmp(dev_iface->ifa_label, "p2p0", 4))
return NOTIFY_DONE;
- }

dev = (struct net_device *)dev_iface->ifa_dev->dev;
- if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) {
- PRINT_D(GENERIC_DBG, "No Wireless registerd\n");
+ if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy)
return NOTIFY_DONE;
- }
+
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
- if (!priv) {
- PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
+ if (!priv)
return NOTIFY_DONE;
- }
+
hif_drv = (struct host_if_drv *)priv->hif_drv;
vif = netdev_priv(dev);
- if (!vif || !hif_drv) {
- PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
+ if (!vif || !hif_drv)
return NOTIFY_DONE;
- }
-
- PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler +++\n");

switch (event) {
case NETDEV_UP:
- PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_UP %p\n", dev);
-
- PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Obtained ===============\n\n");
-
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 1;
wilc_optaining_ip = false;
del_timer(&wilc_during_ip_timer);
- PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n");
}

if (wilc_enable_ps)
@@ -127,9 +112,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;

case NETDEV_DOWN:
- PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN %p\n", dev);
-
- PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n");
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 0;
wilc_optaining_ip = false;
@@ -152,9 +134,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;

default:
- PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler event=default\n");
- PRINT_INFO(GENERIC_DBG, "[%s] unknown dev event: %lu\n", dev_iface->ifa_label, event);
-
break;
}

@@ -169,7 +148,6 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)

vif = netdev_priv(dev);
wilc = vif->wilc;
- PRINT_D(INT_DBG, "Interrupt received UH\n");

if (wilc->close) {
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
@@ -191,7 +169,6 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
return IRQ_HANDLED;
}

- PRINT_D(INT_DBG, "Interrupt received BH\n");
wilc_handle_isr(wilc);

return IRQ_HANDLED;
@@ -255,12 +232,9 @@ int wilc_lock_timeout(struct wilc *nic, void *vp, u32 timeout)
/* FIXME: replace with mutex_lock or wait_for_completion */
int error = -1;

- PRINT_D(LOCK_DBG, "Locking %p\n", vp);
if (vp)
error = down_timeout((struct semaphore *)vp,
msecs_to_jiffies(timeout));
- else
- PRINT_ER("Failed, mutex is NULL\n");
return error;
}

@@ -358,28 +332,21 @@ static int linux_wlan_txq_task(void *vp)

up(&wl->txq_thread_started);
while (1) {
- PRINT_D(TX_DBG, "txq_task Taking a nap :)\n");
down(&wl->txq_event);
- PRINT_D(TX_DBG, "txq_task Who waked me up :$\n");

if (wl->close) {
up(&wl->txq_thread_started);

while (!kthread_should_stop())
schedule();
-
- PRINT_D(TX_DBG, "TX thread stopped\n");
break;
}
- PRINT_D(TX_DBG, "txq_task handle the sending packet and let me go to sleep.\n");
#if !defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
ret = wilc_wlan_handle_txq(dev, &txq_count);
#else
do {
ret = wilc_wlan_handle_txq(dev, &txq_count);
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) {
- PRINT_D(TX_DBG, "Waking up queue\n");
-
if (netif_queue_stopped(wl->vif[0]->ndev))
netif_wake_queue(wl->vif[0]->ndev);
if (netif_queue_stopped(wl->vif[1]->ndev))
@@ -428,15 +395,11 @@ int wilc_wlan_get_firmware(struct net_device *dev)

netdev_info(dev, "loading firmware %s\n", firmware);

- if (!vif) {
- PRINT_ER("vif is NULL\n");
+ if (!vif)
goto _fail_;
- }

- if (!(&vif->ndev->dev)) {
- PRINT_ER("&vif->ndev->dev is NULL\n");
+ if (!(&vif->ndev->dev))
goto _fail_;
- }

if (request_firmware(&wilc_firmware, firmware, wilc->dev) != 0) {
PRINT_ER("%s - firmare not available\n", firmware);
@@ -459,20 +422,13 @@ static int linux_wlan_start_firmware(struct net_device *dev)
vif = netdev_priv(dev);
wilc = vif->wilc;

- PRINT_D(INIT_DBG, "Starting Firmware ...\n");
ret = wilc_wlan_start(wilc);
- if (ret < 0) {
- PRINT_ER("Failed to start Firmware\n");
+ if (ret < 0)
return ret;
- }

- PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
ret = wilc_lock_timeout(wilc, &wilc->sync_event, 5000);
- if (ret) {
- PRINT_D(INIT_DBG, "Firmware start timed out");
+ if (ret)
return ret;
- }
- PRINT_D(INIT_DBG, "Firmware successfully started\n");

return 0;
}
@@ -490,14 +446,12 @@ static int wilc1000_firmware_download(struct net_device *dev)
PRINT_ER("Firmware buffer is NULL\n");
return -ENOBUFS;
}
- PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
+
ret = wilc_wlan_firmware_download(wilc, wilc->firmware->data,
wilc->firmware->size);
if (ret < 0)
return ret;

- PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
- PRINT_D(INIT_DBG, "Releasing firmware\n");
release_firmware(wilc->firmware);
wilc->firmware = NULL;

@@ -740,7 +694,6 @@ void wilc1000_wlan_deinit(struct net_device *dev)
if (wl->initialized) {
netdev_info(dev, "Deinitializing wilc1000...\n");

- PRINT_D(INIT_DBG, "Disabling IRQ\n");
if (!wl->dev_irq_num &&
wl->hif_func->disable_interrupt) {
mutex_lock(&wl->hif_cs);
@@ -750,29 +703,19 @@ void wilc1000_wlan_deinit(struct net_device *dev)
if (&wl->txq_event)
up(&wl->txq_event);

- PRINT_D(INIT_DBG, "Deinitializing Threads\n");
wlan_deinitialize_threads(dev);
-
- PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
deinit_irq(dev);

wilc_wlan_stop(wl);
-
- 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 &&
wl->hif_func->disable_interrupt) {
-
- PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
-
mutex_lock(&wl->hif_cs);
wl->hif_func->disable_interrupt(wl);
mutex_unlock(&wl->hif_cs);
}
#endif
-
- PRINT_D(INIT_DBG, "Deinitializing Locks\n");
wlan_deinit_locks(dev);

wl->initialized = false;
@@ -792,8 +735,6 @@ static int wlan_init_locks(struct net_device *dev)
vif = netdev_priv(dev);
wl = vif->wilc;

- PRINT_D(INIT_DBG, "Initializing Locks ...\n");
-
mutex_init(&wl->hif_cs);
mutex_init(&wl->rxq_cs);

@@ -818,8 +759,6 @@ static int wlan_deinit_locks(struct net_device *dev)
vif = netdev_priv(dev);
wilc = vif->wilc;

- PRINT_D(INIT_DBG, "De-Initializing Locks\n");
-
if (&wilc->hif_cs)
mutex_destroy(&wilc->hif_cs);

@@ -837,8 +776,6 @@ static int wlan_initialize_threads(struct net_device *dev)
vif = netdev_priv(dev);
wilc = vif->wilc;

- PRINT_D(INIT_DBG, "Initializing Threads ...\n");
- PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
"K_TXQ_TASK");
if (!wilc->txq_thread) {
@@ -860,7 +797,6 @@ static void wlan_deinitialize_threads(struct net_device *dev)
wl = vif->wilc;

wl->close = 1;
- PRINT_D(INIT_DBG, "Deinitializing Threads\n");

if (&wl->txq_event)
up(&wl->txq_event);
@@ -884,20 +820,17 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)

ret = wilc_wlan_init(dev);
if (ret < 0) {
- PRINT_ER("Initializing WILC_Wlan FAILED\n");
ret = -EIO;
goto _fail_locks_;
}

if (wl->gpio >= 0 && init_irq(dev)) {
- PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
}

ret = wlan_initialize_threads(dev);
if (ret < 0) {
- PRINT_ER("Initializing Threads FAILED\n");
ret = -EIO;
goto _fail_wilc_wlan_;
}
@@ -905,27 +838,23 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
if (!wl->dev_irq_num &&
wl->hif_func->enable_interrupt &&
wl->hif_func->enable_interrupt(wl)) {
- PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
}

if (wilc_wlan_get_firmware(dev)) {
- PRINT_ER("Can't get firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}

ret = wilc1000_firmware_download(dev);
if (ret < 0) {
- PRINT_ER("Failed to download firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}

ret = linux_wlan_start_firmware(dev);
if (ret < 0) {
- PRINT_ER("Failed to start firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}
@@ -1008,16 +937,11 @@ int wilc_mac_open(struct net_device *ndev)
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);

ret = wilc_init_host_int(ndev);
- if (ret < 0) {
- PRINT_ER("Failed to initialize host interface\n");
-
+ if (ret < 0)
return ret;
- }

- PRINT_D(INIT_DBG, "*** re-init ***\n");
ret = wilc1000_wlan_init(ndev, vif);
if (ret < 0) {
- PRINT_ER("Failed to initialize wilc1000\n");
wilc_deinit_host_int(ndev);
return ret;
}
@@ -1098,23 +1022,16 @@ static void wilc_set_multicast_list(struct net_device *dev)
if (!dev)
return;

- PRINT_D(INIT_DBG, "Setting Multicast List with count = %d.\n",
- dev->mc.count);
-
- if (dev->flags & IFF_PROMISC) {
- PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets\n");
+ if (dev->flags & IFF_PROMISC)
return;
- }

if ((dev->flags & IFF_ALLMULTI) ||
(dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) {
- PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n");
wilc_setup_multicast_filter(vif, false, 0);
return;
}

if ((dev->mc.count) == 0) {
- PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n");
wilc_setup_multicast_filter(vif, true, 0);
return;
}
@@ -1161,8 +1078,6 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
vif = netdev_priv(ndev);
wilc = vif->wilc;

- PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n");
-
if (skb->dev != ndev) {
PRINT_ER("Packet not destined to this device\n");
return 0;
@@ -1170,7 +1085,6 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)

tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC);
if (!tx_data) {
- PRINT_ER("Failed to allocate memory for tx_data structure\n");
dev_kfree_skb(skb);
netif_wake_queue(ndev);
return 0;
@@ -1192,8 +1106,6 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(GENERIC_DBG, "DHCP Message transmitted, type:%x %x %x\n",
udp_buf[248], udp_buf[249], udp_buf[250]);

- PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb);
- PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
@@ -1219,39 +1131,29 @@ int wilc_mac_close(struct net_device *ndev)
vif = netdev_priv(ndev);

if (!vif || !vif->ndev || !vif->ndev->ieee80211_ptr ||
- !vif->ndev->ieee80211_ptr->wiphy) {
- PRINT_ER("vif = NULL\n");
+ !vif->ndev->ieee80211_ptr->wiphy)
return 0;
- }

priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
wl = vif->wilc;

- if (!priv) {
- PRINT_ER("priv = NULL\n");
+ if (!priv)
return 0;
- }

hif_drv = (struct host_if_drv *)priv->hif_drv;

PRINT_D(GENERIC_DBG, "Mac close\n");

- if (!wl) {
- PRINT_ER("wl = NULL\n");
+ if (!wl)
return 0;
- }

- if (!hif_drv) {
- PRINT_ER("hif_drv = NULL\n");
+ if (!hif_drv)
return 0;
- }

- if ((wl->open_ifcs) > 0) {
+ if ((wl->open_ifcs) > 0)
wl->open_ifcs--;
- } else {
- PRINT_ER("ERROR: MAC close called while number of opened interfaces is zero\n");
+ else
return 0;
- }

if (vif->ndev) {
netif_stop_queue(vif->ndev);
@@ -1304,8 +1206,6 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
if (strncasecmp(buff, "RSSI", length) == 0) {
priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
ret = wilc_get_rssi(vif, &rssi);
- if (ret)
- PRINT_ER("Failed to send get rssi param's message queue ");
PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi);

rssi += 5;
@@ -1361,10 +1261,9 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
buff_to_send = buff;

skb = dev_alloc_skb(frame_len);
- if (!skb) {
- PRINT_ER("Low memory - packet droped\n");
+ if (!skb)
return;
- }
+
skb->dev = wilc_netdev;

memcpy(skb_put(skb, frame_len), buff_to_send, frame_len);
@@ -1454,10 +1353,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,

for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
ndev = alloc_etherdev(sizeof(struct wilc_vif));
- if (!ndev) {
- PRINT_ER("Failed to allocate ethernet dev\n");
+ if (!ndev)
return -1;
- }

vif = netdev_priv(ndev);
memset(vif, 0, sizeof(struct wilc_vif));
@@ -1496,11 +1393,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
vif->netstats.tx_bytes = 0;
}

- if (register_netdev(ndev)) {
- PRINT_ER("Device couldn't be registered - %s\n",
- ndev->name);
+ if (register_netdev(ndev))
return -1;
- }

vif->iftype = STATION_MODE;
vif->mac_opened = 0;
--
1.9.1


2016-01-27 02:57:35

by Glen Lee

[permalink] [raw]
Subject: [PATCH 05/13] staging: wilc1000: rename Firmware_ver variable

From: Leo Kim <[email protected]>

This patch renames Firmware_ver variable to firmware_ver to avoid camelcase.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 06c79dd..fd405b0 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -929,13 +929,14 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)

if (wilc_wlan_cfg_get(vif, 1, WID_FIRMWARE_VERSION, 1, 0)) {
int size;
- char Firmware_ver[20];
-
- size = wilc_wlan_cfg_get_val(
- WID_FIRMWARE_VERSION,
- Firmware_ver, sizeof(Firmware_ver));
- Firmware_ver[size] = '\0';
- PRINT_D(INIT_DBG, "***** Firmware Ver = %s *******\n", Firmware_ver);
+ char firmware_ver[20];
+
+ size = wilc_wlan_cfg_get_val(WID_FIRMWARE_VERSION,
+ firmware_ver,
+ sizeof(firmware_ver));
+ firmware_ver[size] = '\0';
+ PRINT_D(INIT_DBG, "**** Firmware Ver = %s ****\n",
+ firmware_ver);
}
ret = linux_wlan_init_test_config(dev, vif);

--
1.9.1


2016-01-27 02:57:42

by Glen Lee

[permalink] [raw]
Subject: [PATCH 06/13] staging: wilc1000: fixes missing a blank line after declarations

From: Leo Kim <[email protected]>

This patch fixes the warnings reported by checkpatch.pl
for Missing a blank line after declarations.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index fd405b0..402f8ce 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -853,6 +853,7 @@ static void wlan_deinitialize_threads(struct net_device *dev)
{
struct wilc_vif *vif;
struct wilc *wl;
+
vif = netdev_priv(dev);
wl = vif->wilc;

@@ -1473,6 +1474,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,

{
struct wireless_dev *wdev;
+
wdev = wilc_create_wiphy(ndev, dev);

if (dev)
--
1.9.1


2016-01-27 02:57:29

by Glen Lee

[permalink] [raw]
Subject: [PATCH 04/13] staging: wilc1000: rename hWILCWFIDrv of wilc_priv structure

From: Leo Kim <[email protected]>

This patch renames hWILCWFIDrv pointer variable of wilc_priv structure
to hif_drv to avoid camelcase.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 8 ++++----
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 22 ++++++++++++----------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index a3b4939..06c79dd 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -89,7 +89,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
return NOTIFY_DONE;
}
- hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ hif_drv = (struct host_if_drv *)priv->hif_drv;
vif = netdev_priv(dev);
if (!vif || !hif_drv) {
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
@@ -515,7 +515,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,

PRINT_D(TX_DBG, "Start configuring Firmware\n");
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
- hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ hif_drv = (struct host_if_drv *)priv->hif_drv;
PRINT_D(INIT_DBG, "Host = %p\n", hif_drv);
wilc_get_mac_address(vif, mac_add);

@@ -1089,7 +1089,7 @@ static void wilc_set_multicast_list(struct net_device *dev)

priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
vif = netdev_priv(dev);
- hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ hif_drv = (struct host_if_drv *)priv->hif_drv;

if (!dev)
return;
@@ -1228,7 +1228,7 @@ int wilc_mac_close(struct net_device *ndev)
return 0;
}

- hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ hif_drv = (struct host_if_drv *)priv->hif_drv;

PRINT_D(GENERIC_DBG, "Mac close\n");

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 6e7f5d6..6626347 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -512,7 +512,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
dev = priv->dev;
vif = netdev_priv(dev);
wl = vif->wilc;
- pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;

if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
u16 u16ConnectStatus;
@@ -711,9 +711,11 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
wilc_connecting = 1;
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
- pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;

- PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
+ PRINT_D(CFG80211_DBG,
+ "Connecting to SSID [%s] on netdev [%p] host if [%p]\n",
+ sme->ssid, dev, priv->hif_drv);
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS disabled\n");
pstrWFIDrv->p2p_connect = 1;
@@ -928,7 +930,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);

- pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
if (!pstrWFIDrv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE);
@@ -1276,7 +1278,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
wilc_remove_wep_key(vif, key_index);
} else {
PRINT_D(CFG80211_DBG, "Removing all installed keys\n");
- wilc_remove_key(priv->hWILCWFIDrv, mac_addr);
+ wilc_remove_key(priv->hif_drv, mac_addr);
}

return 0;
@@ -1632,7 +1634,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
s32 s32Freq;

priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
- pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;

memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET);

@@ -1844,7 +1846,7 @@ static int mgmt_tx(struct wiphy *wiphy,

vif = netdev_priv(wdev->netdev);
priv = wiphy_priv(wiphy);
- pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;

*cookie = (unsigned long)buf;
priv->u64tx_cookie = *cookie;
@@ -1970,7 +1972,7 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
struct host_if_drv *pstrWFIDrv;

priv = wiphy_priv(wiphy);
- pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;


PRINT_D(GENERIC_DBG, "Tx Cancel wait :%lu\n", jiffies);
@@ -2070,7 +2072,7 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,

priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
- if (!priv->hWILCWFIDrv) {
+ if (!priv->hif_drv) {
PRINT_ER("Driver is NULL\n");
return -EIO;
}
@@ -2713,7 +2715,7 @@ int wilc_init_host_int(struct net_device *net)
priv->bInP2PlistenState = false;

sema_init(&(priv->hSemScanReq), 1);
- s32Error = wilc_init(net, &priv->hWILCWFIDrv);
+ s32Error = wilc_init(net, &priv->hif_drv);
if (s32Error)
PRINT_ER("Error while initializing hostinterface\n");

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 07eda4d..64fcb77 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -121,7 +121,7 @@ struct wilc_priv {
spinlock_t lock;
struct net_device *dev;
struct napi_struct napi;
- struct host_if_drv *hWILCWFIDrv;
+ struct host_if_drv *hif_drv;
struct host_if_pmkid_attr pmkid_list;
struct WILC_WFI_stats netstats;
u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
--
1.9.1


2016-01-27 02:57:23

by Glen Lee

[permalink] [raw]
Subject: [PATCH 03/13] staging: wilc1000: fixes add spaces required around

From: Leo Kim <[email protected]>

This patch fixes the checks reported by checkpatch.pl
for spaces required around that '=' or '||' or '('.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 9552469..a3b4939 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -993,7 +993,7 @@ int wilc_mac_open(struct net_device *ndev)
vif = netdev_priv(ndev);
wl = vif->wilc;

- if (!wl|| !wl->dev) {
+ if (!wl || !wl->dev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
@@ -1074,7 +1074,7 @@ int wilc_mac_open(struct net_device *ndev)

static struct net_device_stats *mac_stats(struct net_device *dev)
{
- struct wilc_vif *vif= netdev_priv(dev);
+ struct wilc_vif *vif = netdev_priv(dev);

return &vif->netstats;
}
--
1.9.1


2016-01-27 02:58:17

by Glen Lee

[permalink] [raw]
Subject: [PATCH 12/13] staging: wilc1000: renames u8IfIdx of wilc_vif structure

From: Leo Kim <[email protected]>

This patch renames u8IfIdx variable of wilc_vif structure to idx
to avoid camelcase.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 2 +-
drivers/staging/wilc1000/linux_wlan.c | 8 ++++----
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index a425b09..ad54db2 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -280,7 +280,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
*/
int wilc_get_vif_idx(struct wilc_vif *vif)
{
- return vif->u8IfIdx + 1;
+ return vif->idx + 1;
}

/* We need to minus 1 from idx which is from wilc device to get real index
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 5c87105..9ca33536 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -107,7 +107,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);
- wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
+ wilc_setup_ipaddress(vif, ip_addr_buf, vif->idx);

break;

@@ -129,7 +129,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);

- wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
+ wilc_setup_ipaddress(vif, ip_addr_buf, vif->idx);

break;

@@ -1104,7 +1104,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)

vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
- tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
+ tx_data->bssid = wilc->vif[vif->idx]->bssid;
queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
tx_data->buff, tx_data->size,
linux_wlan_tx_complete);
@@ -1360,7 +1360,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
else
strcpy(ndev->name, "p2p%d");

- vif->u8IfIdx = wl->vif_num;
+ vif->idx = wl->vif_num;
vif->wilc = *wilc;
wl->vif[i] = vif;
wl->vif[wl->vif_num]->ndev = ndev;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 6626347..ccfd26a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2197,7 +2197,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");

- wilc_wlan_set_bssid(dev, wl->vif[vif->u8IfIdx]->src_addr, AP_MODE);
+ wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);

s32Error = wilc_add_beacon(vif, settings->beacon_interval,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 64fcb77..07a4ff1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -148,7 +148,7 @@ typedef struct {
} struct_frame_reg;

struct wilc_vif {
- u8 u8IfIdx;
+ u8 idx;
u8 iftype;
int monitor_flag;
int mac_opened;
--
1.9.1


2016-01-27 02:57:48

by Glen Lee

[permalink] [raw]
Subject: [PATCH 07/13] staging: wilc1000: rename pBssid of tx_complete_data structure

From: Leo Kim <[email protected]>

This patch renames pBssid variable of tx_complete_data structure to bssid
to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 402f8ce..4b544df 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1194,7 +1194,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
- tx_data->pBssid = wilc->vif[vif->u8IfIdx]->bssid;
+ tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
tx_data->buff, tx_data->size,
linux_wlan_tx_complete);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index d7238e7..703dbe0 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -809,7 +809,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
if (tqe->type == WILC_CFG_PKT) {
buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET;
} else if (tqe->type == WILC_NET_PKT) {
- char *bssid = ((struct tx_complete_data *)(tqe->priv))->pBssid;
+ char *bssid = ((struct tx_complete_data *)(tqe->priv))->bssid;

buffer_offset = ETH_ETHERNET_HDR_OFFSET;
memcpy(&txb[offset + 4], bssid, 6);
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 455a98f..294552d 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -82,7 +82,7 @@ typedef struct {
struct tx_complete_data {
int size;
void *buff;
- u8 *pBssid;
+ u8 *bssid;
struct sk_buff *skb;
};

--
1.9.1


2016-01-27 02:58:23

by Glen Lee

[permalink] [raw]
Subject: [PATCH 13/13] staging: wilc1000: fixes variable dereferenced before check

From: Leo Kim <[email protected]>

This patch fixes the warning reported by smatch.
- wilc_wlan_get_firmware() warn: variable dereferenced before check 'vif'
- wilc_set_multicast_list() warn: variable dereferenced before check 'dev'

Just delete them and no need add null check since they are net_device from
ndo_set_rx_mode of net_device_ops and vif of netdev_priv.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 9ca33536..22a2f98 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -397,9 +397,6 @@ int wilc_wlan_get_firmware(struct net_device *dev)

netdev_info(dev, "loading firmware %s\n", firmware);

- if (!vif)
- goto _fail_;
-
if (!(&vif->ndev->dev))
goto _fail_;

@@ -1017,9 +1014,6 @@ static void wilc_set_multicast_list(struct net_device *dev)
vif = netdev_priv(dev);
hif_drv = (struct host_if_drv *)priv->hif_drv;

- if (!dev)
- return;
-
if (dev->flags & IFF_PROMISC)
return;

--
1.9.1


2016-01-27 02:57:53

by Glen Lee

[permalink] [raw]
Subject: [PATCH 08/13] staging: wilc1000: remove warnings line over 80 characters

From: Leo Kim <[email protected]>

This patch removes the warnings reported by checkpatch.pl
for line over 80 characters.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 4b544df..f03daff 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -25,7 +25,8 @@

#include <linux/semaphore.h>

-static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);
+static int dev_state_ev_handler(struct notifier_block *this,
+ unsigned long event, void *ptr);

static struct notifier_block g_dev_notifier = {
.notifier_call = dev_state_ev_handler
@@ -57,7 +58,8 @@ static const struct net_device_ops wilc_netdev_ops = {

};

-static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr)
+static int dev_state_ev_handler(struct notifier_block *this,
+ unsigned long event, void *ptr)
{
struct in_ifaddr *dev_iface = (struct in_ifaddr *)ptr;
struct wilc_priv *priv;
--
1.9.1


2016-01-27 02:57:16

by Glen Lee

[permalink] [raw]
Subject: [PATCH 02/13] staging: wilc1000: fixes no space is necessary after a cast

From: Leo Kim <[email protected]>

This patch fixes the check reported by checkpatch.pl
for 'no space is necessary after a cast'.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index db91a21..9552469 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1287,7 +1287,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
switch (cmd) {
case SIOCSIWPRIV:
{
- struct iwreq *wrq = (struct iwreq *) req;
+ struct iwreq *wrq = (struct iwreq *)req;

size = wrq->u.data.length;

--
1.9.1


2016-02-03 23:28:57

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 04/13] staging: wilc1000: rename hWILCWFIDrv of wilc_priv structure

On Wed, Jan 27, 2016 at 11:50:28AM +0900, Glen Lee wrote:
> From: Leo Kim <[email protected]>
>
> This patch renames hWILCWFIDrv pointer variable of wilc_priv structure
> to hif_drv to avoid camelcase.
>
> Signed-off-by: Leo Kim <[email protected]>
> Signed-off-by: Glen Lee <[email protected]>
> ---
> drivers/staging/wilc1000/linux_wlan.c | 8 ++++----
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 22 ++++++++++++----------
> drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
> 3 files changed, 17 insertions(+), 15 deletions(-)

This patch didn't apply, so I stopped here in the series. Please fix up
and resend.

thanks,

greg k-h