aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/wilc1000
diff options
context:
space:
mode:
authorAjay Singh <ajay.kathat@microchip.com>2018-06-04 10:59:08 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-06-17 09:05:13 +0200
commit6adc35d973018a13076b36e85a2774fdcc24608b (patch)
tree129a7f521b4fbe5dcadfcee145f9d19085d41f63 /drivers/staging/wilc1000
parentstaging: wilc1000: use list_head to maintain 'txq_entry_t' elements of tx queue (diff)
downloadlinux-dev-6adc35d973018a13076b36e85a2774fdcc24608b.tar.xz
linux-dev-6adc35d973018a13076b36e85a2774fdcc24608b.zip
staging: wilc1000: use list_head to maintain 'rxq_entry_t elements in rx queue
Make use of 'list_head' data structure to maintain the rx buffer queue. Modified wilc_wlan_rxq_add() to add the element at the tail by using list_head API and wilc_wlan_rxq_remove() to remove the element from head. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000')
-rw-r--r--drivers/staging/wilc1000/linux_wlan.c1
-rw-r--r--drivers/staging/wilc1000/wilc_wfi_netdevice.h3
-rw-r--r--drivers/staging/wilc1000/wilc_wlan.c26
-rw-r--r--drivers/staging/wilc1000/wilc_wlan.h2
4 files changed, 12 insertions, 20 deletions
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index eac719b5ad70..0019bb8df6c1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1119,6 +1119,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
wl->gpio = gpio;
wl->hif_func = ops;
INIT_LIST_HEAD(&wl->txq_head.list);
+ INIT_LIST_HEAD(&wl->rxq_head.list);
register_inetaddr_notifier(&g_dev_notifier);
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index e1fab734c82a..ba57f42755f5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -161,8 +161,7 @@ struct wilc {
int txq_entries;
int txq_exit;
- struct rxq_entry_t *rxq_head;
- struct rxq_entry_t *rxq_tail;
+ struct rxq_entry_t rxq_head;
int rxq_entries;
int rxq_exit;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 857cc382b2d3..059c5c73ee68 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -404,15 +404,7 @@ static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
return 0;
mutex_lock(&wilc->rxq_cs);
- if (!wilc->rxq_head) {
- rqe->next = NULL;
- wilc->rxq_head = rqe;
- wilc->rxq_tail = rqe;
- } else {
- wilc->rxq_tail->next = rqe;
- rqe->next = NULL;
- wilc->rxq_tail = rqe;
- }
+ list_add_tail(&rqe->list, &wilc->rxq_head.list);
wilc->rxq_entries += 1;
mutex_unlock(&wilc->rxq_cs);
return wilc->rxq_entries;
@@ -420,17 +412,17 @@ static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
{
- if (wilc->rxq_head) {
- struct rxq_entry_t *rqe;
+ struct rxq_entry_t *rqe = NULL;
- mutex_lock(&wilc->rxq_cs);
- rqe = wilc->rxq_head;
- wilc->rxq_head = wilc->rxq_head->next;
+ mutex_lock(&wilc->rxq_cs);
+ if (!list_empty(&wilc->rxq_head.list)) {
+ rqe = list_first_entry(&wilc->rxq_head.list, struct rxq_entry_t,
+ list);
+ list_del(&rqe->list);
wilc->rxq_entries -= 1;
- mutex_unlock(&wilc->rxq_cs);
- return rqe;
}
- return NULL;
+ mutex_unlock(&wilc->rxq_cs);
+ return rqe;
}
void chip_allow_sleep(struct wilc *wilc)
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index e0ff3e8c0836..dbdebf009024 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -218,7 +218,7 @@ struct txq_entry_t {
};
struct rxq_entry_t {
- struct rxq_entry_t *next;
+ struct list_head list;
u8 *buffer;
int buffer_size;
};