diff options
Diffstat (limited to 'drivers/w1/slaves/w1_ds2433.c')
-rw-r--r-- | drivers/w1/slaves/w1_ds2433.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index ddd01e6fc2c9..2ac238f1480e 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, | |||
105 | if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) | 105 | if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) |
106 | return 0; | 106 | return 0; |
107 | 107 | ||
108 | atomic_inc(&sl->refcnt); | 108 | mutex_lock(&sl->master->mutex); |
109 | if (down_interruptible(&sl->master->mutex)) { | ||
110 | count = 0; | ||
111 | goto out_dec; | ||
112 | } | ||
113 | 109 | ||
114 | #ifdef CONFIG_W1_F23_CRC | 110 | #ifdef CONFIG_W1_F23_CRC |
115 | 111 | ||
@@ -140,9 +136,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | |||
140 | #endif /* CONFIG_W1_F23_CRC */ | 136 | #endif /* CONFIG_W1_F23_CRC */ |
141 | 137 | ||
142 | out_up: | 138 | out_up: |
143 | up(&sl->master->mutex); | 139 | mutex_unlock(&sl->master->mutex); |
144 | out_dec: | ||
145 | atomic_dec(&sl->refcnt); | ||
146 | 140 | ||
147 | return count; | 141 | return count; |
148 | } | 142 | } |
@@ -231,11 +225,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, | |||
231 | } | 225 | } |
232 | #endif /* CONFIG_W1_F23_CRC */ | 226 | #endif /* CONFIG_W1_F23_CRC */ |
233 | 227 | ||
234 | atomic_inc(&sl->refcnt); | 228 | mutex_lock(&sl->master->mutex); |
235 | if (down_interruptible(&sl->master->mutex)) { | ||
236 | count = 0; | ||
237 | goto out_dec; | ||
238 | } | ||
239 | 229 | ||
240 | /* Can only write data to one page at a time */ | 230 | /* Can only write data to one page at a time */ |
241 | idx = 0; | 231 | idx = 0; |
@@ -253,9 +243,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, | |||
253 | } | 243 | } |
254 | 244 | ||
255 | out_up: | 245 | out_up: |
256 | up(&sl->master->mutex); | 246 | mutex_unlock(&sl->master->mutex); |
257 | out_dec: | ||
258 | atomic_dec(&sl->refcnt); | ||
259 | 247 | ||
260 | return count; | 248 | return count; |
261 | } | 249 | } |