Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / drivers / w1 / slaves / w1_ds2433.c
index fb118be..2ac238f 100644 (file)
@@ -22,7 +22,6 @@
 #endif
 
 #include "../w1.h"
-#include "../w1_io.h"
 #include "../w1_int.h"
 #include "../w1_family.h"
 
@@ -106,11 +105,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off,
        if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
                return 0;
 
-       atomic_inc(&sl->refcnt);
-       if (down_interruptible(&sl->master->mutex)) {
-               count = 0;
-               goto out_dec;
-       }
+       mutex_lock(&sl->master->mutex);
 
 #ifdef CONFIG_W1_F23_CRC
 
@@ -141,9 +136,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off,
 #endif /* CONFIG_W1_F23_CRC */
 
 out_up:
-       up(&sl->master->mutex);
-out_dec:
-       atomic_dec(&sl->refcnt);
+       mutex_unlock(&sl->master->mutex);
 
        return count;
 }
@@ -232,11 +225,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off,
        }
 #endif /* CONFIG_W1_F23_CRC */
 
-       atomic_inc(&sl->refcnt);
-       if (down_interruptible(&sl->master->mutex)) {
-               count = 0;
-               goto out_dec;
-       }
+       mutex_lock(&sl->master->mutex);
 
        /* Can only write data to one page at a time */
        idx = 0;
@@ -254,9 +243,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off,
        }
 
 out_up:
-       up(&sl->master->mutex);
-out_dec:
-       atomic_dec(&sl->refcnt);
+       mutex_unlock(&sl->master->mutex);
 
        return count;
 }