summaryrefslogtreecommitdiff
path: root/drivers/dahdi/dahdi.h
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-10-26 18:59:20 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-10-26 18:59:20 +0000
commit581df51b0dfcf3148dad593cb13705fd6896d5ed (patch)
treecf3300a2cf6fc26f88d304aaf8d655c2433a1fa8 /drivers/dahdi/dahdi.h
parent83af0a21bf7b0f11b142d56948f0a5c4ea19f313 (diff)
dahdi: Expose dahdi devices in sysfs.
This exposes dahdi devices in sysfs and also exposes attributes that will allow user space to control the registration order in spans. This facilitates loading drivers out of order yet keeping consistent span/channel numbering, which in turn will eventually allow the blacklist for DAHDI drivers to be removed. The default behavior, controlled with the auto_register module parameter on dahdi is to number the spans / channels in order like is currently done. So this change does not introduce any new behavior by default. * Writing (anything) to this attribute returns the span to its unassigned state * Fix dahdi_chan_unreg() echocan refcount * Add safeguard against duplicate unassignment to _dahdi_unregister_span() * Remove the span from device_node list, only in dahdi_unregister_device() and not in dahdi_unregister_span() * Free allocated span->span_device in span_sysfs_remove() [is it safe?, didn't cause problem so far...] Signed-off-by: Shaun Ruffell <sruffell@digium.com> Signed-off-by: Oron Peled <oron.peled@xorcom.com> Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> dahdi: Add "hardware_id" dahdi_device attribute. - The "hardware_id" does not change with device location (e.g: when a PCI card is moved from one slot to another). - Not all devices have this attribute. It is legal for it to be NULL (that is the default for all low-level drivers that do not set it explicitly). - When "hardware_id" is NULL, the sysfs attribute value is "\n" Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10275 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/dahdi.h')
-rw-r--r--drivers/dahdi/dahdi.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/dahdi/dahdi.h b/drivers/dahdi/dahdi.h
index 92ddbdc..5baebc1 100644
--- a/drivers/dahdi/dahdi.h
+++ b/drivers/dahdi/dahdi.h
@@ -34,4 +34,28 @@ void span_sysfs_remove(struct dahdi_span *span);
int __init dahdi_sysfs_init(const struct file_operations *dahdi_fops);
void dahdi_sysfs_exit(void);
+void dahdi_sysfs_init_device(struct dahdi_device *ddev);
+int dahdi_sysfs_add_device(struct dahdi_device *ddev, struct device *parent);
+void dahdi_sysfs_unregister_device(struct dahdi_device *ddev);
+
+int dahdi_assign_span(struct dahdi_span *span, unsigned int spanno,
+ unsigned int basechan, int prefmaster);
+int dahdi_unassign_span(struct dahdi_span *span);
+int dahdi_assign_device_spans(struct dahdi_device *ddev);
+
+static inline int get_span(struct dahdi_span *span)
+{
+ return try_module_get(span->ops->owner);
+}
+
+static inline void put_span(struct dahdi_span *span)
+{
+ module_put(span->ops->owner);
+}
+
+static inline int local_spanno(struct dahdi_span *span)
+{
+ return span->offset + 1;
+}
+
#endif /* _DAHDI_H */