aboutsummaryrefslogtreecommitdiff
path: root/drivers/w1/slaves/w1_ds2433.c
diff options
context:
space:
mode:
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>2006-04-03 12:04:27 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-22 11:22:50 -0700
commitabd52a13206e02537ca1dc08fc5438c7d27bdbf1 (patch)
treeefe0ff89898aad10600d392ac727dcea9e7af322 /drivers/w1/slaves/w1_ds2433.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_ds2433.c')
-rw-r--r--drivers/w1/slaves/w1_ds2433.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c
index ddd01e6fc2c..2ac238f1480 100644
--- a/drivers/w1/slaves/w1_ds2433.c
+++ b/drivers/w1/slaves/w1_ds2433.c
@@ -105,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
@@ -140,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;
}
@@ -231,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;
@@ -253,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;
}