Commit 6adc35d9 authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

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: default avatarAjay Singh <ajay.kathat@microchip.com>
Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3d9241d6
......@@ -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);
......
......@@ -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;
......
......@@ -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)
......
......@@ -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;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment