summaryrefslogtreecommitdiff
path: root/drivers/dahdi/tor2.c
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2009-01-26 19:44:36 +0000
committerShaun Ruffell <sruffell@digium.com>2009-01-26 19:44:36 +0000
commit6a667c6c569b2789ed4b1be843aabd1e32541ab5 (patch)
treea20affbdb276a90ffdba354caf4c65130589553a /drivers/dahdi/tor2.c
parent27fbaab1cefb2ea00c9249cd3856faf36b256a7c (diff)
Manipulate the REGISTERED flag with atomic bitops now since the bit is set
outside the protection of any locks. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@5819 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/tor2.c')
-rw-r--r--drivers/dahdi/tor2.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/dahdi/tor2.c b/drivers/dahdi/tor2.c
index c057500..9ae8169 100644
--- a/drivers/dahdi/tor2.c
+++ b/drivers/dahdi/tor2.c
@@ -314,7 +314,7 @@ static void init_spans(struct tor2 *tor)
static int __devinit tor2_launch(struct tor2 *tor)
{
- if (tor->spans[0].flags & DAHDI_FLAG_REGISTERED)
+ if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->spans[0].flags))
return 0;
printk(KERN_INFO "Tor2: Launching card: %d\n", tor->order);
if (dahdi_register(&tor->spans[0], 0)) {
@@ -618,6 +618,7 @@ static struct pci_driver tor2_driver;
static void __devexit tor2_remove(struct pci_dev *pdev)
{
struct tor2 *tor;
+ int i;
tor = pci_get_drvdata(pdev);
if (!tor)
@@ -627,14 +628,10 @@ static void __devexit tor2_remove(struct pci_dev *pdev)
tor->mem8[LEDREG] = 0;
tor->plx[INTCSR] = cpu_to_le16(0);
free_irq(tor->irq, tor);
- if (tor->spans[0].flags & DAHDI_FLAG_REGISTERED)
- dahdi_unregister(&tor->spans[0]);
- if (tor->spans[1].flags & DAHDI_FLAG_REGISTERED)
- dahdi_unregister(&tor->spans[1]);
- if (tor->spans[2].flags & DAHDI_FLAG_REGISTERED)
- dahdi_unregister(&tor->spans[2]);
- if (tor->spans[3].flags & DAHDI_FLAG_REGISTERED)
- dahdi_unregister(&tor->spans[3]);
+ for (i = 0; i < SPANS_PER_CARD; ++i) {
+ if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->spans[i].flags))
+ dahdi_unregister(&tor->spans[i]);
+ }
release_mem_region(tor->plx_region, tor->plx_len);
release_mem_region(tor->xilinx32_region, tor->xilinx32_len);
release_mem_region(tor->xilinx8_region, tor->xilinx8_len);