[dahdi-commits] sruffell: linux/trunk r5819 - in /linux/trunk: drivers/dahdi/ drivers/dahdi/w...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Mon Jan 26 13:44:36 CST 2009
Author: sruffell
Date: Mon Jan 26 13:44:36 2009
New Revision: 5819
URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=5819
Log:
Manipulate the REGISTERED flag with atomic bitops now since the bit is set
outside the protection of any locks.
Modified:
linux/trunk/drivers/dahdi/dahdi-base.c
linux/trunk/drivers/dahdi/dahdi_dynamic.c
linux/trunk/drivers/dahdi/tor2.c
linux/trunk/drivers/dahdi/wct1xxp.c
linux/trunk/drivers/dahdi/wct4xxp/base.c
linux/trunk/drivers/dahdi/wcte11xp.c
linux/trunk/drivers/dahdi/wcte12xp/base.c
linux/trunk/include/dahdi/kernel.h
Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=5819&r1=5818&r2=5819
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jan 26 13:44:36 2009
@@ -1167,7 +1167,7 @@
*
* 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 @@
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 @@
}
#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 @@
}
/* 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 @@
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 @@
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 @@
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 @@
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;
Modified: linux/trunk/drivers/dahdi/dahdi_dynamic.c
URL: http://svn.digium.com/svn-view/dahdi/linux/trunk/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=5819&r1=5818&r2=5819
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_dynamic.c Mon Jan 26 13:44:36 2009
@@ -414,7 +414,7 @@
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 */
Modified: linux/trunk/drivers/dahdi/tor2.c
URL: http://svn.digium.com/svn-view/dahdi/linux/trunk/drivers/dahdi/tor2.c?view=diff&rev=5819&r1=5818&r2=5819
==============================================================================
--- linux/trunk/drivers/dahdi/tor2.c (original)
+++ linux/trunk/drivers/dahdi/tor2.c Mon Jan 26 13:44:36 2009
@@ -314,7 +314,7 @@
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 void __devexit tor2_remove(struct pci_dev *pdev)
{
struct tor2 *tor;
+ int i;
tor = pci_get_drvdata(pdev);
if (!tor)
@@ -627,14 +628,10 @@
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);
Modified: linux/trunk/drivers/dahdi/wct1xxp.c
URL: http://svn.digium.com/svn-view/dahdi/linux/trunk/drivers/dahdi/wct1xxp.c?view=diff&rev=5819&r1=5818&r2=5819
==============================================================================
--- linux/trunk/drivers/dahdi/wct1xxp.c (original)
+++ linux/trunk/drivers/dahdi/wct1xxp.c Mon Jan 26 13:44:36 2009
@@ -624,7 +624,7 @@
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 */
Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=5819&r1=5818&r2=5819
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Mon Jan 26 13:44:36 2009
@@ -3441,7 +3441,7 @@
{
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 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 @@
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) {
Modified: linux/trunk/drivers/dahdi/wcte11xp.c
URL: http://svn.digium.com/svn-view/dahdi/linux/trunk/drivers/dahdi/wcte11xp.c?view=diff&rev=5819&r1=5818&r2=5819
==============================================================================
--- linux/trunk/drivers/dahdi/wcte11xp.c (original)
+++ linux/trunk/drivers/dahdi/wcte11xp.c Mon Jan 26 13:44:36 2009
@@ -898,7 +898,7 @@
/* 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 */
Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=5819&r1=5818&r2=5819
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Mon Jan 26 13:44:36 2009
@@ -697,7 +697,7 @@
/* 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;
}
Modified: linux/trunk/include/dahdi/kernel.h
URL: http://svn.digium.com/svn-view/dahdi/linux/trunk/include/dahdi/kernel.h?view=diff&rev=5819&r1=5818&r2=5819
==============================================================================
--- linux/trunk/include/dahdi/kernel.h (original)
+++ linux/trunk/include/dahdi/kernel.h Mon Jan 26 13:44:36 2009
@@ -523,7 +523,7 @@
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 */
More information about the dahdi-commits
mailing list