Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | From | Dmitry Torokhov <> | Subject | [RFC/PATCH 15/22] W1: add slave_ttl master attribute | Date | Thu, 21 Apr 2005 02:22:06 -0500 |
| |
W1: add slave_ttl attribute to w1 masters.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru> ---
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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |