aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1/slaves/w1_therm.c
diff options
context:
space:
mode:
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>2006-04-03 04:04:27 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-22 14:22:50 -0400
commitabd52a13206e02537ca1dc08fc5438c7d27bdbf1 (patch)
treeefe0ff89898aad10600d392ac727dcea9e7af322 /drivers/w1/slaves/w1_therm.c
parent46e07f6e5eb0e465e086b8f485f4238bd453e3e9 (diff)
[PATCH] w1: Use mutexes instead of semaphores.
Use mutexes instead of semaphores. Patch tested on x86_64 and i386 with test bus master driver. Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1/slaves/w1_therm.c')
-rw-r--r--drivers/w1/slaves/w1_therm.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 44afdffe3c8..5372cfcbd05 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -165,12 +165,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
165 u8 rom[9], crc, verdict; 165 u8 rom[9], crc, verdict;
166 int i, max_trying = 10; 166 int i, max_trying = 10;
167 167
168 atomic_inc(&sl->refcnt); 168 mutex_lock(&sl->master->mutex);
169 smp_mb__after_atomic_inc();
170 if (down_interruptible(&sl->master->mutex)) {
171 count = 0;
172 goto out_dec;
173 }
174 169
175 if (off > W1_SLAVE_DATA_SIZE) { 170 if (off > W1_SLAVE_DATA_SIZE) {
176 count = 0; 171 count = 0;
@@ -233,10 +228,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
233 228
234 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));
235out: 230out:
236 up(&dev->mutex); 231 mutex_unlock(&dev->mutex);
237out_dec:
238 smp_mb__before_atomic_inc();
239 atomic_dec(&sl->refcnt);
240 232
241 return count; 233 return count;
242} 234}