aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/w1.c18
-rw-r--r--drivers/w1/w1.h2
-rw-r--r--drivers/w1/w1_family.c2
-rw-r--r--drivers/w1/w1_family.h3
-rw-r--r--drivers/w1/w1_therm.c10
5 files changed, 2 insertions, 33 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 5b49c9a937f0..c85d75ed835a 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -102,9 +102,6 @@ static ssize_t w1_default_read_bin(struct kobject *kobj, char *buf, loff_t off,
102static struct device_attribute w1_slave_attribute = 102static struct device_attribute w1_slave_attribute =
103 __ATTR(name, S_IRUGO, w1_default_read_name, NULL); 103 __ATTR(name, S_IRUGO, w1_default_read_name, NULL);
104 104
105static struct device_attribute w1_slave_attribute_val =
106 __ATTR(value, S_IRUGO, w1_default_read_name, NULL);
107
108static struct bin_attribute w1_slave_bin_attribute = { 105static struct bin_attribute w1_slave_bin_attribute = {
109 .attr = { 106 .attr = {
110 .name = "w1_slave", 107 .name = "w1_slave",
@@ -310,12 +307,9 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
310 307
311 memcpy(&sl->attr_bin, &w1_slave_bin_attribute, sizeof(sl->attr_bin)); 308 memcpy(&sl->attr_bin, &w1_slave_bin_attribute, sizeof(sl->attr_bin));
312 memcpy(&sl->attr_name, &w1_slave_attribute, sizeof(sl->attr_name)); 309 memcpy(&sl->attr_name, &w1_slave_attribute, sizeof(sl->attr_name));
313 memcpy(&sl->attr_val, &w1_slave_attribute_val, sizeof(sl->attr_val));
314 310
315 sl->attr_bin.read = sl->family->fops->rbin; 311 sl->attr_bin.read = sl->family->fops->rbin;
316 sl->attr_name.show = sl->family->fops->rname; 312 sl->attr_name.show = sl->family->fops->rname;
317 sl->attr_val.show = sl->family->fops->rval;
318 sl->attr_val.attr.name = sl->family->fops->rvalname;
319 313
320 err = device_create_file(&sl->dev, &sl->attr_name); 314 err = device_create_file(&sl->dev, &sl->attr_name);
321 if (err < 0) { 315 if (err < 0) {
@@ -326,23 +320,12 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
326 return err; 320 return err;
327 } 321 }
328 322
329 err = device_create_file(&sl->dev, &sl->attr_val);
330 if (err < 0) {
331 dev_err(&sl->dev,
332 "sysfs file creation for [%s] failed. err=%d\n",
333 sl->dev.bus_id, err);
334 device_remove_file(&sl->dev, &sl->attr_name);
335 device_unregister(&sl->dev);
336 return err;
337 }
338
339 err = sysfs_create_bin_file(&sl->dev.kobj, &sl->attr_bin); 323 err = sysfs_create_bin_file(&sl->dev.kobj, &sl->attr_bin);
340 if (err < 0) { 324 if (err < 0) {
341 dev_err(&sl->dev, 325 dev_err(&sl->dev,
342 "sysfs file creation for [%s] failed. err=%d\n", 326 "sysfs file creation for [%s] failed. err=%d\n",
343 sl->dev.bus_id, err); 327 sl->dev.bus_id, err);
344 device_remove_file(&sl->dev, &sl->attr_name); 328 device_remove_file(&sl->dev, &sl->attr_name);
345 device_remove_file(&sl->dev, &sl->attr_val);
346 device_unregister(&sl->dev); 329 device_unregister(&sl->dev);
347 return err; 330 return err;
348 } 331 }
@@ -428,7 +411,6 @@ static void w1_slave_detach(struct w1_slave *sl)
428 411
429 sysfs_remove_bin_file (&sl->dev.kobj, &sl->attr_bin); 412 sysfs_remove_bin_file (&sl->dev.kobj, &sl->attr_bin);
430 device_remove_file(&sl->dev, &sl->attr_name); 413 device_remove_file(&sl->dev, &sl->attr_name);
431 device_remove_file(&sl->dev, &sl->attr_val);
432 device_unregister(&sl->dev); 414 device_unregister(&sl->dev);
433 w1_family_put(sl->family); 415 w1_family_put(sl->family);
434 416
diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h
index 90a2e737d2ca..44dfb92e55cd 100644
--- a/drivers/w1/w1.h
+++ b/drivers/w1/w1.h
@@ -79,7 +79,7 @@ struct w1_slave
79 struct completion dev_released; 79 struct completion dev_released;
80 80
81 struct bin_attribute attr_bin; 81 struct bin_attribute attr_bin;
82 struct device_attribute attr_name, attr_val; 82 struct device_attribute attr_name;
83}; 83};
84 84
85typedef void (* w1_slave_found_callback)(unsigned long, u64); 85typedef void (* w1_slave_found_callback)(unsigned long, u64);
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
index 3941fb05b8e1..b8502d910c50 100644
--- a/drivers/w1/w1_family.c
+++ b/drivers/w1/w1_family.c
@@ -30,7 +30,7 @@ static LIST_HEAD(w1_families);
30 30
31static int w1_check_family(struct w1_family *f) 31static int w1_check_family(struct w1_family *f)
32{ 32{
33 if (!f->fops->rname || !f->fops->rbin || !f->fops->rval || !f->fops->rvalname) 33 if (!f->fops->rname || !f->fops->rbin)
34 return -EINVAL; 34 return -EINVAL;
35 35
36 return 0; 36 return 0;
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h
index 218f12720622..b26da01bbc38 100644
--- a/drivers/w1/w1_family.h
+++ b/drivers/w1/w1_family.h
@@ -39,9 +39,6 @@ struct w1_family_ops
39{ 39{
40 ssize_t (* rname)(struct device *, struct device_attribute *, char *); 40 ssize_t (* rname)(struct device *, struct device_attribute *, char *);
41 ssize_t (* rbin)(struct kobject *, char *, loff_t, size_t); 41 ssize_t (* rbin)(struct kobject *, char *, loff_t, size_t);
42
43 ssize_t (* rval)(struct device *, struct device_attribute *, char *);
44 unsigned char rvalname[MAXNAMELEN];
45}; 42};
46 43
47struct w1_family 44struct w1_family
diff --git a/drivers/w1/w1_therm.c b/drivers/w1/w1_therm.c
index e52abca05070..b9896c10af6d 100644
--- a/drivers/w1/w1_therm.c
+++ b/drivers/w1/w1_therm.c
@@ -43,14 +43,11 @@ static u8 bad_roms[][9] = {
43 }; 43 };
44 44
45static ssize_t w1_therm_read_name(struct device *, struct device_attribute *attr, char *); 45static ssize_t w1_therm_read_name(struct device *, struct device_attribute *attr, char *);
46static ssize_t w1_therm_read_temp(struct device *, struct device_attribute *attr, char *);
47static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t); 46static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t);
48 47
49static struct w1_family_ops w1_therm_fops = { 48static struct w1_family_ops w1_therm_fops = {
50 .rname = &w1_therm_read_name, 49 .rname = &w1_therm_read_name,
51 .rbin = &w1_therm_read_bin, 50 .rbin = &w1_therm_read_bin,
52 .rval = &w1_therm_read_temp,
53 .rvalname = "temp1_input",
54}; 51};
55 52
56static struct w1_family w1_therm_family_DS18S20 = { 53static struct w1_family w1_therm_family_DS18S20 = {
@@ -142,13 +139,6 @@ static inline int w1_convert_temp(u8 rom[9], u8 fid)
142 return 0; 139 return 0;
143} 140}
144 141
145static ssize_t w1_therm_read_temp(struct device *dev, struct device_attribute *attr, char *buf)
146{
147 struct w1_slave *sl = container_of(dev, struct w1_slave, dev);
148
149 return sprintf(buf, "%d\n", w1_convert_temp(sl->rom, sl->family->fid));
150}
151
152static int w1_therm_check_rom(u8 rom[9]) 142static int w1_therm_check_rom(u8 rom[9])
153{ 143{
154 int i; 144 int i;