Commit ca775c629a366ded01aae69da8410f70aaf85de1
Committed by
Greg Kroah-Hartman
1 parent
7785925dd8
[PATCH] w1: new family structure.
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 <johnpol@2ka.mipt.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 5 changed files with 2 additions and 33 deletions Side-by-side Diff
drivers/w1/w1.c
... | ... | @@ -102,9 +102,6 @@ |
102 | 102 | static struct device_attribute w1_slave_attribute = |
103 | 103 | __ATTR(name, S_IRUGO, w1_default_read_name, NULL); |
104 | 104 | |
105 | -static struct device_attribute w1_slave_attribute_val = | |
106 | - __ATTR(value, S_IRUGO, w1_default_read_name, NULL); | |
107 | - | |
108 | 105 | static struct bin_attribute w1_slave_bin_attribute = { |
109 | 106 | .attr = { |
110 | 107 | .name = "w1_slave", |
111 | 108 | |
... | ... | @@ -310,12 +307,9 @@ |
310 | 307 | |
311 | 308 | memcpy(&sl->attr_bin, &w1_slave_bin_attribute, sizeof(sl->attr_bin)); |
312 | 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 | 311 | sl->attr_bin.read = sl->family->fops->rbin; |
316 | 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 | 314 | err = device_create_file(&sl->dev, &sl->attr_name); |
321 | 315 | if (err < 0) { |
322 | 316 | |
... | ... | @@ -326,23 +320,12 @@ |
326 | 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 | 323 | err = sysfs_create_bin_file(&sl->dev.kobj, &sl->attr_bin); |
340 | 324 | if (err < 0) { |
341 | 325 | dev_err(&sl->dev, |
342 | 326 | "sysfs file creation for [%s] failed. err=%d\n", |
343 | 327 | sl->dev.bus_id, err); |
344 | 328 | device_remove_file(&sl->dev, &sl->attr_name); |
345 | - device_remove_file(&sl->dev, &sl->attr_val); | |
346 | 329 | device_unregister(&sl->dev); |
347 | 330 | return err; |
348 | 331 | } |
... | ... | @@ -428,7 +411,6 @@ |
428 | 411 | |
429 | 412 | sysfs_remove_bin_file (&sl->dev.kobj, &sl->attr_bin); |
430 | 413 | device_remove_file(&sl->dev, &sl->attr_name); |
431 | - device_remove_file(&sl->dev, &sl->attr_val); | |
432 | 414 | device_unregister(&sl->dev); |
433 | 415 | w1_family_put(sl->family); |
434 | 416 |
drivers/w1/w1.h
drivers/w1/w1_family.c
drivers/w1/w1_family.h
... | ... | @@ -39,9 +39,6 @@ |
39 | 39 | { |
40 | 40 | ssize_t (* rname)(struct device *, struct device_attribute *, char *); |
41 | 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 | |
47 | 44 | struct w1_family |
drivers/w1/w1_therm.c
... | ... | @@ -43,14 +43,11 @@ |
43 | 43 | }; |
44 | 44 | |
45 | 45 | static ssize_t w1_therm_read_name(struct device *, struct device_attribute *attr, char *); |
46 | -static ssize_t w1_therm_read_temp(struct device *, struct device_attribute *attr, char *); | |
47 | 46 | static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t); |
48 | 47 | |
49 | 48 | static struct w1_family_ops w1_therm_fops = { |
50 | 49 | .rname = &w1_therm_read_name, |
51 | 50 | .rbin = &w1_therm_read_bin, |
52 | - .rval = &w1_therm_read_temp, | |
53 | - .rvalname = "temp1_input", | |
54 | 51 | }; |
55 | 52 | |
56 | 53 | static struct w1_family w1_therm_family_DS18S20 = { |
... | ... | @@ -140,13 +137,6 @@ |
140 | 137 | return w1_therm_families[i].convert(rom); |
141 | 138 | |
142 | 139 | return 0; |
143 | -} | |
144 | - | |
145 | -static 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 | 140 | } |
151 | 141 | |
152 | 142 | static int w1_therm_check_rom(u8 rom[9]) |