This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / atm / horizon.c
index 088440b..821c81e 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/uio.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
+#include <linux/wait.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -1033,7 +1034,7 @@ static void rx_schedule (hrz_dev * dev, int irq) {
          struct atm_vcc * vcc = ATM_SKB(skb)->vcc;
          // VC layer stats
          atomic_inc(&vcc->stats->rx);
-         do_gettimeofday(&skb->stamp);
+         __net_timestamp(skb);
          // end of our responsability
          vcc->push (vcc, skb);
        }
@@ -1089,13 +1090,11 @@ static inline void rx_bus_master_complete_handler (hrz_dev * dev) {
 /********** (queue to) become the next TX thread **********/
 
 static inline int tx_hold (hrz_dev * dev) {
-  while (test_and_set_bit (tx_busy, &dev->flags)) {
-    PRINTD (DBG_TX, "sleeping at tx lock %p %lu", dev, dev->flags);
-    interruptible_sleep_on (&dev->tx_queue);
-    PRINTD (DBG_TX, "woken at tx lock %p %lu", dev, dev->flags);
-    if (signal_pending (current))
-      return -1;
-  }
+  PRINTD (DBG_TX, "sleeping at tx lock %p %lu", dev, dev->flags);
+  wait_event_interruptible(dev->tx_queue, (!test_and_set_bit(tx_busy, &dev->flags)));
+  PRINTD (DBG_TX, "woken at tx lock %p %lu", dev, dev->flags);
+  if (signal_pending (current))
+    return -1;
   PRINTD (DBG_TX, "set tx_busy for dev %p", dev);
   return 0;
 }
@@ -1512,8 +1511,8 @@ static inline short setup_idle_tx_channel (hrz_dev * dev, hrz_vcc * vcc) {
     // a.k.a. prepare the channel and remember that we have done so.
     
     tx_ch_desc * tx_desc = &memmap->tx_descs[tx_channel];
-    u16 rd_ptr;
-    u16 wr_ptr;
+    u32 rd_ptr;
+    u32 wr_ptr;
     u16 channel = vcc->channel;
     
     unsigned long flags;
@@ -2706,18 +2705,18 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_
        // adapter slot free, read resources from PCI configuration space
        u32 iobase = pci_resource_start (pci_dev, 0);
        u32 * membase = bus_to_virt (pci_resource_start (pci_dev, 1));
-       u8 irq = pci_dev->irq;
+       unsigned int irq;
        unsigned char lat;
 
        PRINTD (DBG_FLOW, "hrz_probe");
 
-       /* XXX DEV_LABEL is a guess */
-       if (!request_region(iobase, HRZ_IO_EXTENT, DEV_LABEL))
+       if (pci_enable_device(pci_dev))
                return -EINVAL;
 
-       if (pci_enable_device(pci_dev)) {
-               err = -EINVAL;
-               goto out_release;
+       /* XXX DEV_LABEL is a guess */
+       if (!request_region(iobase, HRZ_IO_EXTENT, DEV_LABEL)) {
+               return -EINVAL;
+               goto out_disable;
        }
 
        dev = kmalloc(sizeof(hrz_dev), GFP_KERNEL);
@@ -2725,7 +2724,7 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_
                // perhaps we should be nice: deregister all adapters and abort?
                PRINTD(DBG_ERR, "out of memory");
                err = -ENOMEM;
-               goto out_disable;
+               goto out_release;
        }
 
        memset(dev, 0, sizeof(hrz_dev));
@@ -2733,6 +2732,7 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_
        pci_set_drvdata(pci_dev, dev);
 
        // grab IRQ and install handler - move this someplace more sensible
+       irq = pci_dev->irq;
        if (request_irq(irq,
                        interrupt_handler,
                        SA_SHIRQ, /* irqflags guess */
@@ -2846,10 +2846,10 @@ out_free_irq:
        free_irq(dev->irq, dev);
 out_free:
        kfree(dev);
-out_disable:
-       pci_disable_device(pci_dev);
 out_release:
        release_region(iobase, HRZ_IO_EXTENT);
+out_disable:
+       pci_disable_device(pci_dev);
        goto out;
 }
 
@@ -2938,7 +2938,7 @@ static int __init hrz_module_init (void) {
   hrz_check_args();
   
   // get the juice
-  return pci_module_init(&hrz_driver);
+  return pci_register_driver(&hrz_driver);
 }
 
 /********** module exit **********/