From aa21c004f80bdf943736c62dccf0c0398d7824f3 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 8 Dec 2007 20:04:36 +0000 Subject: libertas: kill struct lbs_adapter There seems to be no reason for a separate structure; move it all into struct lbs_private. Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/tx.c | 63 ++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 33 deletions(-) (limited to 'drivers/net/wireless/libertas/tx.c') diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 131ef3f..4cb39d3 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -64,11 +64,11 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) u8 *p802x_hdr; struct tx_radiotap_hdr *pradiotap_hdr; u32 new_rate; - u8 *ptr = priv->adapter->tmptxbuf; + u8 *ptr = priv->tmptxbuf; lbs_deb_enter(LBS_DEB_TX); - if (priv->adapter->surpriseremoved) + if (priv->surpriseremoved) return -1; if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { @@ -86,7 +86,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); p802x_hdr = skb->data; - if (priv->adapter->monitormode != LBS_MONITOR_OFF) { + if (priv->monitormode != LBS_MONITOR_OFF) { /* locate radiotap header */ pradiotap_hdr = (struct tx_radiotap_hdr *)skb->data; @@ -106,7 +106,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) } /* copy destination address from 802.3 or 802.11 header */ - if (priv->adapter->monitormode != LBS_MONITOR_OFF) + if (priv->monitormode != LBS_MONITOR_OFF) memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN); else memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN); @@ -124,7 +124,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) lbs_deb_hex(LBS_DEB_TX, "Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); ret = priv->hw_host_to_card(priv, MVMS_DAT, - priv->adapter->tmptxbuf, + priv->tmptxbuf, le16_to_cpu(plocaltxpd->tx_packet_length) + sizeof(struct txpd)); @@ -144,7 +144,7 @@ done: priv->stats.tx_errors++; } - if (!ret && priv->adapter->monitormode != LBS_MONITOR_OFF) { + if (!ret && priv->monitormode != LBS_MONITOR_OFF) { /* Keep the skb to echo it back once Tx feedback is received from FW */ skb_orphan(skb); @@ -154,7 +154,7 @@ done: netif_stop_queue(priv->mesh_dev); /* Keep the skb around for when we get feedback */ - priv->adapter->currenttxskb = skb; + priv->currenttxskb = skb; } else { dev_kfree_skb_any(skb); } @@ -166,29 +166,27 @@ done: void lbs_tx_runqueue(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; int i; - spin_lock(&adapter->txqueue_lock); - for (i = 0; i < adapter->tx_queue_idx; i++) { - struct sk_buff *skb = adapter->tx_queue_ps[i]; - spin_unlock(&adapter->txqueue_lock); + spin_lock(&priv->txqueue_lock); + for (i = 0; i < priv->tx_queue_idx; i++) { + struct sk_buff *skb = priv->tx_queue_ps[i]; + spin_unlock(&priv->txqueue_lock); SendSinglePacket(priv, skb); - spin_lock(&adapter->txqueue_lock); + spin_lock(&priv->txqueue_lock); } - adapter->tx_queue_idx = 0; - spin_unlock(&adapter->txqueue_lock); + priv->tx_queue_idx = 0; + spin_unlock(&priv->txqueue_lock); } static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb) { - struct lbs_adapter *adapter = priv->adapter; - spin_lock(&adapter->txqueue_lock); + spin_lock(&priv->txqueue_lock); - WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE); - adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; - if (adapter->tx_queue_idx == NR_TX_QUEUE) { + WARN_ON(priv->tx_queue_idx >= NR_TX_QUEUE); + priv->tx_queue_ps[priv->tx_queue_idx++] = skb; + if (priv->tx_queue_idx == NR_TX_QUEUE) { netif_stop_queue(priv->dev); if (priv->mesh_dev) netif_stop_queue(priv->mesh_dev); @@ -198,7 +196,7 @@ static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb) netif_start_queue(priv->mesh_dev); } - spin_unlock(&adapter->txqueue_lock); + spin_unlock(&priv->txqueue_lock); } /** @@ -221,8 +219,8 @@ int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) goto done; } - if ((priv->adapter->psstate == PS_STATE_SLEEP) || - (priv->adapter->psstate == PS_STATE_PRE_SLEEP)) { + if ((priv->psstate == PS_STATE_SLEEP) || + (priv->psstate == PS_STATE_PRE_SLEEP)) { lbs_tx_queue(priv, skb); return ret; } @@ -244,17 +242,16 @@ done: */ void lbs_send_tx_feedback(struct lbs_private *priv) { - struct lbs_adapter *adapter = priv->adapter; struct tx_radiotap_hdr *radiotap_hdr; - u32 status = adapter->eventcause; + u32 status = priv->eventcause; int txfail; int try_count; - if (adapter->monitormode == LBS_MONITOR_OFF || - adapter->currenttxskb == NULL) + if (priv->monitormode == LBS_MONITOR_OFF || + priv->currenttxskb == NULL) return; - radiotap_hdr = (struct tx_radiotap_hdr *)adapter->currenttxskb->data; + radiotap_hdr = (struct tx_radiotap_hdr *)priv->currenttxskb->data; txfail = (status >> 24); @@ -267,14 +264,14 @@ void lbs_send_tx_feedback(struct lbs_private *priv) #endif try_count = (status >> 16) & 0xff; radiotap_hdr->data_retries = (try_count) ? - (1 + adapter->txretrycount - try_count) : 0; - lbs_upload_rx_packet(priv, adapter->currenttxskb); - adapter->currenttxskb = NULL; + (1 + priv->txretrycount - try_count) : 0; + lbs_upload_rx_packet(priv, priv->currenttxskb); + priv->currenttxskb = NULL; - if (adapter->connect_status == LBS_CONNECTED) + if (priv->connect_status == LBS_CONNECTED) netif_wake_queue(priv->dev); - if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) + if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) netif_wake_queue(priv->mesh_dev); } EXPORT_SYMBOL_GPL(lbs_send_tx_feedback); -- cgit v1.1