]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/w1/slaves/w1_therm.c
[PATCH] w1: Use mutexes instead of semaphores.
[linux-2.6-omap-h63xx.git] / drivers / w1 / slaves / w1_therm.c
index 44afdffe3c8b8618f8677daee1ae69e4abc2ff9e..5372cfcbd0543aa1e8e5622f824682af9b87d530 100644 (file)
@@ -165,12 +165,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
        u8 rom[9], crc, verdict;
        int i, max_trying = 10;
 
-       atomic_inc(&sl->refcnt);
-       smp_mb__after_atomic_inc();
-       if (down_interruptible(&sl->master->mutex)) {
-               count = 0;
-               goto out_dec;
-       }
+       mutex_lock(&sl->master->mutex);
 
        if (off > W1_SLAVE_DATA_SIZE) {
                count = 0;
@@ -233,10 +228,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
 
        count += sprintf(buf + count, "t=%d\n", w1_convert_temp(rom, sl->family->fid));
 out:
-       up(&dev->mutex);
-out_dec:
-       smp_mb__before_atomic_inc();
-       atomic_dec(&sl->refcnt);
+       mutex_unlock(&dev->mutex);
 
        return count;
 }