summaryrefslogtreecommitdiff
path: root/drivers/dahdi/xpp/xbus-pcm.c
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-07-13 19:38:13 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-07-13 19:38:13 +0000
commit4be5101ff455df8ed4097977587cf2f34addb7cc (patch)
tree35f5fcc4ddc405988864af7a80fcffb2271db1b6 /drivers/dahdi/xpp/xbus-pcm.c
parentce0d2d4620f49e6ac0ec697733c786369ad8c822 (diff)
start migrating from xbus_num() to get_xbus()/put_xbus()
* Now get_xbus() receive and xbus number (not poiner) and uses xbus_num() internally to map it to an xbus pointer + refcount increment. (this is atomic) * Migrate all obvious places that used xbus_num() to map bus number into a pointer, so now they use get_xbus() + put_xbus() to aquire and release an xbus. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8913 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp/xbus-pcm.c')
-rw-r--r--drivers/dahdi/xpp/xbus-pcm.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/dahdi/xpp/xbus-pcm.c b/drivers/dahdi/xpp/xbus-pcm.c
index ca722cf..ce5c0fa 100644
--- a/drivers/dahdi/xpp/xbus-pcm.c
+++ b/drivers/dahdi/xpp/xbus-pcm.c
@@ -440,9 +440,9 @@ static void reset_sync_counters(void)
//DBG(SYNC, "%d\n", atomic_read(&xpp_tick_counter));
for(i = 0; i < MAX_BUSES; i++) {
- xbus_t *xbus = xbus_num(i);
+ xbus_t *xbus = get_xbus(__func__, i);
- if(!xbus)
+ if (xbus == NULL)
continue;
/*
* Don't send to non self_ticking Astribanks:
@@ -459,6 +459,7 @@ static void reset_sync_counters(void)
CALL_PROTO(GLOBAL, RESET_SYNC_COUNTERS, xbus, NULL);
}
}
+ put_xbus(__func__, xbus);
}
}
@@ -589,8 +590,8 @@ static void update_sync_master(xbus_t *new_syncer, bool force_dahdi)
DBG(SYNC, "stop unwanted syncers\n");
/* Shut all down except the wanted sync master */
for(i = 0; i < MAX_BUSES; i++) {
- xbus_t *xbus = xbus_num(i);
- if(!xbus)
+ xbus_t *xbus = get_xbus(__func__, i);
+ if (xbus == NULL)
continue;
if(XBUS_FLAGS(xbus, CONNECTED) && xbus != new_syncer) {
if(xbus->self_ticking)
@@ -599,6 +600,7 @@ static void update_sync_master(xbus_t *new_syncer, bool force_dahdi)
else
XBUS_DBG(SYNC, xbus, "Not self_ticking yet. Ignore\n");
}
+ put_xbus(__func__, xbus);
}
}
@@ -612,9 +614,12 @@ void elect_syncer(const char *msg)
unsigned long flags;
spin_lock_irqsave(&elect_syncer_lock, flags);
+ DBG(SYNC, "%s: %s syncer=%s\n", __func__, msg,
+ (syncer) ? syncer->busname : "NULL");
for(i = 0; i < MAX_BUSES; i++) {
- xbus_t *xbus = xbus_num(i);
- if(!xbus)
+ xbus_t *xbus = get_xbus(__func__, i);
+
+ if (xbus == NULL)
continue;
if(XBUS_IS(xbus, READY)) {
if(!the_xbus)
@@ -638,6 +643,7 @@ void elect_syncer(const char *msg)
}
}
}
+ put_xbus(__func__, xbus);
}
if(best_xpd) {
the_xbus = best_xpd->xbus;
@@ -1177,18 +1183,22 @@ int exec_sync_command(const char *buf, size_t count)
update_sync_master(NULL, 1);
} else if(sscanf(buf, "SYNC=%d", &xbusno) == 1) {
DBG(SYNC, "SYNC=%d\n", xbusno);
- if((xbus = xbus_num(xbusno)) == NULL) {
+ xbus = get_xbus(__func__, xbusno);
+ if (xbus == NULL) {
ERR("No bus %d exists\n", xbusno);
return -ENXIO;
}
update_sync_master(xbus, 0);
+ put_xbus(__func__, xbus);
} else if(sscanf(buf, "QUERY=%d", &xbusno) == 1) {
DBG(SYNC, "QUERY=%d\n", xbusno);
- if((xbus = xbus_num(xbusno)) == NULL) {
+ xbus = get_xbus(__func__, xbusno);
+ if (xbus == NULL) {
ERR("No bus %d exists\n", xbusno);
return -ENXIO;
}
CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, SYNC_MODE_QUERY, 0);
+ put_xbus(__func__, xbus);
} else {
ERR("%s: cannot parse '%s'\n", __FUNCTION__, buf);
ret = -EINVAL;