dahdi_dynamic: Use dahdi_span_ops.sync_tick for driving dynamic spans.

Dynamic spans that are unable to provide their own timing, like dahdi
local spans, typically derived their timing source from
dahdi_dynamic_ioctl(0,0) call in process_masterspan.

This change uses the sync_tick member of dahdi_span_ops instead so that
dynamic operations do not happen on a span until it is fully registered.
Also removes the check for dahdi_dynamic_ioctl in process masterspan for
those users that never load a dynamic span.

This was originally suggested in a comment on:
(issue #13205)

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9576 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2011-01-03 18:25:45 +00:00
parent 8c709f9aa0
commit e3bf2fe45d
2 changed files with 22 additions and 11 deletions

View File

@ -8458,10 +8458,6 @@ static void process_masterspan(void)
/* Process any timers */
process_timers();
/* If we have dynamic stuff, call the ioctl with 0,0 parameters to
make it run */
if (dahdi_dynamic_ioctl)
dahdi_dynamic_ioctl(0, 0);
for (y = 1; y < maxspans; ++y) {
s = spans[y];

View File

@ -35,6 +35,10 @@
#include <dahdi/kernel.h>
#ifndef DAHDI_SYNC_TICK
#error "Dynamic support depends on DAHDI_SYNC_TICK being enabled."
#endif
/*
* Tasklets provide better system interactive response at the cost of the
* possibility of losing a frame of data at very infrequent intervals. If
@ -533,12 +537,30 @@ static int dahdi_dynamic_close(struct dahdi_chan *chan)
return 0;
}
static int dahdi_dynamic_sync_tick(struct dahdi_span *span, int is_master)
{
struct dahdi_dynamic *head;
struct dahdi_dynamic *d = dynamic_from_span(span);
if (hasmaster)
return 0;
rcu_read_lock();
head = list_entry(dspan_list.next, struct dahdi_dynamic, list);
rcu_read_unlock();
if (d == head)
dahdi_dynamic_run();
return 0;
}
static const struct dahdi_span_ops dynamic_ops = {
.owner = THIS_MODULE,
.rbsbits = dahdi_dynamic_rbsbits,
.open = dahdi_dynamic_open,
.close = dahdi_dynamic_close,
.chanconfig = dahdi_dynamic_chanconfig,
.sync_tick = dahdi_dynamic_sync_tick,
};
static int create_dynamic(struct dahdi_dynamic_span *dds)
@ -689,13 +711,6 @@ static int dahdi_dynamic_ioctl(unsigned int cmd, unsigned long data)
struct dahdi_dynamic_span dds;
int res;
switch(cmd) {
case 0:
/* This is called just before rotation. If none of our
spans are pulling timing, then now is the time to process
them */
if (!hasmaster)
dahdi_dynamic_run();
return 0;
case DAHDI_DYNAMIC_CREATE:
if (copy_from_user(&dds, (__user const void *)data,
sizeof(dds)))