diff options
Diffstat (limited to 'drivers/w1/slaves/w1_therm.c')
-rw-r--r-- | drivers/w1/slaves/w1_therm.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 536d16d78de..5372cfcbd05 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | 30 | ||
31 | #include "../w1.h" | 31 | #include "../w1.h" |
32 | #include "../w1_io.h" | ||
33 | #include "../w1_int.h" | 32 | #include "../w1_int.h" |
34 | #include "../w1_family.h" | 33 | #include "../w1_family.h" |
35 | 34 | ||
@@ -166,12 +165,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si | |||
166 | u8 rom[9], crc, verdict; | 165 | u8 rom[9], crc, verdict; |
167 | int i, max_trying = 10; | 166 | int i, max_trying = 10; |
168 | 167 | ||
169 | atomic_inc(&sl->refcnt); | 168 | mutex_lock(&sl->master->mutex); |
170 | smp_mb__after_atomic_inc(); | ||
171 | if (down_interruptible(&sl->master->mutex)) { | ||
172 | count = 0; | ||
173 | goto out_dec; | ||
174 | } | ||
175 | 169 | ||
176 | if (off > W1_SLAVE_DATA_SIZE) { | 170 | if (off > W1_SLAVE_DATA_SIZE) { |
177 | count = 0; | 171 | count = 0; |
@@ -234,10 +228,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si | |||
234 | 228 | ||
235 | count += sprintf(buf + count, "t=%d\n", w1_convert_temp(rom, sl->family->fid)); | 229 | count += sprintf(buf + count, "t=%d\n", w1_convert_temp(rom, sl->family->fid)); |
236 | out: | 230 | out: |
237 | up(&dev->mutex); | 231 | mutex_unlock(&dev->mutex); |
238 | out_dec: | ||
239 | smp_mb__before_atomic_inc(); | ||
240 | atomic_dec(&sl->refcnt); | ||
241 | 232 | ||
242 | return count; | 233 | return count; |
243 | } | 234 | } |