summaryrefslogtreecommitdiff
path: root/drivers/dahdi/xpp/xbus-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dahdi/xpp/xbus-sysfs.c')
-rw-r--r--drivers/dahdi/xpp/xbus-sysfs.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c
index ccc1a01..31835bb 100644
--- a/drivers/dahdi/xpp/xbus-sysfs.c
+++ b/drivers/dahdi/xpp/xbus-sysfs.c
@@ -613,6 +613,48 @@ static DEVICE_ATTR_READER(span_show, dev, buf)
return len;
}
+/*
+ * For backward compatibility with old dahdi-tools
+ * Remove after dahdi_registration is upgraded
+ */
+static DEVICE_ATTR_WRITER(span_store, dev, buf, count)
+{
+ xpd_t *xpd;
+ int dahdi_reg;
+ int ret;
+
+ BUG_ON(!dev);
+ xpd = dev_to_xpd(dev);
+ if (!xpd)
+ return -ENODEV;
+ ret = sscanf(buf, "%d", &dahdi_reg);
+ if (ret != 1)
+ return -EINVAL;
+ if (!XBUS_IS(xpd->xbus, READY))
+ return -ENODEV;
+ XPD_DBG(DEVICES, xpd,
+ "%s -- deprecated (should use pinned-spans)\n",
+ (dahdi_reg) ? "register" : "unregister");
+ if (xbus_is_registered(xpd->xbus)) {
+ if (dahdi_reg) {
+ XPD_DBG(DEVICES, xpd,
+ "already registered %s. Ignored.\n",
+ xpd->xbus->busname);
+ } else {
+ xbus_unregister_dahdi_device(xpd->xbus);
+ }
+ } else {
+ if (!dahdi_reg) {
+ XPD_DBG(DEVICES, xpd,
+ "already unregistered %s. Ignored.\n",
+ xpd->xbus->busname);
+ } else {
+ xbus_register_dahdi_device(xpd->xbus);
+ }
+ }
+ return count;
+}
+
static DEVICE_ATTR_READER(type_show, dev, buf)
{
xpd_t *xpd;
@@ -695,7 +737,7 @@ static int xpd_match(struct device *dev, struct device_driver *driver)
static struct device_attribute xpd_dev_attrs[] = {
__ATTR(chipregs, S_IRUGO | S_IWUSR, chipregs_show, chipregs_store),
__ATTR(blink, S_IRUGO | S_IWUSR, blink_show, blink_store),
- __ATTR_RO(span),
+ __ATTR(span, S_IRUGO | S_IWUSR, span_show, span_store),
__ATTR_RO(type),
__ATTR_RO(offhook),
__ATTR_RO(timing_priority),