summaryrefslogtreecommitdiff
path: root/drivers/dahdi/xpp/xbus-sysfs.c
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-07-13 08:44:36 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-07-13 08:44:36 +0000
commit330259c92d09fba56efca9d5be4cd2b237645725 (patch)
treefa94a11bc75abf2b9ce026a6e3d2f4bbc48f2569 /drivers/dahdi/xpp/xbus-sysfs.c
parent5b506aee19dd5e0e7cbfb10451c05ebf2bcb9739 (diff)
Cleanup: refcount_xpd()
* Change refcount_xpd(): instead of returning a pointer to the atomic counter, return directly its value (just like refcount_xbus()) * Add a refcount_xbus and refcount_xpd attributes to sysfs (for debugging) git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8878 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp/xbus-sysfs.c')
-rw-r--r--drivers/dahdi/xpp/xbus-sysfs.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c
index a48b806..9634cd2 100644
--- a/drivers/dahdi/xpp/xbus-sysfs.c
+++ b/drivers/dahdi/xpp/xbus-sysfs.c
@@ -205,6 +205,16 @@ static DEVICE_ATTR_READER(waitfor_xpds_show, dev, buf)
return len;
}
+static DEVICE_ATTR_READER(refcount_xbus_show, dev, buf)
+{
+ xbus_t *xbus;
+ int len;
+
+ xbus = dev_to_xbus(dev);
+ len = sprintf(buf, "%d\n", refcount_xbus(xbus));
+ return len;
+}
+
static DEVICE_ATTR_READER(driftinfo_show, dev, buf)
{
xbus_t *xbus;
@@ -290,6 +300,7 @@ static struct device_attribute xbus_dev_attrs[] = {
__ATTR_RO(label),
__ATTR_RO(status),
__ATTR_RO(timing),
+ __ATTR_RO(refcount_xbus),
__ATTR_RO(waitfor_xpds),
__ATTR_RO(driftinfo),
__ATTR(cls, S_IWUSR, NULL, cls_store),
@@ -677,6 +688,19 @@ static DEVICE_ATTR_READER(timing_priority_show, dev, buf)
return len;
}
+static DEVICE_ATTR_READER(refcount_xpd_show, dev, buf)
+{
+ xpd_t *xpd;
+ int len = 0;
+
+ BUG_ON(!dev);
+ xpd = dev_to_xpd(dev);
+ if (!xpd)
+ return -ENODEV;
+ len += sprintf(buf + len, "%d\n", refcount_xpd(xpd));
+ return len;
+}
+
static int xpd_match(struct device *dev, struct device_driver *driver)
{
struct xpd_driver *xpd_driver;
@@ -701,6 +725,7 @@ static struct device_attribute xpd_dev_attrs[] = {
__ATTR_RO(type),
__ATTR_RO(offhook),
__ATTR_RO(timing_priority),
+ __ATTR_RO(refcount_xpd),
__ATTR_NULL,
};