#include <linux/uio.h>
#include <linux/init.h>
#include <linux/ioport.h>
+#include <linux/wait.h>
#include <asm/system.h>
#include <asm/io.h>
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);
}
/********** (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;
}
// 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;
// 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);
// 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));
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 */
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;
}
hrz_check_args();
// get the juice
- return pci_module_init(&hrz_driver);
+ return pci_register_driver(&hrz_driver);
}
/********** module exit **********/