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