From johnpol@2ka.mipt.ru Fri May 20 11:57:34 2005 Date: Fri, 20 May 2005 22:49:08 +0400 From: Evgeniy Polyakov To: Greg Kroah-Hartman Subject: w1: new family structure. Message-ID: <20050520224908.6c5000e9@zanzibar.2ka.mipt.ru> Removed some fields which are not required. First step for writing operations. Now only read and read name remain. Patch depends on w1 cleanups patch. Signed-off-by: Evgeniy Polyakov Signed-off-by: Greg Kroah-Hartman --- drivers/w1/w1.c | 18 ------------------ drivers/w1/w1.h | 2 +- drivers/w1/w1_family.c | 2 +- drivers/w1/w1_family.h | 3 --- drivers/w1/w1_therm.c | 10 ---------- 5 files changed, 2 insertions(+), 33 deletions(-) --- gregkh-2.6.orig/drivers/w1/w1.c 2005-05-23 16:25:52.000000000 -0700 +++ gregkh-2.6/drivers/w1/w1.c 2005-05-23 16:27:08.000000000 -0700 @@ -102,9 +102,6 @@ static struct device_attribute w1_slave_attribute = __ATTR(name, S_IRUGO, w1_default_read_name, NULL); -static struct device_attribute w1_slave_attribute_val = - __ATTR(value, S_IRUGO, w1_default_read_name, NULL); - static struct bin_attribute w1_slave_bin_attribute = { .attr = { .name = "w1_slave", @@ -310,12 +307,9 @@ memcpy(&sl->attr_bin, &w1_slave_bin_attribute, sizeof(sl->attr_bin)); memcpy(&sl->attr_name, &w1_slave_attribute, sizeof(sl->attr_name)); - memcpy(&sl->attr_val, &w1_slave_attribute_val, sizeof(sl->attr_val)); sl->attr_bin.read = sl->family->fops->rbin; sl->attr_name.show = sl->family->fops->rname; - sl->attr_val.show = sl->family->fops->rval; - sl->attr_val.attr.name = sl->family->fops->rvalname; err = device_create_file(&sl->dev, &sl->attr_name); if (err < 0) { @@ -326,23 +320,12 @@ return err; } - err = device_create_file(&sl->dev, &sl->attr_val); - if (err < 0) { - dev_err(&sl->dev, - "sysfs file creation for [%s] failed. err=%d\n", - sl->dev.bus_id, err); - device_remove_file(&sl->dev, &sl->attr_name); - device_unregister(&sl->dev); - return err; - } - err = sysfs_create_bin_file(&sl->dev.kobj, &sl->attr_bin); if (err < 0) { dev_err(&sl->dev, "sysfs file creation for [%s] failed. err=%d\n", sl->dev.bus_id, err); device_remove_file(&sl->dev, &sl->attr_name); - device_remove_file(&sl->dev, &sl->attr_val); device_unregister(&sl->dev); return err; } @@ -428,7 +411,6 @@ sysfs_remove_bin_file (&sl->dev.kobj, &sl->attr_bin); device_remove_file(&sl->dev, &sl->attr_name); - device_remove_file(&sl->dev, &sl->attr_val); device_unregister(&sl->dev); w1_family_put(sl->family); --- gregkh-2.6.orig/drivers/w1/w1.h 2005-05-23 16:25:52.000000000 -0700 +++ gregkh-2.6/drivers/w1/w1.h 2005-05-23 16:27:08.000000000 -0700 @@ -79,7 +79,7 @@ struct completion dev_released; struct bin_attribute attr_bin; - struct device_attribute attr_name, attr_val; + struct device_attribute attr_name; }; typedef void (* w1_slave_found_callback)(unsigned long, u64); --- gregkh-2.6.orig/drivers/w1/w1_family.c 2005-05-23 16:25:52.000000000 -0700 +++ gregkh-2.6/drivers/w1/w1_family.c 2005-05-23 16:27:08.000000000 -0700 @@ -30,7 +30,7 @@ static int w1_check_family(struct w1_family *f) { - if (!f->fops->rname || !f->fops->rbin || !f->fops->rval || !f->fops->rvalname) + if (!f->fops->rname || !f->fops->rbin) return -EINVAL; return 0; --- gregkh-2.6.orig/drivers/w1/w1_family.h 2005-05-23 16:25:52.000000000 -0700 +++ gregkh-2.6/drivers/w1/w1_family.h 2005-05-23 16:27:34.000000000 -0700 @@ -39,9 +39,6 @@ { ssize_t (* rname)(struct device *, struct device_attribute *, char *); ssize_t (* rbin)(struct kobject *, char *, loff_t, size_t); - - ssize_t (* rval)(struct device *, struct device_attribute *, char *); - unsigned char rvalname[MAXNAMELEN]; }; struct w1_family --- gregkh-2.6.orig/drivers/w1/w1_therm.c 2005-05-23 16:25:52.000000000 -0700 +++ gregkh-2.6/drivers/w1/w1_therm.c 2005-05-23 16:28:25.000000000 -0700 @@ -43,14 +43,11 @@ }; static ssize_t w1_therm_read_name(struct device *, struct device_attribute *attr, char *); -static ssize_t w1_therm_read_temp(struct device *, struct device_attribute *attr, char *); static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t); static struct w1_family_ops w1_therm_fops = { .rname = &w1_therm_read_name, .rbin = &w1_therm_read_bin, - .rval = &w1_therm_read_temp, - .rvalname = "temp1_input", }; static struct w1_family w1_therm_family_DS18S20 = { @@ -142,13 +139,6 @@ return 0; } -static ssize_t w1_therm_read_temp(struct device *dev, struct device_attribute *attr, char *buf) -{ - struct w1_slave *sl = container_of(dev, struct w1_slave, dev); - - return sprintf(buf, "%d\n", w1_convert_temp(sl->rom, sl->family->fid)); -} - static int w1_therm_check_rom(u8 rom[9]) { int i;