summaryrefslogtreecommitdiff
path: root/drivers/dahdi/dahdi-sysfs.c
diff options
context:
space:
mode:
authorOron Peled <oron.peled@xorcom.com>2011-05-23 19:23:52 +0300
committerOron Peled <oron.peled@xorcom.com>2011-05-23 19:23:52 +0300
commite894536f5e73b741bd55dfe53e864df93532c271 (patch)
treec4bc104dc9a5191b66b6b9c31482fe5a3a2b28b9 /drivers/dahdi/dahdi-sysfs.c
parent72779010659e968f3b400f4ef513f375eb022df2 (diff)
add to dahdi_device a "hardware_id" attribute as an alternative to "location"
- 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"
Diffstat (limited to 'drivers/dahdi/dahdi-sysfs.c')
-rw-r--r--drivers/dahdi/dahdi-sysfs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c
index 161a1d9..0523ed4 100644
--- a/drivers/dahdi/dahdi-sysfs.c
+++ b/drivers/dahdi/dahdi-sysfs.c
@@ -484,6 +484,16 @@ dahdi_device_location_show(struct device *dev,
}
static ssize_t
+dahdi_device_hardware_id_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct dahdi_device *ddev = to_ddev(dev);
+
+ return sprintf(buf, "%s\n",
+ (ddev->hardware_id) ? ddev->hardware_id : "");
+}
+
+static ssize_t
dahdi_device_auto_register(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
@@ -524,6 +534,7 @@ static struct device_attribute dahdi_device_attrs[] = {
__ATTR(type, S_IRUGO, dahdi_device_type_show, NULL),
__ATTR(span_count, S_IRUGO, dahdi_device_span_count_show, NULL),
__ATTR(location, S_IRUGO, dahdi_device_location_show, NULL),
+ __ATTR(hardware_id, S_IRUGO, dahdi_device_hardware_id_show, NULL),
__ATTR(auto_register, S_IWUSR, NULL, dahdi_device_auto_register),
__ATTR(register_span, S_IWUSR, NULL, dahdi_device_register_span),
__ATTR_NULL,