diff options
-rw-r--r-- | drivers/dahdi/dahdi-base.c | 18 | ||||
-rw-r--r-- | drivers/dahdi/dahdi_dynamic.c | 2 | ||||
-rw-r--r-- | drivers/dahdi/tor2.c | 15 | ||||
-rw-r--r-- | drivers/dahdi/wct1xxp.c | 2 | ||||
-rw-r--r-- | drivers/dahdi/wct4xxp/base.c | 18 | ||||
-rw-r--r-- | drivers/dahdi/wcte11xp.c | 2 | ||||
-rw-r--r-- | drivers/dahdi/wcte12xp/base.c | 2 | ||||
-rw-r--r-- | include/dahdi/kernel.h | 2 |
8 files changed, 28 insertions, 33 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 324fbba..fee2836 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -1167,7 +1167,7 @@ static void release_echocan(const struct dahdi_echocan *ec) * * This function might be called before the channel is placed on the global * array of channels, (chans), and therefore, neither this function nor it's - * children should depend on the dahdi_chan.chano member which is not set yet. + * children should depend on the dahdi_chan.channo member which is not set yet. */ static void close_channel(struct dahdi_chan *chan) { @@ -1512,7 +1512,7 @@ static int dahdi_chan_reg(struct dahdi_chan *chan) write_unlock_irqrestore(&chan_lock, flags); /* set this AFTER running close_channel() so that HDLC channels wont cause hangage */ - chan->flags |= DAHDI_FLAG_REGISTERED; + set_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags); break; } @@ -1885,9 +1885,9 @@ static void dahdi_chan_unreg(struct dahdi_chan *chan) } #endif write_lock_irqsave(&chan_lock, flags); - if (chan->flags & DAHDI_FLAG_REGISTERED) { + if (test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags)) { chans[chan->channo] = NULL; - chan->flags &= ~DAHDI_FLAG_REGISTERED; + clear_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags); } #ifdef CONFIG_DAHDI_PPP if (chan->ppp) { @@ -2414,7 +2414,7 @@ static int dahdi_hangup(struct dahdi_chan *chan) } /* if not registered yet, just return here */ - if (!(chan->flags & DAHDI_FLAG_REGISTERED)) + if (!test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags)) return res; /* Mark all buffers as empty */ @@ -5412,7 +5412,7 @@ int dahdi_register(struct dahdi_span *span, int prefmaster) if (!span) return -EINVAL; - if (span->flags & DAHDI_FLAG_REGISTERED) { + if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) { module_printk(KERN_ERR, "Span %s already appears to be registered\n", span->name); return -EBUSY; } @@ -5438,7 +5438,7 @@ int dahdi_register(struct dahdi_span *span, int prefmaster) return -EBUSY; } - span->flags |= DAHDI_FLAG_REGISTERED; + set_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags); span->spanno = x; spin_lock_init(&span->lock); @@ -5506,7 +5506,7 @@ int dahdi_unregister(struct dahdi_span *span) char tempfile[17]; #endif /* CONFIG_PROC_FS */ - if (!(span->flags & DAHDI_FLAG_REGISTERED)) { + if (!test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) { module_printk(KERN_ERR, "Span %s does not appear to be registered\n", span->name); return -1; } @@ -5533,7 +5533,7 @@ int dahdi_unregister(struct dahdi_span *span) spans[span->spanno] = NULL; span->spanno = 0; - span->flags &= ~DAHDI_FLAG_REGISTERED; + clear_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags); for (x=0;x<span->channels;x++) dahdi_chan_unreg(span->chans[x]); new_maxspans = 0; diff --git a/drivers/dahdi/dahdi_dynamic.c b/drivers/dahdi/dahdi_dynamic.c index 4a52983..2e674fa 100644 --- a/drivers/dahdi/dahdi_dynamic.c +++ b/drivers/dahdi/dahdi_dynamic.c @@ -414,7 +414,7 @@ static void dynamic_destroy(struct dahdi_dynamic *z) unsigned int x; /* Unregister span if appropriate */ - if (z->span.flags & DAHDI_FLAG_REGISTERED) + if (test_bit(DAHDI_FLAGBIT_REGISTERED, &z->span.flags)) dahdi_unregister(&z->span); /* Destroy the pvt stuff if there */ 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); diff --git a/drivers/dahdi/wct1xxp.c b/drivers/dahdi/wct1xxp.c index 9d0e4e5..0eaaf2f 100644 --- a/drivers/dahdi/wct1xxp.c +++ b/drivers/dahdi/wct1xxp.c @@ -624,7 +624,7 @@ static int t1xxp_startup(struct dahdi_span *span) t1xxp_e1_framer_start(wc); else t1xxp_t1_framer_start(wc); - printk(KERN_INFO "Calling startup (flags is %d)\n", span->flags); + printk(KERN_INFO "Calling startup (flags is %lu)\n", span->flags); if (!alreadyrunning) { /* Only if we're not already going */ diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c index 83dd28d..19f3d00 100644 --- a/drivers/dahdi/wct4xxp/base.c +++ b/drivers/dahdi/wct4xxp/base.c @@ -3441,7 +3441,7 @@ static int __devinit t4_launch(struct t4 *wc) { int x; unsigned long flags; - if (wc->tspans[0]->span.flags & DAHDI_FLAG_REGISTERED) + if (test_bit(DAHDI_FLAGBIT_REGISTERED, &wc->tspans[0]->span.flags)) return 0; printk(KERN_INFO "TE%dXXP: Launching card: %d\n", wc->numspans, wc->order); @@ -3726,6 +3726,8 @@ static int t4_hardware_stop(struct t4 *wc) static void __devexit t4_remove_one(struct pci_dev *pdev) { struct t4 *wc = pci_get_drvdata(pdev); + struct dahdi_span *span; + int i; if (!wc) { return; @@ -3739,15 +3741,11 @@ static void __devexit t4_remove_one(struct pci_dev *pdev) release_vpm450m(wc->vpm450m); wc->vpm450m = NULL; /* Unregister spans */ - if (wc->tspans[0]->span.flags & DAHDI_FLAG_REGISTERED) - dahdi_unregister(&wc->tspans[0]->span); - if (wc->tspans[1]->span.flags & DAHDI_FLAG_REGISTERED) - dahdi_unregister(&wc->tspans[1]->span); - if (wc->numspans == 4) { - if (wc->tspans[2]->span.flags & DAHDI_FLAG_REGISTERED) - dahdi_unregister(&wc->tspans[2]->span); - if (wc->tspans[3]->span.flags & DAHDI_FLAG_REGISTERED) - dahdi_unregister(&wc->tspans[3]->span); + + for (i = 0; i < wc->numspans; ++i) { + span = &wc->tspans[i]->span; + if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) + dahdi_unregister(span); } #ifdef ENABLE_WORKQUEUES if (wc->workq) { diff --git a/drivers/dahdi/wcte11xp.c b/drivers/dahdi/wcte11xp.c index ec4c3f6..390c834 100644 --- a/drivers/dahdi/wcte11xp.c +++ b/drivers/dahdi/wcte11xp.c @@ -898,7 +898,7 @@ static int t1xxp_startup(struct dahdi_span *span) /* Reset framer with proper parameters and start */ t1xxp_framer_start(wc, span); - printk(KERN_INFO "Calling startup (flags is %d)\n", span->flags); + printk(KERN_INFO "Calling startup (flags is %lu)\n", span->flags); if (!alreadyrunning) { /* Only if we're not already going */ diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index 37ba154..4209842 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -697,7 +697,7 @@ static int t1xxp_startup(struct dahdi_span *span) /* Reset framer with proper parameters and start */ t1xxp_framer_start(wc, span); - debug_printk(1, "Calling startup (flags is %d)\n", span->flags); + debug_printk(1, "Calling startup (flags is %lu)\n", span->flags); return 0; } diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 47139e5..0fccfea 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -523,7 +523,7 @@ struct dahdi_span { char location[40]; /*!< span device's location in system */ int deflaw; /*!< Default law (DAHDI_MULAW or DAHDI_ALAW) */ int alarms; /*!< Pending alarms on span */ - int flags; + unsigned long flags; int irq; /*!< IRQ for this span's hardware */ int lbo; /*!< Span Line-Buildout */ int lineconfig; /*!< Span line configuration */ |