diff options
Diffstat (limited to 'drivers/w1')
-rw-r--r-- | drivers/w1/Kconfig | 16 | ||||
-rw-r--r-- | drivers/w1/matrox_w1.c | 10 | ||||
-rw-r--r-- | drivers/w1/w1.c | 273 | ||||
-rw-r--r-- | drivers/w1/w1.h | 43 | ||||
-rw-r--r-- | drivers/w1/w1_family.c | 4 | ||||
-rw-r--r-- | drivers/w1/w1_family.h | 10 | ||||
-rw-r--r-- | drivers/w1/w1_int.c | 29 | ||||
-rw-r--r-- | drivers/w1/w1_int.h | 6 | ||||
-rw-r--r-- | drivers/w1/w1_io.c | 4 | ||||
-rw-r--r-- | drivers/w1/w1_io.h | 4 | ||||
-rw-r--r-- | drivers/w1/w1_log.h | 4 | ||||
-rw-r--r-- | drivers/w1/w1_netlink.h | 4 | ||||
-rw-r--r-- | drivers/w1/w1_smem.c | 8 | ||||
-rw-r--r-- | drivers/w1/w1_therm.c | 12 |
14 files changed, 171 insertions, 256 deletions
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig index 2ab65c902fe5..4f120796273e 100644 --- a/drivers/w1/Kconfig +++ b/drivers/w1/Kconfig | |||
@@ -3,9 +3,9 @@ menu "Dallas's 1-wire bus" | |||
3 | config W1 | 3 | config W1 |
4 | tristate "Dallas's 1-wire support" | 4 | tristate "Dallas's 1-wire support" |
5 | ---help--- | 5 | ---help--- |
6 | Dallas's 1-wire bus is usefull to connect slow 1-pin devices | 6 | Dallas's 1-wire bus is usefull to connect slow 1-pin devices |
7 | such as iButtons and thermal sensors. | 7 | such as iButtons and thermal sensors. |
8 | 8 | ||
9 | If you want W1 support, you should say Y here. | 9 | If you want W1 support, you should say Y here. |
10 | 10 | ||
11 | This W1 support can also be built as a module. If so, the module | 11 | This W1 support can also be built as a module. If so, the module |
@@ -17,8 +17,8 @@ config W1_MATROX | |||
17 | help | 17 | help |
18 | Say Y here if you want to communicate with your 1-wire devices | 18 | Say Y here if you want to communicate with your 1-wire devices |
19 | using Matrox's G400 GPIO pins. | 19 | using Matrox's G400 GPIO pins. |
20 | 20 | ||
21 | This support is also available as a module. If so, the module | 21 | This support is also available as a module. If so, the module |
22 | will be called matrox_w1.ko. | 22 | will be called matrox_w1.ko. |
23 | 23 | ||
24 | config W1_DS9490 | 24 | config W1_DS9490 |
@@ -27,17 +27,17 @@ config W1_DS9490 | |||
27 | help | 27 | help |
28 | Say Y here if you want to have a driver for DS9490R UWB <-> W1 bridge. | 28 | Say Y here if you want to have a driver for DS9490R UWB <-> W1 bridge. |
29 | 29 | ||
30 | This support is also available as a module. If so, the module | 30 | This support is also available as a module. If so, the module |
31 | will be called ds9490r.ko. | 31 | will be called ds9490r.ko. |
32 | 32 | ||
33 | config W1_DS9490_BRIDGE | 33 | config W1_DS9490R_BRIDGE |
34 | tristate "DS9490R USB <-> W1 transport layer for 1-wire" | 34 | tristate "DS9490R USB <-> W1 transport layer for 1-wire" |
35 | depends on W1_DS9490 | 35 | depends on W1_DS9490 |
36 | help | 36 | help |
37 | Say Y here if you want to communicate with your 1-wire devices | 37 | Say Y here if you want to communicate with your 1-wire devices |
38 | using DS9490R USB bridge. | 38 | using DS9490R USB bridge. |
39 | 39 | ||
40 | This support is also available as a module. If so, the module | 40 | This support is also available as a module. If so, the module |
41 | will be called ds_w1_bridge.ko. | 41 | will be called ds_w1_bridge.ko. |
42 | 42 | ||
43 | config W1_THERM | 43 | config W1_THERM |
@@ -51,7 +51,7 @@ config W1_SMEM | |||
51 | tristate "Simple 64bit memory family implementation" | 51 | tristate "Simple 64bit memory family implementation" |
52 | depends on W1 | 52 | depends on W1 |
53 | help | 53 | help |
54 | Say Y here if you want to connect 1-wire | 54 | Say Y here if you want to connect 1-wire |
55 | simple 64bit memory rom(ds2401/ds2411/ds1990*) to you wire. | 55 | simple 64bit memory rom(ds2401/ds2411/ds1990*) to you wire. |
56 | 56 | ||
57 | endmenu | 57 | endmenu |
diff --git a/drivers/w1/matrox_w1.c b/drivers/w1/matrox_w1.c index e565416458ea..0b03f8f93f63 100644 --- a/drivers/w1/matrox_w1.c +++ b/drivers/w1/matrox_w1.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * matrox_w1.c | 2 | * matrox_w1.c |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -59,7 +59,7 @@ static struct pci_driver matrox_w1_pci_driver = { | |||
59 | .remove = __devexit_p(matrox_w1_remove), | 59 | .remove = __devexit_p(matrox_w1_remove), |
60 | }; | 60 | }; |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * Matrox G400 DDC registers. | 63 | * Matrox G400 DDC registers. |
64 | */ | 64 | */ |
65 | 65 | ||
@@ -177,8 +177,8 @@ static int __devinit matrox_w1_probe(struct pci_dev *pdev, const struct pci_devi | |||
177 | 177 | ||
178 | dev->bus_master = (struct w1_bus_master *)(dev + 1); | 178 | dev->bus_master = (struct w1_bus_master *)(dev + 1); |
179 | 179 | ||
180 | /* | 180 | /* |
181 | * True for G400, for some other we need resource 0, see drivers/video/matrox/matroxfb_base.c | 181 | * True for G400, for some other we need resource 0, see drivers/video/matrox/matroxfb_base.c |
182 | */ | 182 | */ |
183 | 183 | ||
184 | dev->phys_addr = pci_resource_start(pdev, 1); | 184 | dev->phys_addr = pci_resource_start(pdev, 1); |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 24a192e3b8b4..5b49c9a937f0 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1.c | 2 | * w1.c |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -99,6 +99,23 @@ static ssize_t w1_default_read_bin(struct kobject *kobj, char *buf, loff_t off, | |||
99 | return sprintf(buf, "No family registered.\n"); | 99 | return sprintf(buf, "No family registered.\n"); |
100 | } | 100 | } |
101 | 101 | ||
102 | static struct device_attribute w1_slave_attribute = | ||
103 | __ATTR(name, S_IRUGO, w1_default_read_name, NULL); | ||
104 | |||
105 | static struct device_attribute w1_slave_attribute_val = | ||
106 | __ATTR(value, S_IRUGO, w1_default_read_name, NULL); | ||
107 | |||
108 | static struct bin_attribute w1_slave_bin_attribute = { | ||
109 | .attr = { | ||
110 | .name = "w1_slave", | ||
111 | .mode = S_IRUGO, | ||
112 | .owner = THIS_MODULE, | ||
113 | }, | ||
114 | .size = W1_SLAVE_DATA_SIZE, | ||
115 | .read = &w1_default_read_bin, | ||
116 | }; | ||
117 | |||
118 | |||
102 | static struct bus_type w1_bus_type = { | 119 | static struct bus_type w1_bus_type = { |
103 | .name = "w1", | 120 | .name = "w1", |
104 | .match = w1_master_match, | 121 | .match = w1_master_match, |
@@ -119,34 +136,16 @@ struct device w1_device = { | |||
119 | .release = &w1_master_release | 136 | .release = &w1_master_release |
120 | }; | 137 | }; |
121 | 138 | ||
122 | static struct device_attribute w1_slave_attribute = { | ||
123 | .attr = { | ||
124 | .name = "name", | ||
125 | .mode = S_IRUGO, | ||
126 | .owner = THIS_MODULE | ||
127 | }, | ||
128 | .show = &w1_default_read_name, | ||
129 | }; | ||
130 | |||
131 | static struct device_attribute w1_slave_attribute_val = { | ||
132 | .attr = { | ||
133 | .name = "value", | ||
134 | .mode = S_IRUGO, | ||
135 | .owner = THIS_MODULE | ||
136 | }, | ||
137 | .show = &w1_default_read_name, | ||
138 | }; | ||
139 | |||
140 | static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf) | 139 | static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf) |
141 | { | 140 | { |
142 | struct w1_master *md = container_of (dev, struct w1_master, dev); | 141 | struct w1_master *md = container_of (dev, struct w1_master, dev); |
143 | ssize_t count; | 142 | ssize_t count; |
144 | 143 | ||
145 | if (down_interruptible (&md->mutex)) | 144 | if (down_interruptible (&md->mutex)) |
146 | return -EBUSY; | 145 | return -EBUSY; |
147 | 146 | ||
148 | count = sprintf(buf, "%s\n", md->name); | 147 | count = sprintf(buf, "%s\n", md->name); |
149 | 148 | ||
150 | up(&md->mutex); | 149 | up(&md->mutex); |
151 | 150 | ||
152 | return count; | 151 | return count; |
@@ -156,12 +155,12 @@ static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct devic | |||
156 | { | 155 | { |
157 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 156 | struct w1_master *md = container_of(dev, struct w1_master, dev); |
158 | ssize_t count; | 157 | ssize_t count; |
159 | 158 | ||
160 | if (down_interruptible(&md->mutex)) | 159 | if (down_interruptible(&md->mutex)) |
161 | return -EBUSY; | 160 | return -EBUSY; |
162 | 161 | ||
163 | count = sprintf(buf, "0x%p\n", md->bus_master); | 162 | count = sprintf(buf, "0x%p\n", md->bus_master); |
164 | 163 | ||
165 | up(&md->mutex); | 164 | up(&md->mutex); |
166 | return count; | 165 | return count; |
167 | } | 166 | } |
@@ -177,12 +176,12 @@ static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, stru | |||
177 | { | 176 | { |
178 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 177 | struct w1_master *md = container_of(dev, struct w1_master, dev); |
179 | ssize_t count; | 178 | ssize_t count; |
180 | 179 | ||
181 | if (down_interruptible(&md->mutex)) | 180 | if (down_interruptible(&md->mutex)) |
182 | return -EBUSY; | 181 | return -EBUSY; |
183 | 182 | ||
184 | count = sprintf(buf, "%d\n", md->max_slave_count); | 183 | count = sprintf(buf, "%d\n", md->max_slave_count); |
185 | 184 | ||
186 | up(&md->mutex); | 185 | up(&md->mutex); |
187 | return count; | 186 | return count; |
188 | } | 187 | } |
@@ -191,12 +190,12 @@ static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct devi | |||
191 | { | 190 | { |
192 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 191 | struct w1_master *md = container_of(dev, struct w1_master, dev); |
193 | ssize_t count; | 192 | ssize_t count; |
194 | 193 | ||
195 | if (down_interruptible(&md->mutex)) | 194 | if (down_interruptible(&md->mutex)) |
196 | return -EBUSY; | 195 | return -EBUSY; |
197 | 196 | ||
198 | count = sprintf(buf, "%lu\n", md->attempts); | 197 | count = sprintf(buf, "%lu\n", md->attempts); |
199 | 198 | ||
200 | up(&md->mutex); | 199 | up(&md->mutex); |
201 | return count; | 200 | return count; |
202 | } | 201 | } |
@@ -205,12 +204,12 @@ static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct d | |||
205 | { | 204 | { |
206 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 205 | struct w1_master *md = container_of(dev, struct w1_master, dev); |
207 | ssize_t count; | 206 | ssize_t count; |
208 | 207 | ||
209 | if (down_interruptible(&md->mutex)) | 208 | if (down_interruptible(&md->mutex)) |
210 | return -EBUSY; | 209 | return -EBUSY; |
211 | 210 | ||
212 | count = sprintf(buf, "%d\n", md->slave_count); | 211 | count = sprintf(buf, "%d\n", md->slave_count); |
213 | 212 | ||
214 | up(&md->mutex); | 213 | up(&md->mutex); |
215 | return count; | 214 | return count; |
216 | } | 215 | } |
@@ -233,7 +232,7 @@ static ssize_t w1_master_attribute_show_slaves(struct device *dev, struct device | |||
233 | list_for_each_safe(ent, n, &md->slist) { | 232 | list_for_each_safe(ent, n, &md->slist) { |
234 | sl = list_entry(ent, struct w1_slave, w1_slave_entry); | 233 | sl = list_entry(ent, struct w1_slave, w1_slave_entry); |
235 | 234 | ||
236 | c -= snprintf(buf + PAGE_SIZE - c, c, "%s\n", sl->name); | 235 | c -= snprintf(buf + PAGE_SIZE - c, c, "%s\n", sl->name); |
237 | } | 236 | } |
238 | } | 237 | } |
239 | 238 | ||
@@ -242,73 +241,44 @@ static ssize_t w1_master_attribute_show_slaves(struct device *dev, struct device | |||
242 | return PAGE_SIZE - c; | 241 | return PAGE_SIZE - c; |
243 | } | 242 | } |
244 | 243 | ||
245 | static struct device_attribute w1_master_attribute_slaves = { | 244 | #define W1_MASTER_ATTR_RO(_name, _mode) \ |
246 | .attr = { | 245 | struct device_attribute w1_master_attribute_##_name = \ |
247 | .name = "w1_master_slaves", | 246 | __ATTR(w1_master_##_name, _mode, \ |
248 | .mode = S_IRUGO, | 247 | w1_master_attribute_show_##_name, NULL) |
249 | .owner = THIS_MODULE, | 248 | |
250 | }, | 249 | static W1_MASTER_ATTR_RO(name, S_IRUGO); |
251 | .show = &w1_master_attribute_show_slaves, | 250 | static W1_MASTER_ATTR_RO(slaves, S_IRUGO); |
252 | }; | 251 | static W1_MASTER_ATTR_RO(slave_count, S_IRUGO); |
253 | static struct device_attribute w1_master_attribute_slave_count = { | 252 | static W1_MASTER_ATTR_RO(max_slave_count, S_IRUGO); |
254 | .attr = { | 253 | static W1_MASTER_ATTR_RO(attempts, S_IRUGO); |
255 | .name = "w1_master_slave_count", | 254 | static W1_MASTER_ATTR_RO(timeout, S_IRUGO); |
256 | .mode = S_IRUGO, | 255 | static W1_MASTER_ATTR_RO(pointer, S_IRUGO); |
257 | .owner = THIS_MODULE | 256 | |
258 | }, | 257 | static struct attribute *w1_master_default_attrs[] = { |
259 | .show = &w1_master_attribute_show_slave_count, | 258 | &w1_master_attribute_name.attr, |
260 | }; | 259 | &w1_master_attribute_slaves.attr, |
261 | static struct device_attribute w1_master_attribute_attempts = { | 260 | &w1_master_attribute_slave_count.attr, |
262 | .attr = { | 261 | &w1_master_attribute_max_slave_count.attr, |
263 | .name = "w1_master_attempts", | 262 | &w1_master_attribute_attempts.attr, |
264 | .mode = S_IRUGO, | 263 | &w1_master_attribute_timeout.attr, |
265 | .owner = THIS_MODULE | 264 | &w1_master_attribute_pointer.attr, |
266 | }, | 265 | NULL |
267 | .show = &w1_master_attribute_show_attempts, | ||
268 | }; | ||
269 | static struct device_attribute w1_master_attribute_max_slave_count = { | ||
270 | .attr = { | ||
271 | .name = "w1_master_max_slave_count", | ||
272 | .mode = S_IRUGO, | ||
273 | .owner = THIS_MODULE | ||
274 | }, | ||
275 | .show = &w1_master_attribute_show_max_slave_count, | ||
276 | }; | ||
277 | static struct device_attribute w1_master_attribute_timeout = { | ||
278 | .attr = { | ||
279 | .name = "w1_master_timeout", | ||
280 | .mode = S_IRUGO, | ||
281 | .owner = THIS_MODULE | ||
282 | }, | ||
283 | .show = &w1_master_attribute_show_timeout, | ||
284 | }; | ||
285 | static struct device_attribute w1_master_attribute_pointer = { | ||
286 | .attr = { | ||
287 | .name = "w1_master_pointer", | ||
288 | .mode = S_IRUGO, | ||
289 | .owner = THIS_MODULE | ||
290 | }, | ||
291 | .show = &w1_master_attribute_show_pointer, | ||
292 | }; | ||
293 | static struct device_attribute w1_master_attribute_name = { | ||
294 | .attr = { | ||
295 | .name = "w1_master_name", | ||
296 | .mode = S_IRUGO, | ||
297 | .owner = THIS_MODULE | ||
298 | }, | ||
299 | .show = &w1_master_attribute_show_name, | ||
300 | }; | 266 | }; |
301 | 267 | ||
302 | static struct bin_attribute w1_slave_bin_attribute = { | 268 | static struct attribute_group w1_master_defattr_group = { |
303 | .attr = { | 269 | .attrs = w1_master_default_attrs, |
304 | .name = "w1_slave", | ||
305 | .mode = S_IRUGO, | ||
306 | .owner = THIS_MODULE, | ||
307 | }, | ||
308 | .size = W1_SLAVE_DATA_SIZE, | ||
309 | .read = &w1_default_read_bin, | ||
310 | }; | 270 | }; |
311 | 271 | ||
272 | int w1_create_master_attributes(struct w1_master *master) | ||
273 | { | ||
274 | return sysfs_create_group(&master->dev.kobj, &w1_master_defattr_group); | ||
275 | } | ||
276 | |||
277 | void w1_destroy_master_attributes(struct w1_master *master) | ||
278 | { | ||
279 | sysfs_remove_group(&master->dev.kobj, &w1_master_defattr_group); | ||
280 | } | ||
281 | |||
312 | static int __w1_attach_slave_device(struct w1_slave *sl) | 282 | static int __w1_attach_slave_device(struct w1_slave *sl) |
313 | { | 283 | { |
314 | int err; | 284 | int err; |
@@ -341,7 +311,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl) | |||
341 | memcpy(&sl->attr_bin, &w1_slave_bin_attribute, sizeof(sl->attr_bin)); | 311 | memcpy(&sl->attr_bin, &w1_slave_bin_attribute, sizeof(sl->attr_bin)); |
342 | memcpy(&sl->attr_name, &w1_slave_attribute, sizeof(sl->attr_name)); | 312 | memcpy(&sl->attr_name, &w1_slave_attribute, sizeof(sl->attr_name)); |
343 | memcpy(&sl->attr_val, &w1_slave_attribute_val, sizeof(sl->attr_val)); | 313 | memcpy(&sl->attr_val, &w1_slave_attribute_val, sizeof(sl->attr_val)); |
344 | 314 | ||
345 | sl->attr_bin.read = sl->family->fops->rbin; | 315 | sl->attr_bin.read = sl->family->fops->rbin; |
346 | sl->attr_name.show = sl->family->fops->rname; | 316 | sl->attr_name.show = sl->family->fops->rname; |
347 | sl->attr_val.show = sl->family->fops->rval; | 317 | sl->attr_val.show = sl->family->fops->rval; |
@@ -445,7 +415,7 @@ static int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) | |||
445 | static void w1_slave_detach(struct w1_slave *sl) | 415 | static void w1_slave_detach(struct w1_slave *sl) |
446 | { | 416 | { |
447 | struct w1_netlink_msg msg; | 417 | struct w1_netlink_msg msg; |
448 | 418 | ||
449 | dev_info(&sl->dev, "%s: detaching %s.\n", __func__, sl->name); | 419 | dev_info(&sl->dev, "%s: detaching %s.\n", __func__, sl->name); |
450 | 420 | ||
451 | while (atomic_read(&sl->refcnt)) { | 421 | while (atomic_read(&sl->refcnt)) { |
@@ -471,8 +441,8 @@ static struct w1_master *w1_search_master(unsigned long data) | |||
471 | { | 441 | { |
472 | struct w1_master *dev; | 442 | struct w1_master *dev; |
473 | int found = 0; | 443 | int found = 0; |
474 | 444 | ||
475 | spin_lock_irq(&w1_mlock); | 445 | spin_lock_bh(&w1_mlock); |
476 | list_for_each_entry(dev, &w1_masters, w1_master_entry) { | 446 | list_for_each_entry(dev, &w1_masters, w1_master_entry) { |
477 | if (dev->bus_master->data == data) { | 447 | if (dev->bus_master->data == data) { |
478 | found = 1; | 448 | found = 1; |
@@ -480,12 +450,12 @@ static struct w1_master *w1_search_master(unsigned long data) | |||
480 | break; | 450 | break; |
481 | } | 451 | } |
482 | } | 452 | } |
483 | spin_unlock_irq(&w1_mlock); | 453 | spin_unlock_bh(&w1_mlock); |
484 | 454 | ||
485 | return (found)?dev:NULL; | 455 | return (found)?dev:NULL; |
486 | } | 456 | } |
487 | 457 | ||
488 | void w1_slave_found(unsigned long data, u64 rn) | 458 | static void w1_slave_found(unsigned long data, u64 rn) |
489 | { | 459 | { |
490 | int slave_count; | 460 | int slave_count; |
491 | struct w1_slave *sl; | 461 | struct w1_slave *sl; |
@@ -500,7 +470,7 @@ void w1_slave_found(unsigned long data, u64 rn) | |||
500 | data); | 470 | data); |
501 | return; | 471 | return; |
502 | } | 472 | } |
503 | 473 | ||
504 | tmp = (struct w1_reg_num *) &rn; | 474 | tmp = (struct w1_reg_num *) &rn; |
505 | 475 | ||
506 | slave_count = 0; | 476 | slave_count = 0; |
@@ -513,8 +483,7 @@ void w1_slave_found(unsigned long data, u64 rn) | |||
513 | sl->reg_num.crc == tmp->crc) { | 483 | sl->reg_num.crc == tmp->crc) { |
514 | set_bit(W1_SLAVE_ACTIVE, (long *)&sl->flags); | 484 | set_bit(W1_SLAVE_ACTIVE, (long *)&sl->flags); |
515 | break; | 485 | break; |
516 | } | 486 | } else if (sl->reg_num.family == tmp->family) { |
517 | else if (sl->reg_num.family == tmp->family) { | ||
518 | family_found = 1; | 487 | family_found = 1; |
519 | break; | 488 | break; |
520 | } | 489 | } |
@@ -528,7 +497,7 @@ void w1_slave_found(unsigned long data, u64 rn) | |||
528 | rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) { | 497 | rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) { |
529 | w1_attach_slave_device(dev, tmp); | 498 | w1_attach_slave_device(dev, tmp); |
530 | } | 499 | } |
531 | 500 | ||
532 | atomic_dec(&dev->refcnt); | 501 | atomic_dec(&dev->refcnt); |
533 | } | 502 | } |
534 | 503 | ||
@@ -545,8 +514,8 @@ void w1_search(struct w1_master *dev) | |||
545 | 514 | ||
546 | desc_bit = 64; | 515 | desc_bit = 64; |
547 | 516 | ||
548 | while (!(id_bit && comp_bit) && !last_device | 517 | while (!(id_bit && comp_bit) && !last_device && |
549 | && count++ < dev->max_slave_count) { | 518 | count++ < dev->max_slave_count) { |
550 | last = rn; | 519 | last = rn; |
551 | rn = 0; | 520 | rn = 0; |
552 | 521 | ||
@@ -591,8 +560,7 @@ void w1_search(struct w1_master *dev) | |||
591 | last_family_desc = last_zero; | 560 | last_family_desc = last_zero; |
592 | } | 561 | } |
593 | 562 | ||
594 | } | 563 | } else |
595 | else | ||
596 | search_bit = id_bit; | 564 | search_bit = id_bit; |
597 | 565 | ||
598 | tmp = search_bit; | 566 | tmp = search_bit; |
@@ -615,42 +583,15 @@ void w1_search(struct w1_master *dev) | |||
615 | last_device = 1; | 583 | last_device = 1; |
616 | 584 | ||
617 | desc_bit = last_zero; | 585 | desc_bit = last_zero; |
618 | 586 | ||
619 | w1_slave_found(dev->bus_master->data, rn); | 587 | w1_slave_found(dev->bus_master->data, rn); |
620 | } | 588 | } |
621 | } | 589 | } |
622 | 590 | ||
623 | int w1_create_master_attributes(struct w1_master *dev) | 591 | static int w1_control(void *data) |
624 | { | ||
625 | if ( device_create_file(&dev->dev, &w1_master_attribute_slaves) < 0 || | ||
626 | device_create_file(&dev->dev, &w1_master_attribute_slave_count) < 0 || | ||
627 | device_create_file(&dev->dev, &w1_master_attribute_attempts) < 0 || | ||
628 | device_create_file(&dev->dev, &w1_master_attribute_max_slave_count) < 0 || | ||
629 | device_create_file(&dev->dev, &w1_master_attribute_timeout) < 0|| | ||
630 | device_create_file(&dev->dev, &w1_master_attribute_pointer) < 0|| | ||
631 | device_create_file(&dev->dev, &w1_master_attribute_name) < 0) | ||
632 | return -EINVAL; | ||
633 | |||
634 | return 0; | ||
635 | } | ||
636 | |||
637 | void w1_destroy_master_attributes(struct w1_master *dev) | ||
638 | { | ||
639 | device_remove_file(&dev->dev, &w1_master_attribute_slaves); | ||
640 | device_remove_file(&dev->dev, &w1_master_attribute_slave_count); | ||
641 | device_remove_file(&dev->dev, &w1_master_attribute_attempts); | ||
642 | device_remove_file(&dev->dev, &w1_master_attribute_max_slave_count); | ||
643 | device_remove_file(&dev->dev, &w1_master_attribute_timeout); | ||
644 | device_remove_file(&dev->dev, &w1_master_attribute_pointer); | ||
645 | device_remove_file(&dev->dev, &w1_master_attribute_name); | ||
646 | } | ||
647 | |||
648 | |||
649 | int w1_control(void *data) | ||
650 | { | 592 | { |
651 | struct w1_slave *sl; | 593 | struct w1_slave *sl, *sln; |
652 | struct w1_master *dev; | 594 | struct w1_master *dev, *n; |
653 | struct list_head *ent, *ment, *n, *mn; | ||
654 | int err, have_to_wait = 0; | 595 | int err, have_to_wait = 0; |
655 | 596 | ||
656 | daemonize("w1_control"); | 597 | daemonize("w1_control"); |
@@ -665,9 +606,7 @@ int w1_control(void *data) | |||
665 | if (signal_pending(current)) | 606 | if (signal_pending(current)) |
666 | flush_signals(current); | 607 | flush_signals(current); |
667 | 608 | ||
668 | list_for_each_safe(ment, mn, &w1_masters) { | 609 | list_for_each_entry_safe(dev, n, &w1_masters, w1_master_entry) { |
669 | dev = list_entry(ment, struct w1_master, w1_master_entry); | ||
670 | |||
671 | if (!control_needs_exit && !dev->need_exit) | 610 | if (!control_needs_exit && !dev->need_exit) |
672 | continue; | 611 | continue; |
673 | /* | 612 | /* |
@@ -679,9 +618,9 @@ int w1_control(void *data) | |||
679 | continue; | 618 | continue; |
680 | } | 619 | } |
681 | 620 | ||
682 | spin_lock(&w1_mlock); | 621 | spin_lock_bh(&w1_mlock); |
683 | list_del(&dev->w1_master_entry); | 622 | list_del(&dev->w1_master_entry); |
684 | spin_unlock(&w1_mlock); | 623 | spin_unlock_bh(&w1_mlock); |
685 | 624 | ||
686 | if (control_needs_exit) { | 625 | if (control_needs_exit) { |
687 | dev->need_exit = 1; | 626 | dev->need_exit = 1; |
@@ -695,19 +634,11 @@ int w1_control(void *data) | |||
695 | 634 | ||
696 | wait_for_completion(&dev->dev_exited); | 635 | wait_for_completion(&dev->dev_exited); |
697 | 636 | ||
698 | list_for_each_safe(ent, n, &dev->slist) { | 637 | list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) { |
699 | sl = list_entry(ent, struct w1_slave, w1_slave_entry); | 638 | list_del(&sl->w1_slave_entry); |
700 | |||
701 | if (!sl) | ||
702 | dev_warn(&dev->dev, | ||
703 | "%s: slave entry is NULL.\n", | ||
704 | __func__); | ||
705 | else { | ||
706 | list_del(&sl->w1_slave_entry); | ||
707 | 639 | ||
708 | w1_slave_detach(sl); | 640 | w1_slave_detach(sl); |
709 | kfree(sl); | 641 | kfree(sl); |
710 | } | ||
711 | } | 642 | } |
712 | w1_destroy_master_attributes(dev); | 643 | w1_destroy_master_attributes(dev); |
713 | atomic_dec(&dev->refcnt); | 644 | atomic_dec(&dev->refcnt); |
@@ -720,8 +651,7 @@ int w1_control(void *data) | |||
720 | int w1_process(void *data) | 651 | int w1_process(void *data) |
721 | { | 652 | { |
722 | struct w1_master *dev = (struct w1_master *) data; | 653 | struct w1_master *dev = (struct w1_master *) data; |
723 | struct list_head *ent, *n; | 654 | struct w1_slave *sl, *sln; |
724 | struct w1_slave *sl; | ||
725 | 655 | ||
726 | daemonize("%s", dev->name); | 656 | daemonize("%s", dev->name); |
727 | allow_signal(SIGTERM); | 657 | allow_signal(SIGTERM); |
@@ -742,27 +672,20 @@ int w1_process(void *data) | |||
742 | if (down_interruptible(&dev->mutex)) | 672 | if (down_interruptible(&dev->mutex)) |
743 | continue; | 673 | continue; |
744 | 674 | ||
745 | list_for_each_safe(ent, n, &dev->slist) { | 675 | list_for_each_entry(sl, &dev->slist, w1_slave_entry) |
746 | sl = list_entry(ent, struct w1_slave, w1_slave_entry); | ||
747 | |||
748 | if (sl) | ||
749 | clear_bit(W1_SLAVE_ACTIVE, (long *)&sl->flags); | 676 | clear_bit(W1_SLAVE_ACTIVE, (long *)&sl->flags); |
750 | } | ||
751 | |||
752 | w1_search_devices(dev, w1_slave_found); | ||
753 | 677 | ||
754 | list_for_each_safe(ent, n, &dev->slist) { | 678 | w1_search_devices(dev, w1_slave_found); |
755 | sl = list_entry(ent, struct w1_slave, w1_slave_entry); | ||
756 | 679 | ||
757 | if (sl && !test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) { | 680 | list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) { |
681 | if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) { | ||
758 | list_del (&sl->w1_slave_entry); | 682 | list_del (&sl->w1_slave_entry); |
759 | 683 | ||
760 | w1_slave_detach (sl); | 684 | w1_slave_detach (sl); |
761 | kfree (sl); | 685 | kfree (sl); |
762 | 686 | ||
763 | dev->slave_count--; | 687 | dev->slave_count--; |
764 | } | 688 | } else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags)) |
765 | else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags)) | ||
766 | sl->ttl = dev->slave_ttl; | 689 | sl->ttl = dev->slave_ttl; |
767 | } | 690 | } |
768 | up(&dev->mutex); | 691 | up(&dev->mutex); |
@@ -774,7 +697,7 @@ int w1_process(void *data) | |||
774 | return 0; | 697 | return 0; |
775 | } | 698 | } |
776 | 699 | ||
777 | int w1_init(void) | 700 | static int w1_init(void) |
778 | { | 701 | { |
779 | int retval; | 702 | int retval; |
780 | 703 | ||
@@ -814,18 +737,14 @@ err_out_exit_init: | |||
814 | return retval; | 737 | return retval; |
815 | } | 738 | } |
816 | 739 | ||
817 | void w1_fini(void) | 740 | static void w1_fini(void) |
818 | { | 741 | { |
819 | struct w1_master *dev; | 742 | struct w1_master *dev; |
820 | struct list_head *ent, *n; | ||
821 | 743 | ||
822 | list_for_each_safe(ent, n, &w1_masters) { | 744 | list_for_each_entry(dev, &w1_masters, w1_master_entry) |
823 | dev = list_entry(ent, struct w1_master, w1_master_entry); | ||
824 | __w1_remove_master_device(dev); | 745 | __w1_remove_master_device(dev); |
825 | } | ||
826 | 746 | ||
827 | control_needs_exit = 1; | 747 | control_needs_exit = 1; |
828 | |||
829 | wait_for_completion(&w1_control_complete); | 748 | wait_for_completion(&w1_control_complete); |
830 | 749 | ||
831 | driver_unregister(&w1_driver); | 750 | driver_unregister(&w1_driver); |
diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h index abbddaf3f8e2..90a2e737d2ca 100644 --- a/drivers/w1/w1.h +++ b/drivers/w1/w1.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1.h | 2 | * w1.h |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -25,9 +25,9 @@ | |||
25 | struct w1_reg_num | 25 | struct w1_reg_num |
26 | { | 26 | { |
27 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 27 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
28 | __u64 family:8, | 28 | __u64 family:8, |
29 | id:48, | 29 | id:48, |
30 | crc:8; | 30 | crc:8; |
31 | #elif defined(__BIG_ENDIAN_BITFIELD) | 31 | #elif defined(__BIG_ENDIAN_BITFIELD) |
32 | __u64 crc:8, | 32 | __u64 crc:8, |
33 | id:48, | 33 | id:48, |
@@ -74,11 +74,11 @@ struct w1_slave | |||
74 | int ttl; | 74 | int ttl; |
75 | 75 | ||
76 | struct w1_master *master; | 76 | struct w1_master *master; |
77 | struct w1_family *family; | 77 | struct w1_family *family; |
78 | struct device dev; | 78 | struct device dev; |
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, attr_val; |
83 | }; | 83 | }; |
84 | 84 | ||
@@ -90,16 +90,16 @@ struct w1_bus_master | |||
90 | 90 | ||
91 | u8 (*read_bit)(unsigned long); | 91 | u8 (*read_bit)(unsigned long); |
92 | void (*write_bit)(unsigned long, u8); | 92 | void (*write_bit)(unsigned long, u8); |
93 | 93 | ||
94 | u8 (*read_byte)(unsigned long); | 94 | u8 (*read_byte)(unsigned long); |
95 | void (*write_byte)(unsigned long, u8); | 95 | void (*write_byte)(unsigned long, u8); |
96 | 96 | ||
97 | u8 (*read_block)(unsigned long, u8 *, int); | 97 | u8 (*read_block)(unsigned long, u8 *, int); |
98 | void (*write_block)(unsigned long, u8 *, int); | 98 | void (*write_block)(unsigned long, u8 *, int); |
99 | 99 | ||
100 | u8 (*touch_bit)(unsigned long, u8); | 100 | u8 (*touch_bit)(unsigned long, u8); |
101 | 101 | ||
102 | u8 (*reset_bus)(unsigned long); | 102 | u8 (*reset_bus)(unsigned long); |
103 | 103 | ||
104 | void (*search)(unsigned long, w1_slave_found_callback); | 104 | void (*search)(unsigned long, w1_slave_found_callback); |
105 | }; | 105 | }; |
@@ -123,21 +123,20 @@ struct w1_master | |||
123 | 123 | ||
124 | int need_exit; | 124 | int need_exit; |
125 | pid_t kpid; | 125 | pid_t kpid; |
126 | struct semaphore mutex; | 126 | struct semaphore mutex; |
127 | 127 | ||
128 | struct device_driver *driver; | 128 | struct device_driver *driver; |
129 | struct device dev; | 129 | struct device dev; |
130 | struct completion dev_released; | 130 | struct completion dev_released; |
131 | struct completion dev_exited; | 131 | struct completion dev_exited; |
132 | 132 | ||
133 | struct w1_bus_master *bus_master; | 133 | struct w1_bus_master *bus_master; |
134 | 134 | ||
135 | u32 seq, groups; | 135 | u32 seq, groups; |
136 | struct sock *nls; | 136 | struct sock *nls; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | int w1_create_master_attributes(struct w1_master *); | 139 | int w1_create_master_attributes(struct w1_master *); |
140 | void w1_destroy_master_attributes(struct w1_master *); | ||
141 | void w1_search(struct w1_master *dev); | 140 | void w1_search(struct w1_master *dev); |
142 | 141 | ||
143 | #endif /* __KERNEL__ */ | 142 | #endif /* __KERNEL__ */ |
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c index d1d56eca1061..3941fb05b8e1 100644 --- a/drivers/w1/w1_family.c +++ b/drivers/w1/w1_family.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_family.c | 2 | * w1_family.c |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h index d01f0424cee9..218f12720622 100644 --- a/drivers/w1/w1_family.h +++ b/drivers/w1/w1_family.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_family.h | 2 | * w1_family.h |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -39,7 +39,7 @@ 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 | 42 | ||
43 | ssize_t (* rval)(struct device *, struct device_attribute *, char *); | 43 | ssize_t (* rval)(struct device *, struct device_attribute *, char *); |
44 | unsigned char rvalname[MAXNAMELEN]; | 44 | unsigned char rvalname[MAXNAMELEN]; |
45 | }; | 45 | }; |
@@ -48,9 +48,9 @@ struct w1_family | |||
48 | { | 48 | { |
49 | struct list_head family_entry; | 49 | struct list_head family_entry; |
50 | u8 fid; | 50 | u8 fid; |
51 | 51 | ||
52 | struct w1_family_ops *fops; | 52 | struct w1_family_ops *fops; |
53 | 53 | ||
54 | atomic_t refcnt; | 54 | atomic_t refcnt; |
55 | u8 need_exit; | 55 | u8 need_exit; |
56 | }; | 56 | }; |
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c index 5f0bafbbd575..ce24e3b3fc2a 100644 --- a/drivers/w1/w1_int.c +++ b/drivers/w1/w1_int.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_int.c | 2 | * w1_int.c |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -39,8 +39,9 @@ extern spinlock_t w1_mlock; | |||
39 | 39 | ||
40 | extern int w1_process(void *); | 40 | extern int w1_process(void *); |
41 | 41 | ||
42 | struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, | 42 | static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, |
43 | struct device_driver *driver, struct device *device) | 43 | struct device_driver *driver, |
44 | struct device *device) | ||
44 | { | 45 | { |
45 | struct w1_master *dev; | 46 | struct w1_master *dev; |
46 | int err; | 47 | int err; |
@@ -60,13 +61,13 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, | |||
60 | 61 | ||
61 | dev->bus_master = (struct w1_bus_master *)(dev + 1); | 62 | dev->bus_master = (struct w1_bus_master *)(dev + 1); |
62 | 63 | ||
63 | dev->owner = THIS_MODULE; | 64 | dev->owner = THIS_MODULE; |
64 | dev->max_slave_count = slave_count; | 65 | dev->max_slave_count = slave_count; |
65 | dev->slave_count = 0; | 66 | dev->slave_count = 0; |
66 | dev->attempts = 0; | 67 | dev->attempts = 0; |
67 | dev->kpid = -1; | 68 | dev->kpid = -1; |
68 | dev->initialized = 0; | 69 | dev->initialized = 0; |
69 | dev->id = id; | 70 | dev->id = id; |
70 | dev->slave_ttl = slave_ttl; | 71 | dev->slave_ttl = slave_ttl; |
71 | 72 | ||
72 | atomic_set(&dev->refcnt, 2); | 73 | atomic_set(&dev->refcnt, 2); |
@@ -105,7 +106,7 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, | |||
105 | return dev; | 106 | return dev; |
106 | } | 107 | } |
107 | 108 | ||
108 | void w1_free_dev(struct w1_master *dev) | 109 | static void w1_free_dev(struct w1_master *dev) |
109 | { | 110 | { |
110 | device_unregister(&dev->dev); | 111 | device_unregister(&dev->dev); |
111 | if (dev->nls && dev->nls->sk_socket) | 112 | if (dev->nls && dev->nls->sk_socket) |
@@ -197,10 +198,8 @@ void __w1_remove_master_device(struct w1_master *dev) | |||
197 | void w1_remove_master_device(struct w1_bus_master *bm) | 198 | void w1_remove_master_device(struct w1_bus_master *bm) |
198 | { | 199 | { |
199 | struct w1_master *dev = NULL; | 200 | struct w1_master *dev = NULL; |
200 | struct list_head *ent, *n; | ||
201 | 201 | ||
202 | list_for_each_safe(ent, n, &w1_masters) { | 202 | list_for_each_entry(dev, &w1_masters, w1_master_entry) { |
203 | dev = list_entry(ent, struct w1_master, w1_master_entry); | ||
204 | if (!dev->initialized) | 203 | if (!dev->initialized) |
205 | continue; | 204 | continue; |
206 | 205 | ||
diff --git a/drivers/w1/w1_int.h b/drivers/w1/w1_int.h index fdb531e87faa..4274082d2262 100644 --- a/drivers/w1/w1_int.h +++ b/drivers/w1/w1_int.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_int.h | 2 | * w1_int.h |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -27,8 +27,6 @@ | |||
27 | 27 | ||
28 | #include "w1.h" | 28 | #include "w1.h" |
29 | 29 | ||
30 | struct w1_master * w1_alloc_dev(u32, int, int, struct device_driver *, struct device *); | ||
31 | void w1_free_dev(struct w1_master *dev); | ||
32 | int w1_add_master_device(struct w1_bus_master *); | 30 | int w1_add_master_device(struct w1_bus_master *); |
33 | void w1_remove_master_device(struct w1_bus_master *); | 31 | void w1_remove_master_device(struct w1_bus_master *); |
34 | void __w1_remove_master_device(struct w1_master *); | 32 | void __w1_remove_master_device(struct w1_master *); |
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c index 02796b5a39f6..298ee8b72541 100644 --- a/drivers/w1/w1_io.c +++ b/drivers/w1/w1_io.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_io.c | 2 | * w1_io.c |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/w1/w1_io.h b/drivers/w1/w1_io.h index 6c573005a712..327c22ba50d5 100644 --- a/drivers/w1/w1_io.h +++ b/drivers/w1/w1_io.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_io.h | 2 | * w1_io.h |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/w1/w1_log.h b/drivers/w1/w1_log.h index a6bf6f44dce2..fe6bdf43380f 100644 --- a/drivers/w1/w1_log.h +++ b/drivers/w1/w1_log.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_log.h | 2 | * w1_log.h |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/w1/w1_netlink.h b/drivers/w1/w1_netlink.h index ea1b530abad0..8615756946df 100644 --- a/drivers/w1/w1_netlink.h +++ b/drivers/w1/w1_netlink.h | |||
@@ -33,13 +33,13 @@ enum w1_netlink_message_types { | |||
33 | W1_MASTER_REMOVE, | 33 | W1_MASTER_REMOVE, |
34 | }; | 34 | }; |
35 | 35 | ||
36 | struct w1_netlink_msg | 36 | struct w1_netlink_msg |
37 | { | 37 | { |
38 | __u8 type; | 38 | __u8 type; |
39 | __u8 reserved[3]; | 39 | __u8 reserved[3]; |
40 | union | 40 | union |
41 | { | 41 | { |
42 | struct w1_reg_num id; | 42 | struct w1_reg_num id; |
43 | __u64 w1_id; | 43 | __u64 w1_id; |
44 | struct | 44 | struct |
45 | { | 45 | { |
diff --git a/drivers/w1/w1_smem.c b/drivers/w1/w1_smem.c index 4a335f1a2ae2..285eb8f84574 100644 --- a/drivers/w1/w1_smem.c +++ b/drivers/w1/w1_smem.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_smem.c | 2 | * w1_smem.c |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the smems of the GNU General Public License as published by | 8 | * it under the smems of the GNU General Public License as published by |
@@ -70,7 +70,7 @@ static ssize_t w1_smem_read_val(struct device *dev, struct device_attribute *att | |||
70 | static ssize_t w1_smem_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count) | 70 | static ssize_t w1_smem_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count) |
71 | { | 71 | { |
72 | struct w1_slave *sl = container_of(container_of(kobj, struct device, kobj), | 72 | struct w1_slave *sl = container_of(container_of(kobj, struct device, kobj), |
73 | struct w1_slave, dev); | 73 | struct w1_slave, dev); |
74 | int i; | 74 | int i; |
75 | 75 | ||
76 | atomic_inc(&sl->refcnt); | 76 | atomic_inc(&sl->refcnt); |
@@ -90,7 +90,7 @@ static ssize_t w1_smem_read_bin(struct kobject *kobj, char *buf, loff_t off, siz | |||
90 | for (i = 0; i < 8; ++i) | 90 | for (i = 0; i < 8; ++i) |
91 | count += sprintf(buf + count, "%02x ", ((u8 *)&sl->reg_num)[i]); | 91 | count += sprintf(buf + count, "%02x ", ((u8 *)&sl->reg_num)[i]); |
92 | count += sprintf(buf + count, "\n"); | 92 | count += sprintf(buf + count, "\n"); |
93 | 93 | ||
94 | out: | 94 | out: |
95 | up(&sl->master->mutex); | 95 | up(&sl->master->mutex); |
96 | out_dec: | 96 | out_dec: |
diff --git a/drivers/w1/w1_therm.c b/drivers/w1/w1_therm.c index 84e8043a4499..e52abca05070 100644 --- a/drivers/w1/w1_therm.c +++ b/drivers/w1/w1_therm.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_therm.c | 2 | * w1_therm.c |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the therms of the GNU General Public License as published by | 8 | * it under the therms of the GNU General Public License as published by |
@@ -38,7 +38,7 @@ MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); | |||
38 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, temperature family."); | 38 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, temperature family."); |
39 | 39 | ||
40 | static u8 bad_roms[][9] = { | 40 | static u8 bad_roms[][9] = { |
41 | {0xaa, 0x00, 0x4b, 0x46, 0xff, 0xff, 0x0c, 0x10, 0x87}, | 41 | {0xaa, 0x00, 0x4b, 0x46, 0xff, 0xff, 0x0c, 0x10, 0x87}, |
42 | {} | 42 | {} |
43 | }; | 43 | }; |
44 | 44 | ||
@@ -163,7 +163,7 @@ static int w1_therm_check_rom(u8 rom[9]) | |||
163 | static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count) | 163 | static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count) |
164 | { | 164 | { |
165 | struct w1_slave *sl = container_of(container_of(kobj, struct device, kobj), | 165 | struct w1_slave *sl = container_of(container_of(kobj, struct device, kobj), |
166 | struct w1_slave, dev); | 166 | struct w1_slave, dev); |
167 | struct w1_master *dev = sl->master; | 167 | struct w1_master *dev = sl->master; |
168 | u8 rom[9], crc, verdict; | 168 | u8 rom[9], crc, verdict; |
169 | int i, max_trying = 10; | 169 | int i, max_trying = 10; |
@@ -198,7 +198,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si | |||
198 | unsigned int tm = 750; | 198 | unsigned int tm = 750; |
199 | 199 | ||
200 | memcpy(&match[1], (u64 *) & sl->reg_num, 8); | 200 | memcpy(&match[1], (u64 *) & sl->reg_num, 8); |
201 | 201 | ||
202 | w1_write_block(dev, match, 9); | 202 | w1_write_block(dev, match, 9); |
203 | 203 | ||
204 | w1_write_8(dev, W1_CONVERT_TEMP); | 204 | w1_write_8(dev, W1_CONVERT_TEMP); |
@@ -211,7 +211,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si | |||
211 | 211 | ||
212 | if (!w1_reset_bus (dev)) { | 212 | if (!w1_reset_bus (dev)) { |
213 | w1_write_block(dev, match, 9); | 213 | w1_write_block(dev, match, 9); |
214 | 214 | ||
215 | w1_write_8(dev, W1_READ_SCRATCHPAD); | 215 | w1_write_8(dev, W1_READ_SCRATCHPAD); |
216 | if ((count = w1_read_block(dev, rom, 9)) != 9) { | 216 | if ((count = w1_read_block(dev, rom, 9)) != 9) { |
217 | dev_warn(&dev->dev, "w1_read_block() returned %d instead of 9.\n", count); | 217 | dev_warn(&dev->dev, "w1_read_block() returned %d instead of 9.\n", count); |