Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / net / wan / wanxl.c
index 6370aa7..29a756d 100644 (file)
@@ -26,8 +26,9 @@
 #include <linux/netdevice.h>
 #include <linux/hdlc.h>
 #include <linux/pci.h>
+#include <linux/dma-mapping.h>
+#include <linux/delay.h>
 #include <asm/io.h>
-#include <asm/delay.h>
 
 #include "wanxl.h"
 
@@ -71,8 +72,8 @@ typedef struct card_t {
        int n_ports;            /* 1, 2 or 4 ports */
        u8 irq;
 
-       u8 *plx;                /* PLX PCI9060 virtual base address */
-       struct pci_dev *pdev;   /* for pdev->slot_name */
+       u8 __iomem *plx;        /* PLX PCI9060 virtual base address */
+       struct pci_dev *pdev;   /* for pci_name(pdev) */
        int rx_in;
        struct sk_buff *rx_skbs[RX_QUEUE_LENGTH];
        card_status_t *status;  /* shared between host and card */
@@ -88,12 +89,6 @@ static inline port_t* dev_to_port(struct net_device *dev)
 }
 
 
-static inline const char* card_name(struct pci_dev *pdev)
-{
-       return pdev->slot_name;
-}
-
-
 static inline port_status_t* get_status(port_t *port)
 {
        return &port->card->status->port_status[port->node];
@@ -107,7 +102,7 @@ static inline dma_addr_t pci_map_single_debug(struct pci_dev *pdev, void *ptr,
        dma_addr_t addr = pci_map_single(pdev, ptr, size, direction);
        if (addr + size > 0x100000000LL)
                printk(KERN_CRIT "wanXL %s: pci_map_single() returned memory"
-                      " at 0x%LX!\n", card_name(pdev),
+                      " at 0x%LX!\n", pci_name(pdev),
                       (unsigned long long)addr);
        return addr;
 }
@@ -201,7 +196,7 @@ static inline void wanxl_rx_intr(card_t *card)
               desc->stat != PACKET_EMPTY) {
                if ((desc->stat & PACKET_PORT_MASK) > card->n_ports)
                        printk(KERN_CRIT "wanXL %s: received packet for"
-                              " nonexistent port\n", card_name(card->pdev));
+                              " nonexistent port\n", pci_name(card->pdev));
                else {
                        struct sk_buff *skb = card->rx_skbs[card->rx_in];
                        port_t *port = &card->ports[desc->stat &
@@ -224,8 +219,6 @@ static inline void wanxl_rx_intr(card_t *card)
 #endif
                                stats->rx_packets++;
                                stats->rx_bytes += skb->len;
-                               skb->mac.raw = skb->data;
-                               skb->dev = dev;
                                dev->last_rx = jiffies;
                                skb->protocol = hdlc_type_trans(skb, dev);
                                netif_rx(skb);
@@ -399,7 +392,7 @@ static int wanxl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 static int wanxl_open(struct net_device *dev)
 {
        port_t *port = dev_to_port(dev);
-       u8 *dbr = port->card->plx + PLX_DOORBELL_TO_CARD;
+       u8 __iomem *dbr = port->card->plx + PLX_DOORBELL_TO_CARD;
        unsigned long timeout;
        int i;
 
@@ -562,7 +555,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
        unsigned long timeout;
        u32 plx_phy;            /* PLX PCI base address */
        u32 mem_phy;            /* memory PCI base addr */
-       u8 *mem;                /* memory virtual base addr */
+       u8 __iomem *mem;        /* memory virtual base addr */
        int i, ports, alloc_size;
 
 #ifndef MODULE
@@ -584,8 +577,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
           We set both dma_mask and consistent_dma_mask to 28 bits
           and pray pci_alloc_consistent() will use this info. It should
           work on most platforms */
-       if (pci_set_consistent_dma_mask(pdev, 0x0FFFFFFF) ||
-           pci_set_dma_mask(pdev, 0x0FFFFFFF)) {
+       if (pci_set_consistent_dma_mask(pdev, DMA_28BIT_MASK) ||
+           pci_set_dma_mask(pdev, DMA_28BIT_MASK)) {
                printk(KERN_ERR "wanXL: No usable DMA configuration\n");
                return -EIO;
        }
@@ -606,7 +599,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
        card = kmalloc(alloc_size, GFP_KERNEL);
        if (card == NULL) {
                printk(KERN_ERR "wanXL %s: unable to allocate memory\n",
-                      card_name(pdev));
+                      pci_name(pdev));
                pci_release_regions(pdev);
                pci_disable_device(pdev);
                return -ENOBUFS;
@@ -625,15 +618,15 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
 
 #ifdef DEBUG_PCI
        printk(KERN_DEBUG "wanXL %s: pci_alloc_consistent() returned memory"
-              " at 0x%LX\n", card_name(pdev),
+              " at 0x%LX\n", pci_name(pdev),
               (unsigned long long)card->status_address);
 #endif
 
        /* FIXME when PCI/DMA subsystems are fixed.
           We set both dma_mask and consistent_dma_mask back to 32 bits
           to indicate the card can do 32-bit DMA addressing */
-       if (pci_set_consistent_dma_mask(pdev, 0xFFFFFFFF) ||
-           pci_set_dma_mask(pdev, 0xFFFFFFFF)) {
+       if (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK) ||
+           pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
                printk(KERN_ERR "wanXL: No usable DMA configuration\n");
                wanxl_pci_remove_one(pdev);
                return -EIO;
@@ -651,7 +644,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
        while ((stat = readl(card->plx + PLX_MAILBOX_0)) != 0) {
                if (time_before(timeout, jiffies)) {
                        printk(KERN_WARNING "wanXL %s: timeout waiting for"
-                              " PUTS to complete\n", card_name(pdev));
+                              " PUTS to complete\n", pci_name(pdev));
                        wanxl_pci_remove_one(pdev);
                        return -ENODEV;
                }
@@ -663,7 +656,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
 
                default:
                        printk(KERN_WARNING "wanXL %s: PUTS test 0x%X"
-                              " failed\n", card_name(pdev), stat & 0x30);
+                              " failed\n", pci_name(pdev), stat & 0x30);
                        wanxl_pci_remove_one(pdev);
                        return -ENODEV;
                }
@@ -683,7 +676,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
            (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports) {
                printk(KERN_WARNING "wanXL %s: no enough on-board RAM"
                       " (%u bytes detected, %u bytes required)\n",
-                      card_name(pdev), ramsize, BUFFERS_ADDR +
+                      pci_name(pdev), ramsize, BUFFERS_ADDR +
                       (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports);
                wanxl_pci_remove_one(pdev);
                return -ENODEV;
@@ -691,7 +684,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
 
        if (wanxl_puts_command(card, MBX1_CMD_BSWAP)) {
                printk(KERN_WARNING "wanXL %s: unable to Set Byte Swap"
-                      " Mode\n", card_name(pdev));
+                      " Mode\n", pci_name(pdev));
                wanxl_pci_remove_one(pdev);
                return -ENODEV;
        }
@@ -722,7 +715,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
 
        if (wanxl_puts_command(card, MBX1_CMD_ABORTJ)) {
                printk(KERN_WARNING "wanXL %s: unable to Abort and Jump\n",
-                      card_name(pdev));
+                      pci_name(pdev));
                wanxl_pci_remove_one(pdev);
                return -ENODEV;
        }
@@ -737,7 +730,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
 
        if (!stat) {
                printk(KERN_WARNING "wanXL %s: timeout while initializing card"
-                      "firmware\n", card_name(pdev));
+                      "firmware\n", pci_name(pdev));
                wanxl_pci_remove_one(pdev);
                return -ENODEV;
        }
@@ -747,12 +740,12 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
 #endif
 
        printk(KERN_INFO "wanXL %s: at 0x%X, %u KB of RAM at 0x%X, irq %u\n",
-              card_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq);
+              pci_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq);
 
        /* Allocate IRQ */
        if (request_irq(pdev->irq, wanxl_intr, SA_SHIRQ, "wanXL", card)) {
                printk(KERN_WARNING "wanXL %s: could not allocate IRQ%i.\n",
-                      card_name(pdev), pdev->irq);
+                      pci_name(pdev), pdev->irq);
                wanxl_pci_remove_one(pdev);
                return -EBUSY;
        }
@@ -764,7 +757,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
                struct net_device *dev = alloc_hdlcdev(port);
                if (!dev) {
                        printk(KERN_ERR "wanXL %s: unable to allocate"
-                              " memory\n", card_name(pdev));
+                              " memory\n", pci_name(pdev));
                        wanxl_pci_remove_one(pdev);
                        return -ENOMEM;
                }
@@ -785,7 +778,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
                get_status(port)->clocking = CLOCK_EXT;
                if (register_hdlc_device(dev)) {
                        printk(KERN_ERR "wanXL %s: unable to register hdlc"
-                              " device\n", card_name(pdev));
+                              " device\n", pci_name(pdev));
                        free_netdev(dev);
                        wanxl_pci_remove_one(pdev);
                        return -ENOBUFS;
@@ -793,7 +786,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
                card->n_ports++;
        }
 
-       printk(KERN_INFO "wanXL %s: port", card_name(pdev));
+       printk(KERN_INFO "wanXL %s: port", pci_name(pdev));
        for (i = 0; i < ports; i++)
                printk("%s #%i: %s", i ? "," : "", i,
                       card->ports[i].dev->name);