summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/dahdi/kernel.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index 12e8ff2..bb32126 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -896,16 +896,21 @@ struct dahdi_span_ops {
/**
* dahdi_device - Represents a device that can contain one or more spans.
*
- * @spans: List of child spans.
+ * @spans: List of child spans.
* @manufacturer: Device manufacturer.
- * @location: The location of this device
- * @devicetype: What type of device this is.
+ * @location: The location of this device. This should not change if
+ * the device is replaced (e.g: in the same PCI slot)
+ * @hardware_id: The hardware_id of this device (NULL for devices without
+ * a hardware_id). This should not change if the device is
+ * relocated to a different location (e.g: different PCI slot)
+ * @devicetype: What type of device this is.
*
*/
struct dahdi_device {
struct list_head spans;
const char *manufacturer;
const char *location;
+ const char *hardware_id;
const char *devicetype;
struct device dev;
};
@@ -1164,6 +1169,7 @@ struct dahdi_device *dahdi_create_device(void);
int dahdi_register_device(struct dahdi_device *ddev, struct device *parent);
void dahdi_unregister_device(struct dahdi_device *ddev);
void dahdi_free_device(struct dahdi_device *ddev);
+void dahdi_init_span(struct dahdi_span *span);
/*! Allocate / free memory for a transcoder */
struct dahdi_transcoder *dahdi_transcoder_alloc(int numchans);
@@ -1451,6 +1457,10 @@ typedef u32 __bitwise pm_message_t;
#endif /* 2.6.26 */
#endif /* 2.6.31 */
+#ifndef CONFIG_TRACING
+#define trace_printk printk
+#endif
+
#ifndef DEFINE_SPINLOCK
#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
#endif