summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOron Peled <oron.peled@xorcom.com>2011-05-23 20:50:37 +0300
committerOron Peled <oron.peled@xorcom.com>2011-05-23 20:50:37 +0300
commitc1bfbb8b354dac1fb9c2c02e6592c0fc4efb75b5 (patch)
tree4443982fc45eaf06c6e94f78393a85addf557bfe
parente894536f5e73b741bd55dfe53e864df93532c271 (diff)
add "span_id" dahdi_span attribute. Calculated during device registration.sysfs
-rw-r--r--drivers/dahdi/dahdi-base.c3
-rw-r--r--drivers/dahdi/dahdi-sysfs.c2
-rw-r--r--include/dahdi/kernel.h1
3 files changed, 6 insertions, 0 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index 23cda1a..c4a5e14 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -6738,15 +6738,18 @@ static int _dahdi_register_device(struct dahdi_device *ddev,
struct device *parent)
{
struct dahdi_span *s;
+ int idx;
int ret;
ddev->manufacturer = (ddev->manufacturer) ?: UNKNOWN;
ddev->location = (ddev->location) ?: UNKNOWN;
ddev->devicetype = (ddev->devicetype) ?: UNKNOWN;
+ idx = 0;
list_for_each_entry(s, &ddev->spans, device_node) {
s->parent = ddev;
s->spanno = 0;
+ s->span_idx = idx++;
__dahdi_init_span(s);
}
diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c
index 0523ed4..424181e 100644
--- a/drivers/dahdi/dahdi-sysfs.c
+++ b/drivers/dahdi/dahdi-sysfs.c
@@ -218,6 +218,7 @@ static BUS_ATTR_READER(field##_show, dev, buf) \
span_attr(name, "%s\n");
span_attr(desc, "%s\n");
span_attr(spantype, "%s\n");
+span_attr(span_idx, "%d\n");
span_attr(alarms, "0x%x\n");
span_attr(lbo, "%d\n");
span_attr(syncsrc, "%d\n");
@@ -226,6 +227,7 @@ static struct device_attribute span_dev_attrs[] = {
__ATTR_RO(name),
__ATTR_RO(desc),
__ATTR_RO(spantype),
+ __ATTR_RO(span_idx),
__ATTR_RO(alarms),
__ATTR_RO(lbo),
__ATTR_RO(syncsrc),
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index 2ca5acf..cf4029f 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -908,6 +908,7 @@ struct dahdi_span {
char name[40]; /*!< Span name */
char desc[80]; /*!< Span description */
const char *spantype; /*!< span type in text form */
+ int span_idx; /*!< span index in its span_device */
int deflaw; /*!< Default law (DAHDI_MULAW or DAHDI_ALAW) */
int alarms; /*!< Pending alarms on span */
unsigned long flags;