tree-wide: fix comment/printk typos
[linux-flexiantxendom0-natty.git] / drivers / net / wireless / prism54 / islpci_eth.c
index f49eb06..d44f8e2 100644 (file)
  */
 
 #include <linux/module.h>
+#include <linux/gfp.h>
 
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
+#include <asm/byteorder.h>
 
 #include "prismcompat.h"
 #include "isl_38xx.h"
@@ -49,7 +51,7 @@ islpci_eth_cleanup_transmit(islpci_private *priv,
 
                /* check for holes in the arrays caused by multi fragment frames
                 * searching for the last fragment of a frame */
-               if (priv->pci_map_tx_address[index] != (dma_addr_t) NULL) {
+               if (priv->pci_map_tx_address[index]) {
                        /* entry is the last fragment of a frame
                         * free the skb structure and unmap pci memory */
                        skb = priv->data_low_tx[index];
@@ -71,7 +73,7 @@ islpci_eth_cleanup_transmit(islpci_private *priv,
        }
 }
 
-int
+netdev_tx_t
 islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
 {
        islpci_private *priv = netdev_priv(ndev);
@@ -86,10 +88,9 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
        unsigned long flags;
        unsigned char wds_mac[6];
        u32 curr_frag;
-       int err = 0;
 
 #if VERBOSE > SHOW_ERROR_MESSAGES
-       DEBUG(SHOW_FUNCTION_CALLS, "islpci_eth_transmit \n");
+       DEBUG(SHOW_FUNCTION_CALLS, "islpci_eth_transmit\n");
 #endif
 
        /* lock the driver code */
@@ -106,8 +107,6 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
                isl38xx_w32_flush(priv->device_base, ISL38XX_DEV_INT_UPDATE,
                                  ISL38XX_DEV_INT_REG);
                udelay(ISL38XX_WRITEIO_DELAY);
-
-               err = -EBUSY;
                goto drop_free;
        }
        /* Check alignment and WDS frame formatting. The start of the packet should
@@ -142,7 +141,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
                        }
 
 #if VERBOSE > SHOW_ERROR_MESSAGES
-                       DEBUG(SHOW_TRACING, "memmove %p %p %i \n", skb->data,
+                       DEBUG(SHOW_TRACING, "memmove %p %p %i\n", skb->data,
                              src, skb->len);
 #endif
                } else {
@@ -151,7 +150,6 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
                        if (unlikely(newskb == NULL)) {
                                printk(KERN_ERR "%s: Cannot allocate skb\n",
                                       ndev->name);
-                               err = -ENOMEM;
                                goto drop_free;
                        }
                        newskb_offset = (4 - (long) newskb->data) & 0x03;
@@ -196,8 +194,6 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
        if (unlikely(pci_map_address == 0)) {
                printk(KERN_WARNING "%s: cannot map buffer to PCI\n",
                       ndev->name);
-
-               err = -EIO;
                goto drop_free;
        }
        /* Place the fragment in the control block structure. */
@@ -228,10 +224,8 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
                priv->data_low_tx_full = 1;
        }
 
-       /* set the transmission time */
-       ndev->trans_start = jiffies;
-       priv->statistics.tx_packets++;
-       priv->statistics.tx_bytes += skb->len;
+       ndev->stats.tx_packets++;
+       ndev->stats.tx_bytes += skb->len;
 
        /* trigger the device */
        islpci_trigger(priv);
@@ -239,13 +233,13 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
        /* unlock the driver code */
        spin_unlock_irqrestore(&priv->slock, flags);
 
-       return 0;
+       return NETDEV_TX_OK;
 
       drop_free:
-       priv->statistics.tx_dropped++;
+       ndev->stats.tx_dropped++;
        spin_unlock_irqrestore(&priv->slock, flags);
        dev_kfree_skb(skb);
-       return err;
+       return NETDEV_TX_OK;
 }
 
 static inline int
@@ -290,7 +284,7 @@ islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb)
 
                avs->version = cpu_to_be32(P80211CAPTURE_VERSION);
                avs->length = cpu_to_be32(sizeof (struct avs_80211_1_header));
-               avs->mactime = cpu_to_be64(le64_to_cpu(clock));
+               avs->mactime = cpu_to_be64(clock);
                avs->hosttime = cpu_to_be64(jiffies);
                avs->phytype = cpu_to_be32(6);  /*OFDM: 6 for (g), 8 for (a) */
                avs->channel = cpu_to_be32(channel_of_freq(freq));
@@ -324,7 +318,7 @@ islpci_eth_receive(islpci_private *priv)
        int discard = 0;
 
 #if VERBOSE > SHOW_ERROR_MESSAGES
-       DEBUG(SHOW_FUNCTION_CALLS, "islpci_eth_receive \n");
+       DEBUG(SHOW_FUNCTION_CALLS, "islpci_eth_receive\n");
 #endif
 
        /* the device has written an Ethernet frame in the data area
@@ -407,8 +401,8 @@ islpci_eth_receive(islpci_private *priv)
                skb->protocol = eth_type_trans(skb, ndev);
        }
        skb->ip_summed = CHECKSUM_NONE;
-       priv->statistics.rx_packets++;
-       priv->statistics.rx_bytes += size;
+       ndev->stats.rx_packets++;
+       ndev->stats.rx_bytes += size;
 
        /* deliver the skb to the network layer */
 #ifdef ISLPCI_ETH_DEBUG
@@ -436,7 +430,7 @@ islpci_eth_receive(islpci_private *priv)
                skb = dev_alloc_skb(MAX_FRAGMENT_SIZE_RX + 2);
                if (unlikely(skb == NULL)) {
                        /* error allocating an sk_buff structure elements */
-                       DEBUG(SHOW_ERROR_MESSAGES, "Error allocating skb \n");
+                       DEBUG(SHOW_ERROR_MESSAGES, "Error allocating skb\n");
                        break;
                }
                skb_reserve(skb, (4 - (long) skb->data) & 0x03);
@@ -455,8 +449,8 @@ islpci_eth_receive(islpci_private *priv)
                    pci_map_single(priv->pdev, (void *) skb->data,
                                   MAX_FRAGMENT_SIZE_RX + 2,
                                   PCI_DMA_FROMDEVICE);
-               if (unlikely(priv->pci_map_rx_address[index] == (dma_addr_t) NULL)) {
-                       /* error mapping the buffer to device accessable memory address */
+               if (unlikely(!priv->pci_map_rx_address[index])) {
+                       /* error mapping the buffer to device accessible memory address */
                        DEBUG(SHOW_ERROR_MESSAGES,
                              "Error mapping DMA address\n");
 
@@ -471,8 +465,8 @@ islpci_eth_receive(islpci_private *priv)
                wmb();
 
                /* increment the driver read pointer */
-               add_le32p((u32 *) &control_block->
-                         driver_curr_frag[ISL38XX_CB_RX_DATA_LQ], 1);
+               le32_add_cpu(&control_block->
+                            driver_curr_frag[ISL38XX_CB_RX_DATA_LQ], 1);
        }
 
        /* trigger the device */
@@ -496,10 +490,9 @@ void
 islpci_eth_tx_timeout(struct net_device *ndev)
 {
        islpci_private *priv = netdev_priv(ndev);
-       struct net_device_stats *statistics = &priv->statistics;
 
        /* increment the transmit error counter */
-       statistics->tx_errors++;
+       ndev->stats.tx_errors++;
 
        if (!priv->reset_task_pending) {
                printk(KERN_WARNING