[RFC/PATCH 15/22] W1: add slave_ttl master attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



W1: add slave_ttl attribute to w1 masters.

Signed-off-by: Dmitry Torokhov <[email protected]>
---

 w1.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+)

Index: dtor/drivers/w1/w1.c
===================================================================
--- dtor.orig/drivers/w1/w1.c
+++ dtor/drivers/w1/w1.c
@@ -447,6 +447,28 @@ w1_master_attribute_set_max_slave_count(
 	return 0;
 }
 
+static ssize_t w1_master_attribute_show_slave_ttl(struct device *dev, char *buf)
+{
+	struct w1_master *master = to_w1_master(dev);
+
+	return sprintf(buf, "%d\n", master->slave_ttl);
+}
+
+static ssize_t
+w1_master_attribute_set_slave_ttl(struct device *dev, const char *buf, size_t n)
+{
+	struct w1_master *master = to_w1_master(dev);
+	int slave_ttl;
+
+	slave_ttl = simple_strtoul(buf, NULL, 10);
+	if (!slave_ttl)
+		return -EINVAL;
+
+	master->slave_ttl = slave_ttl;
+	return 0;
+}
+
+
 #define W1_MASTER_ATTR_RO(_name, _mode)				\
 	struct device_attribute w1_master_attribute_##_name =	\
 		__ATTR(_name, _mode,				\
@@ -461,11 +483,13 @@ w1_master_attribute_set_max_slave_count(
 static W1_MASTER_ATTR_RO(name, S_IRUGO);
 static W1_MASTER_ATTR_RW(max_slave_count, S_IWUSR | S_IRUGO);
 static W1_MASTER_ATTR_RW(scan_interval, S_IWUSR | S_IRUGO);
+static W1_MASTER_ATTR_RW(slave_ttl, S_IWUSR | S_IRUGO);
 
 static struct attribute *w1_master_default_attrs[] = {
 	&w1_master_attribute_name.attr,
 	&w1_master_attribute_max_slave_count.attr,
 	&w1_master_attribute_scan_interval.attr,
+	&w1_master_attribute_slave_ttl.attr,
 	NULL
 };
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux