diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2011-10-26 18:58:50 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2011-10-26 18:58:50 +0000 |
commit | 83af0a21bf7b0f11b142d56948f0a5c4ea19f313 (patch) | |
tree | 103b96dec56daf1621ae77e0ae3f7a8acf573603 /drivers/dahdi/dahdi-base.c | |
parent | 003582d221276735233c1155d5d64e3ee7eec4ac (diff) |
dahdi: Expose spans in sysfs.
This change will facilitate creating rules that will allow spans and channels
to be accessed by named device files instead of by numbers.
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10274 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/dahdi-base.c')
-rw-r--r-- | drivers/dahdi/dahdi-base.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 825d1c4..c9089f0 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -612,6 +612,12 @@ void dahdi_unregister_echocan_factory(const struct dahdi_echocan_factory *ec) spin_unlock(&ecfactory_list_lock); } +/* Is this span our syncronization master? */ +int dahdi_is_sync_master(const struct dahdi_span *span) +{ + return span == master; +} + static inline void rotate_sums(void) { /* Rotate where we sum and so forth */ @@ -805,7 +811,7 @@ static int dahdi_seq_show(struct seq_file *sfile, void *v) else seq_printf(sfile, "\"\""); - if (s == master) + if (dahdi_is_sync_master(s)) seq_printf(sfile, " (MASTER)"); if (s->lineconfig) { @@ -6669,6 +6675,7 @@ struct dahdi_device *dahdi_create_device(void) ddev = kzalloc(sizeof(*ddev), GFP_KERNEL); if (!ddev) return NULL; + device_initialize(&ddev->dev); return ddev; } EXPORT_SYMBOL(dahdi_create_device); @@ -6817,6 +6824,8 @@ static int _dahdi_register_device(struct dahdi_device *ddev, ddev->location = (ddev->location) ?: UNKNOWN; ddev->devicetype = (ddev->devicetype) ?: UNKNOWN; + ddev->dev.parent = parent; + list_for_each_entry(s, &ddev->spans, device_node) { s->parent = ddev; ret = _dahdi_register_span(s, 1); @@ -6911,16 +6920,6 @@ static int _dahdi_unregister_span(struct dahdi_span *span) return 0; } -int dahdi_unregister_span(struct dahdi_span *span) -{ - module_printk(KERN_NOTICE, "%s: %s\n", __func__, span->name); - mutex_lock(®istration_mutex); - _dahdi_unregister_span(span); - list_del_init(&span->device_node); - mutex_unlock(®istration_mutex); - return 0; -} - /** * dahdi_unregister_device() - unregister a DAHDI device * @span: the DAHDI span @@ -9184,7 +9183,7 @@ static inline void pseudo_rx_audio(struct dahdi_chan *chan) static inline void dahdi_sync_tick(struct dahdi_span *const s) { if (s->ops->sync_tick) - s->ops->sync_tick(s, s == master); + s->ops->sync_tick(s, dahdi_is_sync_master(s)); } #else #define dahdi_sync_tick(x) do { ; } while (0) @@ -9521,7 +9520,7 @@ int _dahdi_receive(struct dahdi_span *span) spin_unlock(&chan->lock); } - if (span == master) + if (dahdi_is_sync_master(span)) _process_masterspan(); return 0; |