diff options
Diffstat (limited to 'drivers/w1/slaves')
-rw-r--r-- | drivers/w1/slaves/Kconfig | 2 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2433.c | 21 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_smem.c | 1 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_therm.c | 13 |
4 files changed, 7 insertions, 30 deletions
diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig index f9d4c91fc533..d18d6424cd21 100644 --- a/drivers/w1/slaves/Kconfig +++ b/drivers/w1/slaves/Kconfig @@ -28,7 +28,7 @@ config W1_SLAVE_DS2433 config W1_SLAVE_DS2433_CRC bool "Protect DS2433 data with a CRC16" - depends on W1_DS2433 + depends on W1_SLAVE_DS2433 select CRC16 help Say Y here to protect DS2433 data with a CRC16. diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index fb118be789ea..2ac238f1480e 100644 --- a/drivers/w1/slaves/w1_ds2433.c +++ b/drivers/w1/slaves/w1_ds2433.c @@ -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; } diff --git a/drivers/w1/slaves/w1_smem.c b/drivers/w1/slaves/w1_smem.c index c6d3be54f94c..cc8c02e92593 100644 --- a/drivers/w1/slaves/w1_smem.c +++ b/drivers/w1/slaves/w1_smem.c @@ -28,7 +28,6 @@ #include <linux/types.h> #include "../w1.h" -#include "../w1_io.h" #include "../w1_int.h" #include "../w1_family.h" diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 536d16d78de7..5372cfcbd054 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c @@ -29,7 +29,6 @@ #include <linux/delay.h> #include "../w1.h" -#include "../w1_io.h" #include "../w1_int.h" #include "../w1_family.h" @@ -166,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; @@ -234,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; } |