diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-26 14:25:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-26 14:25:33 -0400 |
commit | fa93669a1917f93b09142d4b2298329b82d7d36d (patch) | |
tree | 7f8d6dc9d1fbb086c59a799a3a7137c46fb9959e /drivers/w1 | |
parent | b13bc8dda81c54a66a1c84e66f60b8feba659f28 (diff) | |
parent | 6791457a090d9a234a40b501c2536f0aefaeae4b (diff) |
Merge tag 'driver-core-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core changes from Greg Kroah-Hartman:
"Here's the big driver core pull request for 3.6-rc1.
Unlike 3.5, this kernel should be a lot tamer, with the printk changes
now settled down. All we have here is some extcon driver updates, w1
driver updates, a few printk cleanups that weren't needed for 3.5, but
are good to have now, and some other minor fixes/changes in the driver
core.
All of these have been in the linux-next releases for a while now.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
* tag 'driver-core-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (38 commits)
printk: Export struct log size and member offsets through vmcoreinfo
Drivers: hv: Change the hex constant to a decimal constant
driver core: don't trigger uevent after failure
extcon: MAX77693: Add extcon-max77693 driver to support Maxim MAX77693 MUIC device
sysfs: fail dentry revalidation after namespace change fix
sysfs: fail dentry revalidation after namespace change
extcon: spelling of detach in function doc
extcon: arizona: Stop microphone detection if we give up on it
extcon: arizona: Update cable reporting calls and split headset
PM / Runtime: Do not increment device usage counts before probing
kmsg - do not flush partial lines when the console is busy
kmsg - export "continuation record" flag to /dev/kmsg
kmsg - avoid warning for CONFIG_PRINTK=n compilations
kmsg - properly print over-long continuation lines
driver-core: Use kobj_to_dev instead of re-implementing it
driver-core: Move kobj_to_dev from genhd.h to device.h
driver core: Move deferred devices to the end of dpm_list before probing
driver core: move uevent call to driver_register
driver core: fix shutdown races with probe/remove(v3)
Extcon: Arizona: Add driver for Wolfson Arizona class devices
...
Diffstat (limited to 'drivers/w1')
-rw-r--r-- | drivers/w1/masters/ds1wm.c | 4 | ||||
-rw-r--r-- | drivers/w1/masters/omap_hdq.c | 30 | ||||
-rw-r--r-- | drivers/w1/slaves/Kconfig | 13 | ||||
-rw-r--r-- | drivers/w1/slaves/Makefile | 1 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_bq27000.c | 4 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2408.c | 24 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2423.c | 4 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2431.c | 8 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2433.c | 8 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2760.c | 8 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2780.c | 22 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2780.h | 2 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2781.c | 22 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2781.h | 2 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds28e04.c | 469 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_therm.c | 10 | ||||
-rw-r--r-- | drivers/w1/w1.c | 23 | ||||
-rw-r--r-- | drivers/w1/w1.h | 1 | ||||
-rw-r--r-- | drivers/w1/w1_family.h | 1 | ||||
-rw-r--r-- | drivers/w1/w1_int.c | 3 |
20 files changed, 560 insertions, 99 deletions
diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c index a0c8965c1a79..530a2d309063 100644 --- a/drivers/w1/masters/ds1wm.c +++ b/drivers/w1/masters/ds1wm.c | |||
@@ -334,7 +334,9 @@ static void ds1wm_search(void *data, struct w1_master *master_dev, | |||
334 | return; | 334 | return; |
335 | } | 335 | } |
336 | 336 | ||
337 | mutex_lock(&master_dev->bus_mutex); | ||
337 | if (ds1wm_reset(ds1wm_data)) { | 338 | if (ds1wm_reset(ds1wm_data)) { |
339 | mutex_unlock(&master_dev->bus_mutex); | ||
338 | dev_dbg(&ds1wm_data->pdev->dev, | 340 | dev_dbg(&ds1wm_data->pdev->dev, |
339 | "pass: %d reset error (or no slaves)\n", pass); | 341 | "pass: %d reset error (or no slaves)\n", pass); |
340 | break; | 342 | break; |
@@ -387,6 +389,7 @@ static void ds1wm_search(void *data, struct w1_master *master_dev, | |||
387 | 389 | ||
388 | } | 390 | } |
389 | if (ds1wm_data->read_error) { | 391 | if (ds1wm_data->read_error) { |
392 | mutex_unlock(&master_dev->bus_mutex); | ||
390 | dev_err(&ds1wm_data->pdev->dev, | 393 | dev_err(&ds1wm_data->pdev->dev, |
391 | "pass: %d read error, retrying\n", pass); | 394 | "pass: %d read error, retrying\n", pass); |
392 | break; | 395 | break; |
@@ -400,6 +403,7 @@ static void ds1wm_search(void *data, struct w1_master *master_dev, | |||
400 | dev_dbg(&ds1wm_data->pdev->dev, | 403 | dev_dbg(&ds1wm_data->pdev->dev, |
401 | "pass: %d resetting bus\n", pass); | 404 | "pass: %d resetting bus\n", pass); |
402 | ds1wm_reset(ds1wm_data); | 405 | ds1wm_reset(ds1wm_data); |
406 | mutex_unlock(&master_dev->bus_mutex); | ||
403 | if ((r_prime & ((u64)1 << 63)) && (d & ((u64)1 << 63))) { | 407 | if ((r_prime & ((u64)1 << 63)) && (d & ((u64)1 << 63))) { |
404 | dev_err(&ds1wm_data->pdev->dev, | 408 | dev_err(&ds1wm_data->pdev->dev, |
405 | "pass: %d bus error, retrying\n", pass); | 409 | "pass: %d bus error, retrying\n", pass); |
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index 291897c881be..4b0fcf3c2d03 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c | |||
@@ -178,6 +178,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status) | |||
178 | hdq_data->hdq_irqstatus, OMAP_HDQ_TIMEOUT); | 178 | hdq_data->hdq_irqstatus, OMAP_HDQ_TIMEOUT); |
179 | if (ret == 0) { | 179 | if (ret == 0) { |
180 | dev_dbg(hdq_data->dev, "TX wait elapsed\n"); | 180 | dev_dbg(hdq_data->dev, "TX wait elapsed\n"); |
181 | ret = -ETIMEDOUT; | ||
181 | goto out; | 182 | goto out; |
182 | } | 183 | } |
183 | 184 | ||
@@ -185,7 +186,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status) | |||
185 | /* check irqstatus */ | 186 | /* check irqstatus */ |
186 | if (!(*status & OMAP_HDQ_INT_STATUS_TXCOMPLETE)) { | 187 | if (!(*status & OMAP_HDQ_INT_STATUS_TXCOMPLETE)) { |
187 | dev_dbg(hdq_data->dev, "timeout waiting for" | 188 | dev_dbg(hdq_data->dev, "timeout waiting for" |
188 | "TXCOMPLETE/RXCOMPLETE, %x", *status); | 189 | " TXCOMPLETE/RXCOMPLETE, %x", *status); |
189 | ret = -ETIMEDOUT; | 190 | ret = -ETIMEDOUT; |
190 | goto out; | 191 | goto out; |
191 | } | 192 | } |
@@ -196,7 +197,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status) | |||
196 | OMAP_HDQ_FLAG_CLEAR, &tmp_status); | 197 | OMAP_HDQ_FLAG_CLEAR, &tmp_status); |
197 | if (ret) { | 198 | if (ret) { |
198 | dev_dbg(hdq_data->dev, "timeout waiting GO bit" | 199 | dev_dbg(hdq_data->dev, "timeout waiting GO bit" |
199 | "return to zero, %x", tmp_status); | 200 | " return to zero, %x", tmp_status); |
200 | } | 201 | } |
201 | 202 | ||
202 | out: | 203 | out: |
@@ -339,7 +340,7 @@ static int omap_hdq_break(struct hdq_data *hdq_data) | |||
339 | &tmp_status); | 340 | &tmp_status); |
340 | if (ret) | 341 | if (ret) |
341 | dev_dbg(hdq_data->dev, "timeout waiting INIT&GO bits" | 342 | dev_dbg(hdq_data->dev, "timeout waiting INIT&GO bits" |
342 | "return to zero, %x", tmp_status); | 343 | " return to zero, %x", tmp_status); |
343 | 344 | ||
344 | out: | 345 | out: |
345 | mutex_unlock(&hdq_data->hdq_mutex); | 346 | mutex_unlock(&hdq_data->hdq_mutex); |
@@ -351,7 +352,6 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) | |||
351 | { | 352 | { |
352 | int ret = 0; | 353 | int ret = 0; |
353 | u8 status; | 354 | u8 status; |
354 | unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT; | ||
355 | 355 | ||
356 | ret = mutex_lock_interruptible(&hdq_data->hdq_mutex); | 356 | ret = mutex_lock_interruptible(&hdq_data->hdq_mutex); |
357 | if (ret < 0) { | 357 | if (ret < 0) { |
@@ -369,22 +369,20 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) | |||
369 | OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO, | 369 | OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO, |
370 | OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO); | 370 | OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO); |
371 | /* | 371 | /* |
372 | * The RX comes immediately after TX. It | 372 | * The RX comes immediately after TX. |
373 | * triggers another interrupt before we | ||
374 | * sleep. So we have to wait for RXCOMPLETE bit. | ||
375 | */ | 373 | */ |
376 | while (!(hdq_data->hdq_irqstatus | 374 | wait_event_timeout(hdq_wait_queue, |
377 | & OMAP_HDQ_INT_STATUS_RXCOMPLETE) | 375 | (hdq_data->hdq_irqstatus |
378 | && time_before(jiffies, timeout)) { | 376 | & OMAP_HDQ_INT_STATUS_RXCOMPLETE), |
379 | schedule_timeout_uninterruptible(1); | 377 | OMAP_HDQ_TIMEOUT); |
380 | } | 378 | |
381 | hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0, | 379 | hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0, |
382 | OMAP_HDQ_CTRL_STATUS_DIR); | 380 | OMAP_HDQ_CTRL_STATUS_DIR); |
383 | status = hdq_data->hdq_irqstatus; | 381 | status = hdq_data->hdq_irqstatus; |
384 | /* check irqstatus */ | 382 | /* check irqstatus */ |
385 | if (!(status & OMAP_HDQ_INT_STATUS_RXCOMPLETE)) { | 383 | if (!(status & OMAP_HDQ_INT_STATUS_RXCOMPLETE)) { |
386 | dev_dbg(hdq_data->dev, "timeout waiting for" | 384 | dev_dbg(hdq_data->dev, "timeout waiting for" |
387 | "RXCOMPLETE, %x", status); | 385 | " RXCOMPLETE, %x", status); |
388 | ret = -ETIMEDOUT; | 386 | ret = -ETIMEDOUT; |
389 | goto out; | 387 | goto out; |
390 | } | 388 | } |
@@ -394,7 +392,7 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) | |||
394 | out: | 392 | out: |
395 | mutex_unlock(&hdq_data->hdq_mutex); | 393 | mutex_unlock(&hdq_data->hdq_mutex); |
396 | rtn: | 394 | rtn: |
397 | return 0; | 395 | return ret; |
398 | 396 | ||
399 | } | 397 | } |
400 | 398 | ||
@@ -456,7 +454,7 @@ static int omap_hdq_put(struct hdq_data *hdq_data) | |||
456 | 454 | ||
457 | if (0 == hdq_data->hdq_usecount) { | 455 | if (0 == hdq_data->hdq_usecount) { |
458 | dev_dbg(hdq_data->dev, "attempt to decrement use count" | 456 | dev_dbg(hdq_data->dev, "attempt to decrement use count" |
459 | "when it is zero"); | 457 | " when it is zero"); |
460 | ret = -EINVAL; | 458 | ret = -EINVAL; |
461 | } else { | 459 | } else { |
462 | hdq_data->hdq_usecount--; | 460 | hdq_data->hdq_usecount--; |
@@ -524,7 +522,7 @@ static void omap_w1_write_byte(void *_hdq, u8 byte) | |||
524 | mutex_unlock(&hdq_data->hdq_mutex); | 522 | mutex_unlock(&hdq_data->hdq_mutex); |
525 | 523 | ||
526 | ret = hdq_write_byte(hdq_data, byte, &status); | 524 | ret = hdq_write_byte(hdq_data, byte, &status); |
527 | if (ret == 0) { | 525 | if (ret < 0) { |
528 | dev_dbg(hdq_data->dev, "TX failure:Ctrl status %x\n", status); | 526 | dev_dbg(hdq_data->dev, "TX failure:Ctrl status %x\n", status); |
529 | return; | 527 | return; |
530 | } | 528 | } |
diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig index eb9e376d6244..67526690acbc 100644 --- a/drivers/w1/slaves/Kconfig +++ b/drivers/w1/slaves/Kconfig | |||
@@ -94,6 +94,19 @@ config W1_SLAVE_DS2781 | |||
94 | 94 | ||
95 | If you are unsure, say N. | 95 | If you are unsure, say N. |
96 | 96 | ||
97 | config W1_SLAVE_DS28E04 | ||
98 | tristate "4096-Bit Addressable 1-Wire EEPROM with PIO (DS28E04-100)" | ||
99 | depends on W1 | ||
100 | select CRC16 | ||
101 | help | ||
102 | If you enable this you will have the DS28E04-100 | ||
103 | chip support. | ||
104 | |||
105 | Say Y here if you want to use a 1-wire | ||
106 | 4kb EEPROM with PIO family device (DS28E04). | ||
107 | |||
108 | If you are unsure, say N. | ||
109 | |||
97 | config W1_SLAVE_BQ27000 | 110 | config W1_SLAVE_BQ27000 |
98 | tristate "BQ27000 slave support" | 111 | tristate "BQ27000 slave support" |
99 | depends on W1 | 112 | depends on W1 |
diff --git a/drivers/w1/slaves/Makefile b/drivers/w1/slaves/Makefile index c4f1859fb520..05188f6aab5a 100644 --- a/drivers/w1/slaves/Makefile +++ b/drivers/w1/slaves/Makefile | |||
@@ -12,3 +12,4 @@ obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o | |||
12 | obj-$(CONFIG_W1_SLAVE_DS2780) += w1_ds2780.o | 12 | obj-$(CONFIG_W1_SLAVE_DS2780) += w1_ds2780.o |
13 | obj-$(CONFIG_W1_SLAVE_DS2781) += w1_ds2781.o | 13 | obj-$(CONFIG_W1_SLAVE_DS2781) += w1_ds2781.o |
14 | obj-$(CONFIG_W1_SLAVE_BQ27000) += w1_bq27000.o | 14 | obj-$(CONFIG_W1_SLAVE_BQ27000) += w1_bq27000.o |
15 | obj-$(CONFIG_W1_SLAVE_DS28E04) += w1_ds28e04.o | ||
diff --git a/drivers/w1/slaves/w1_bq27000.c b/drivers/w1/slaves/w1_bq27000.c index 52ad812fa1e7..773dca5beafe 100644 --- a/drivers/w1/slaves/w1_bq27000.c +++ b/drivers/w1/slaves/w1_bq27000.c | |||
@@ -31,10 +31,10 @@ static int w1_bq27000_read(struct device *dev, unsigned int reg) | |||
31 | u8 val; | 31 | u8 val; |
32 | struct w1_slave *sl = container_of(dev->parent, struct w1_slave, dev); | 32 | struct w1_slave *sl = container_of(dev->parent, struct w1_slave, dev); |
33 | 33 | ||
34 | mutex_lock(&sl->master->mutex); | 34 | mutex_lock(&sl->master->bus_mutex); |
35 | w1_write_8(sl->master, HDQ_CMD_READ | reg); | 35 | w1_write_8(sl->master, HDQ_CMD_READ | reg); |
36 | val = w1_read_8(sl->master); | 36 | val = w1_read_8(sl->master); |
37 | mutex_unlock(&sl->master->mutex); | 37 | mutex_unlock(&sl->master->bus_mutex); |
38 | 38 | ||
39 | return val; | 39 | return val; |
40 | } | 40 | } |
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c index 8e813eed0f0a..441ad3a3b586 100644 --- a/drivers/w1/slaves/w1_ds2408.c +++ b/drivers/w1/slaves/w1_ds2408.c | |||
@@ -52,11 +52,11 @@ static int _read_reg(struct w1_slave *sl, u8 address, unsigned char* buf) | |||
52 | if (!buf) | 52 | if (!buf) |
53 | return -EINVAL; | 53 | return -EINVAL; |
54 | 54 | ||
55 | mutex_lock(&sl->master->mutex); | 55 | mutex_lock(&sl->master->bus_mutex); |
56 | dev_dbg(&sl->dev, "mutex locked"); | 56 | dev_dbg(&sl->dev, "mutex locked"); |
57 | 57 | ||
58 | if (w1_reset_select_slave(sl)) { | 58 | if (w1_reset_select_slave(sl)) { |
59 | mutex_unlock(&sl->master->mutex); | 59 | mutex_unlock(&sl->master->bus_mutex); |
60 | return -EIO; | 60 | return -EIO; |
61 | } | 61 | } |
62 | 62 | ||
@@ -66,7 +66,7 @@ static int _read_reg(struct w1_slave *sl, u8 address, unsigned char* buf) | |||
66 | w1_write_block(sl->master, wrbuf, 3); | 66 | w1_write_block(sl->master, wrbuf, 3); |
67 | *buf = w1_read_8(sl->master); | 67 | *buf = w1_read_8(sl->master); |
68 | 68 | ||
69 | mutex_unlock(&sl->master->mutex); | 69 | mutex_unlock(&sl->master->bus_mutex); |
70 | dev_dbg(&sl->dev, "mutex unlocked"); | 70 | dev_dbg(&sl->dev, "mutex unlocked"); |
71 | return 1; | 71 | return 1; |
72 | } | 72 | } |
@@ -165,7 +165,7 @@ static ssize_t w1_f29_write_output( | |||
165 | return -EFAULT; | 165 | return -EFAULT; |
166 | 166 | ||
167 | dev_dbg(&sl->dev, "locking mutex for write_output"); | 167 | dev_dbg(&sl->dev, "locking mutex for write_output"); |
168 | mutex_lock(&sl->master->mutex); | 168 | mutex_lock(&sl->master->bus_mutex); |
169 | dev_dbg(&sl->dev, "mutex locked"); | 169 | dev_dbg(&sl->dev, "mutex locked"); |
170 | 170 | ||
171 | if (w1_reset_select_slave(sl)) | 171 | if (w1_reset_select_slave(sl)) |
@@ -200,14 +200,14 @@ static ssize_t w1_f29_write_output( | |||
200 | /* read the result of the READ_PIO_REGS command */ | 200 | /* read the result of the READ_PIO_REGS command */ |
201 | if (w1_read_8(sl->master) == *buf) { | 201 | if (w1_read_8(sl->master) == *buf) { |
202 | /* success! */ | 202 | /* success! */ |
203 | mutex_unlock(&sl->master->mutex); | 203 | mutex_unlock(&sl->master->bus_mutex); |
204 | dev_dbg(&sl->dev, | 204 | dev_dbg(&sl->dev, |
205 | "mutex unlocked, retries:%d", retries); | 205 | "mutex unlocked, retries:%d", retries); |
206 | return 1; | 206 | return 1; |
207 | } | 207 | } |
208 | } | 208 | } |
209 | error: | 209 | error: |
210 | mutex_unlock(&sl->master->mutex); | 210 | mutex_unlock(&sl->master->bus_mutex); |
211 | dev_dbg(&sl->dev, "mutex unlocked in error, retries:%d", retries); | 211 | dev_dbg(&sl->dev, "mutex unlocked in error, retries:%d", retries); |
212 | 212 | ||
213 | return -EIO; | 213 | return -EIO; |
@@ -228,7 +228,7 @@ static ssize_t w1_f29_write_activity( | |||
228 | if (count != 1 || off != 0) | 228 | if (count != 1 || off != 0) |
229 | return -EFAULT; | 229 | return -EFAULT; |
230 | 230 | ||
231 | mutex_lock(&sl->master->mutex); | 231 | mutex_lock(&sl->master->bus_mutex); |
232 | 232 | ||
233 | if (w1_reset_select_slave(sl)) | 233 | if (w1_reset_select_slave(sl)) |
234 | goto error; | 234 | goto error; |
@@ -236,7 +236,7 @@ static ssize_t w1_f29_write_activity( | |||
236 | while (retries--) { | 236 | while (retries--) { |
237 | w1_write_8(sl->master, W1_F29_FUNC_RESET_ACTIVITY_LATCHES); | 237 | w1_write_8(sl->master, W1_F29_FUNC_RESET_ACTIVITY_LATCHES); |
238 | if (w1_read_8(sl->master) == W1_F29_SUCCESS_CONFIRM_BYTE) { | 238 | if (w1_read_8(sl->master) == W1_F29_SUCCESS_CONFIRM_BYTE) { |
239 | mutex_unlock(&sl->master->mutex); | 239 | mutex_unlock(&sl->master->bus_mutex); |
240 | return 1; | 240 | return 1; |
241 | } | 241 | } |
242 | if (w1_reset_resume_command(sl->master)) | 242 | if (w1_reset_resume_command(sl->master)) |
@@ -244,7 +244,7 @@ static ssize_t w1_f29_write_activity( | |||
244 | } | 244 | } |
245 | 245 | ||
246 | error: | 246 | error: |
247 | mutex_unlock(&sl->master->mutex); | 247 | mutex_unlock(&sl->master->bus_mutex); |
248 | return -EIO; | 248 | return -EIO; |
249 | } | 249 | } |
250 | 250 | ||
@@ -263,7 +263,7 @@ static ssize_t w1_f29_write_status_control( | |||
263 | if (count != 1 || off != 0) | 263 | if (count != 1 || off != 0) |
264 | return -EFAULT; | 264 | return -EFAULT; |
265 | 265 | ||
266 | mutex_lock(&sl->master->mutex); | 266 | mutex_lock(&sl->master->bus_mutex); |
267 | 267 | ||
268 | if (w1_reset_select_slave(sl)) | 268 | if (w1_reset_select_slave(sl)) |
269 | goto error; | 269 | goto error; |
@@ -285,12 +285,12 @@ static ssize_t w1_f29_write_status_control( | |||
285 | w1_write_block(sl->master, w1_buf, 3); | 285 | w1_write_block(sl->master, w1_buf, 3); |
286 | if (w1_read_8(sl->master) == *buf) { | 286 | if (w1_read_8(sl->master) == *buf) { |
287 | /* success! */ | 287 | /* success! */ |
288 | mutex_unlock(&sl->master->mutex); | 288 | mutex_unlock(&sl->master->bus_mutex); |
289 | return 1; | 289 | return 1; |
290 | } | 290 | } |
291 | } | 291 | } |
292 | error: | 292 | error: |
293 | mutex_unlock(&sl->master->mutex); | 293 | mutex_unlock(&sl->master->bus_mutex); |
294 | 294 | ||
295 | return -EIO; | 295 | return -EIO; |
296 | } | 296 | } |
diff --git a/drivers/w1/slaves/w1_ds2423.c b/drivers/w1/slaves/w1_ds2423.c index 7a7dbe5026f1..40a10b5ed120 100644 --- a/drivers/w1/slaves/w1_ds2423.c +++ b/drivers/w1/slaves/w1_ds2423.c | |||
@@ -66,7 +66,7 @@ static ssize_t w1_counter_read(struct device *device, | |||
66 | wrbuf[0] = 0xA5; | 66 | wrbuf[0] = 0xA5; |
67 | wrbuf[1] = rom_addr & 0xFF; | 67 | wrbuf[1] = rom_addr & 0xFF; |
68 | wrbuf[2] = rom_addr >> 8; | 68 | wrbuf[2] = rom_addr >> 8; |
69 | mutex_lock(&dev->mutex); | 69 | mutex_lock(&dev->bus_mutex); |
70 | if (!w1_reset_select_slave(sl)) { | 70 | if (!w1_reset_select_slave(sl)) { |
71 | w1_write_block(dev, wrbuf, 3); | 71 | w1_write_block(dev, wrbuf, 3); |
72 | read_byte_count = 0; | 72 | read_byte_count = 0; |
@@ -124,7 +124,7 @@ static ssize_t w1_counter_read(struct device *device, | |||
124 | } else { | 124 | } else { |
125 | c -= snprintf(out_buf + PAGE_SIZE - c, c, "Connection error"); | 125 | c -= snprintf(out_buf + PAGE_SIZE - c, c, "Connection error"); |
126 | } | 126 | } |
127 | mutex_unlock(&dev->mutex); | 127 | mutex_unlock(&dev->bus_mutex); |
128 | return PAGE_SIZE - c; | 128 | return PAGE_SIZE - c; |
129 | } | 129 | } |
130 | 130 | ||
diff --git a/drivers/w1/slaves/w1_ds2431.c b/drivers/w1/slaves/w1_ds2431.c index 84e2410aec1d..984b30331a45 100644 --- a/drivers/w1/slaves/w1_ds2431.c +++ b/drivers/w1/slaves/w1_ds2431.c | |||
@@ -107,7 +107,7 @@ static ssize_t w1_f2d_read_bin(struct file *filp, struct kobject *kobj, | |||
107 | if (count == 0) | 107 | if (count == 0) |
108 | return 0; | 108 | return 0; |
109 | 109 | ||
110 | mutex_lock(&sl->master->mutex); | 110 | mutex_lock(&sl->master->bus_mutex); |
111 | 111 | ||
112 | /* read directly from the EEPROM in chunks of W1_F2D_READ_MAXLEN */ | 112 | /* read directly from the EEPROM in chunks of W1_F2D_READ_MAXLEN */ |
113 | while (todo > 0) { | 113 | while (todo > 0) { |
@@ -126,7 +126,7 @@ static ssize_t w1_f2d_read_bin(struct file *filp, struct kobject *kobj, | |||
126 | off += W1_F2D_READ_MAXLEN; | 126 | off += W1_F2D_READ_MAXLEN; |
127 | } | 127 | } |
128 | 128 | ||
129 | mutex_unlock(&sl->master->mutex); | 129 | mutex_unlock(&sl->master->bus_mutex); |
130 | 130 | ||
131 | return count; | 131 | return count; |
132 | } | 132 | } |
@@ -214,7 +214,7 @@ static ssize_t w1_f2d_write_bin(struct file *filp, struct kobject *kobj, | |||
214 | if (count == 0) | 214 | if (count == 0) |
215 | return 0; | 215 | return 0; |
216 | 216 | ||
217 | mutex_lock(&sl->master->mutex); | 217 | mutex_lock(&sl->master->bus_mutex); |
218 | 218 | ||
219 | /* Can only write data in blocks of the size of the scratchpad */ | 219 | /* Can only write data in blocks of the size of the scratchpad */ |
220 | addr = off; | 220 | addr = off; |
@@ -259,7 +259,7 @@ static ssize_t w1_f2d_write_bin(struct file *filp, struct kobject *kobj, | |||
259 | } | 259 | } |
260 | 260 | ||
261 | out_up: | 261 | out_up: |
262 | mutex_unlock(&sl->master->mutex); | 262 | mutex_unlock(&sl->master->bus_mutex); |
263 | 263 | ||
264 | return count; | 264 | return count; |
265 | } | 265 | } |
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index 0f7b8f9c509a..85f2cdb27fa2 100644 --- a/drivers/w1/slaves/w1_ds2433.c +++ b/drivers/w1/slaves/w1_ds2433.c | |||
@@ -107,7 +107,7 @@ static ssize_t w1_f23_read_bin(struct file *filp, struct kobject *kobj, | |||
107 | if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) | 107 | if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) |
108 | return 0; | 108 | return 0; |
109 | 109 | ||
110 | mutex_lock(&sl->master->mutex); | 110 | mutex_lock(&sl->master->bus_mutex); |
111 | 111 | ||
112 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC | 112 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
113 | 113 | ||
@@ -138,7 +138,7 @@ static ssize_t w1_f23_read_bin(struct file *filp, struct kobject *kobj, | |||
138 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ | 138 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
139 | 139 | ||
140 | out_up: | 140 | out_up: |
141 | mutex_unlock(&sl->master->mutex); | 141 | mutex_unlock(&sl->master->bus_mutex); |
142 | 142 | ||
143 | return count; | 143 | return count; |
144 | } | 144 | } |
@@ -233,7 +233,7 @@ static ssize_t w1_f23_write_bin(struct file *filp, struct kobject *kobj, | |||
233 | } | 233 | } |
234 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ | 234 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
235 | 235 | ||
236 | mutex_lock(&sl->master->mutex); | 236 | mutex_lock(&sl->master->bus_mutex); |
237 | 237 | ||
238 | /* Can only write data to one page at a time */ | 238 | /* Can only write data to one page at a time */ |
239 | idx = 0; | 239 | idx = 0; |
@@ -251,7 +251,7 @@ static ssize_t w1_f23_write_bin(struct file *filp, struct kobject *kobj, | |||
251 | } | 251 | } |
252 | 252 | ||
253 | out_up: | 253 | out_up: |
254 | mutex_unlock(&sl->master->mutex); | 254 | mutex_unlock(&sl->master->bus_mutex); |
255 | 255 | ||
256 | return count; | 256 | return count; |
257 | } | 257 | } |
diff --git a/drivers/w1/slaves/w1_ds2760.c b/drivers/w1/slaves/w1_ds2760.c index 5754c9a4f58b..aa7bd5fa2fa8 100644 --- a/drivers/w1/slaves/w1_ds2760.c +++ b/drivers/w1/slaves/w1_ds2760.c | |||
@@ -31,7 +31,7 @@ static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count, | |||
31 | if (!dev) | 31 | if (!dev) |
32 | return 0; | 32 | return 0; |
33 | 33 | ||
34 | mutex_lock(&sl->master->mutex); | 34 | mutex_lock(&sl->master->bus_mutex); |
35 | 35 | ||
36 | if (addr > DS2760_DATA_SIZE || addr < 0) { | 36 | if (addr > DS2760_DATA_SIZE || addr < 0) { |
37 | count = 0; | 37 | count = 0; |
@@ -54,7 +54,7 @@ static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count, | |||
54 | } | 54 | } |
55 | 55 | ||
56 | out: | 56 | out: |
57 | mutex_unlock(&sl->master->mutex); | 57 | mutex_unlock(&sl->master->bus_mutex); |
58 | 58 | ||
59 | return count; | 59 | return count; |
60 | } | 60 | } |
@@ -76,14 +76,14 @@ static int w1_ds2760_eeprom_cmd(struct device *dev, int addr, int cmd) | |||
76 | if (!dev) | 76 | if (!dev) |
77 | return -EINVAL; | 77 | return -EINVAL; |
78 | 78 | ||
79 | mutex_lock(&sl->master->mutex); | 79 | mutex_lock(&sl->master->bus_mutex); |
80 | 80 | ||
81 | if (w1_reset_select_slave(sl) == 0) { | 81 | if (w1_reset_select_slave(sl) == 0) { |
82 | w1_write_8(sl->master, cmd); | 82 | w1_write_8(sl->master, cmd); |
83 | w1_write_8(sl->master, addr); | 83 | w1_write_8(sl->master, addr); |
84 | } | 84 | } |
85 | 85 | ||
86 | mutex_unlock(&sl->master->mutex); | 86 | mutex_unlock(&sl->master->bus_mutex); |
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c index 39f78c0b143c..7b09307de0ef 100644 --- a/drivers/w1/slaves/w1_ds2780.c +++ b/drivers/w1/slaves/w1_ds2780.c | |||
@@ -60,30 +60,16 @@ int w1_ds2780_io(struct device *dev, char *buf, int addr, size_t count, | |||
60 | if (!dev) | 60 | if (!dev) |
61 | return -ENODEV; | 61 | return -ENODEV; |
62 | 62 | ||
63 | mutex_lock(&sl->master->mutex); | 63 | mutex_lock(&sl->master->bus_mutex); |
64 | 64 | ||
65 | ret = w1_ds2780_do_io(dev, buf, addr, count, io); | 65 | ret = w1_ds2780_do_io(dev, buf, addr, count, io); |
66 | 66 | ||
67 | mutex_unlock(&sl->master->mutex); | 67 | mutex_unlock(&sl->master->bus_mutex); |
68 | 68 | ||
69 | return ret; | 69 | return ret; |
70 | } | 70 | } |
71 | EXPORT_SYMBOL(w1_ds2780_io); | 71 | EXPORT_SYMBOL(w1_ds2780_io); |
72 | 72 | ||
73 | int w1_ds2780_io_nolock(struct device *dev, char *buf, int addr, size_t count, | ||
74 | int io) | ||
75 | { | ||
76 | int ret; | ||
77 | |||
78 | if (!dev) | ||
79 | return -ENODEV; | ||
80 | |||
81 | ret = w1_ds2780_do_io(dev, buf, addr, count, io); | ||
82 | |||
83 | return ret; | ||
84 | } | ||
85 | EXPORT_SYMBOL(w1_ds2780_io_nolock); | ||
86 | |||
87 | int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd) | 73 | int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd) |
88 | { | 74 | { |
89 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); | 75 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); |
@@ -91,14 +77,14 @@ int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd) | |||
91 | if (!dev) | 77 | if (!dev) |
92 | return -EINVAL; | 78 | return -EINVAL; |
93 | 79 | ||
94 | mutex_lock(&sl->master->mutex); | 80 | mutex_lock(&sl->master->bus_mutex); |
95 | 81 | ||
96 | if (w1_reset_select_slave(sl) == 0) { | 82 | if (w1_reset_select_slave(sl) == 0) { |
97 | w1_write_8(sl->master, cmd); | 83 | w1_write_8(sl->master, cmd); |
98 | w1_write_8(sl->master, addr); | 84 | w1_write_8(sl->master, addr); |
99 | } | 85 | } |
100 | 86 | ||
101 | mutex_unlock(&sl->master->mutex); | 87 | mutex_unlock(&sl->master->bus_mutex); |
102 | return 0; | 88 | return 0; |
103 | } | 89 | } |
104 | EXPORT_SYMBOL(w1_ds2780_eeprom_cmd); | 90 | EXPORT_SYMBOL(w1_ds2780_eeprom_cmd); |
diff --git a/drivers/w1/slaves/w1_ds2780.h b/drivers/w1/slaves/w1_ds2780.h index 737379365021..a1fba79eb1b5 100644 --- a/drivers/w1/slaves/w1_ds2780.h +++ b/drivers/w1/slaves/w1_ds2780.h | |||
@@ -124,8 +124,6 @@ | |||
124 | 124 | ||
125 | extern int w1_ds2780_io(struct device *dev, char *buf, int addr, size_t count, | 125 | extern int w1_ds2780_io(struct device *dev, char *buf, int addr, size_t count, |
126 | int io); | 126 | int io); |
127 | extern int w1_ds2780_io_nolock(struct device *dev, char *buf, int addr, | ||
128 | size_t count, int io); | ||
129 | extern int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd); | 127 | extern int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd); |
130 | 128 | ||
131 | #endif /* !_W1_DS2780_H */ | 129 | #endif /* !_W1_DS2780_H */ |
diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c index 0d0c7985293f..877daf74159c 100644 --- a/drivers/w1/slaves/w1_ds2781.c +++ b/drivers/w1/slaves/w1_ds2781.c | |||
@@ -58,30 +58,16 @@ int w1_ds2781_io(struct device *dev, char *buf, int addr, size_t count, | |||
58 | if (!dev) | 58 | if (!dev) |
59 | return -ENODEV; | 59 | return -ENODEV; |
60 | 60 | ||
61 | mutex_lock(&sl->master->mutex); | 61 | mutex_lock(&sl->master->bus_mutex); |
62 | 62 | ||
63 | ret = w1_ds2781_do_io(dev, buf, addr, count, io); | 63 | ret = w1_ds2781_do_io(dev, buf, addr, count, io); |
64 | 64 | ||
65 | mutex_unlock(&sl->master->mutex); | 65 | mutex_unlock(&sl->master->bus_mutex); |
66 | 66 | ||
67 | return ret; | 67 | return ret; |
68 | } | 68 | } |
69 | EXPORT_SYMBOL(w1_ds2781_io); | 69 | EXPORT_SYMBOL(w1_ds2781_io); |
70 | 70 | ||
71 | int w1_ds2781_io_nolock(struct device *dev, char *buf, int addr, size_t count, | ||
72 | int io) | ||
73 | { | ||
74 | int ret; | ||
75 | |||
76 | if (!dev) | ||
77 | return -ENODEV; | ||
78 | |||
79 | ret = w1_ds2781_do_io(dev, buf, addr, count, io); | ||
80 | |||
81 | return ret; | ||
82 | } | ||
83 | EXPORT_SYMBOL(w1_ds2781_io_nolock); | ||
84 | |||
85 | int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd) | 71 | int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd) |
86 | { | 72 | { |
87 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); | 73 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); |
@@ -89,14 +75,14 @@ int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd) | |||
89 | if (!dev) | 75 | if (!dev) |
90 | return -EINVAL; | 76 | return -EINVAL; |
91 | 77 | ||
92 | mutex_lock(&sl->master->mutex); | 78 | mutex_lock(&sl->master->bus_mutex); |
93 | 79 | ||
94 | if (w1_reset_select_slave(sl) == 0) { | 80 | if (w1_reset_select_slave(sl) == 0) { |
95 | w1_write_8(sl->master, cmd); | 81 | w1_write_8(sl->master, cmd); |
96 | w1_write_8(sl->master, addr); | 82 | w1_write_8(sl->master, addr); |
97 | } | 83 | } |
98 | 84 | ||
99 | mutex_unlock(&sl->master->mutex); | 85 | mutex_unlock(&sl->master->bus_mutex); |
100 | return 0; | 86 | return 0; |
101 | } | 87 | } |
102 | EXPORT_SYMBOL(w1_ds2781_eeprom_cmd); | 88 | EXPORT_SYMBOL(w1_ds2781_eeprom_cmd); |
diff --git a/drivers/w1/slaves/w1_ds2781.h b/drivers/w1/slaves/w1_ds2781.h index 82bc66497b43..557dfb0b4f64 100644 --- a/drivers/w1/slaves/w1_ds2781.h +++ b/drivers/w1/slaves/w1_ds2781.h | |||
@@ -129,8 +129,6 @@ | |||
129 | 129 | ||
130 | extern int w1_ds2781_io(struct device *dev, char *buf, int addr, size_t count, | 130 | extern int w1_ds2781_io(struct device *dev, char *buf, int addr, size_t count, |
131 | int io); | 131 | int io); |
132 | extern int w1_ds2781_io_nolock(struct device *dev, char *buf, int addr, | ||
133 | size_t count, int io); | ||
134 | extern int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd); | 132 | extern int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd); |
135 | 133 | ||
136 | #endif /* !_W1_DS2781_H */ | 134 | #endif /* !_W1_DS2781_H */ |
diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c new file mode 100644 index 000000000000..98117db595bb --- /dev/null +++ b/drivers/w1/slaves/w1_ds28e04.c | |||
@@ -0,0 +1,469 @@ | |||
1 | /* | ||
2 | * w1_ds28e04.c - w1 family 1C (DS28E04) driver | ||
3 | * | ||
4 | * Copyright (c) 2012 Markus Franke <franke.m@sebakmt.com> | ||
5 | * | ||
6 | * This source code is licensed under the GNU General Public License, | ||
7 | * Version 2. See the file COPYING for more details. | ||
8 | */ | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/moduleparam.h> | ||
13 | #include <linux/device.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/crc16.h> | ||
18 | #include <linux/uaccess.h> | ||
19 | |||
20 | #define CRC16_INIT 0 | ||
21 | #define CRC16_VALID 0xb001 | ||
22 | |||
23 | #include "../w1.h" | ||
24 | #include "../w1_int.h" | ||
25 | #include "../w1_family.h" | ||
26 | |||
27 | MODULE_LICENSE("GPL"); | ||
28 | MODULE_AUTHOR("Markus Franke <franke.m@sebakmt.com>, <franm@hrz.tu-chemnitz.de>"); | ||
29 | MODULE_DESCRIPTION("w1 family 1C driver for DS28E04, 4kb EEPROM and PIO"); | ||
30 | |||
31 | /* Allow the strong pullup to be disabled, but default to enabled. | ||
32 | * If it was disabled a parasite powered device might not get the required | ||
33 | * current to copy the data from the scratchpad to EEPROM. If it is enabled | ||
34 | * parasite powered devices have a better chance of getting the current | ||
35 | * required. | ||
36 | */ | ||
37 | static int w1_strong_pullup = 1; | ||
38 | module_param_named(strong_pullup, w1_strong_pullup, int, 0); | ||
39 | |||
40 | /* enable/disable CRC checking on DS28E04-100 memory accesses */ | ||
41 | static char w1_enable_crccheck = 1; | ||
42 | |||
43 | #define W1_EEPROM_SIZE 512 | ||
44 | #define W1_PAGE_COUNT 16 | ||
45 | #define W1_PAGE_SIZE 32 | ||
46 | #define W1_PAGE_BITS 5 | ||
47 | #define W1_PAGE_MASK 0x1F | ||
48 | |||
49 | #define W1_F1C_READ_EEPROM 0xF0 | ||
50 | #define W1_F1C_WRITE_SCRATCH 0x0F | ||
51 | #define W1_F1C_READ_SCRATCH 0xAA | ||
52 | #define W1_F1C_COPY_SCRATCH 0x55 | ||
53 | #define W1_F1C_ACCESS_WRITE 0x5A | ||
54 | |||
55 | #define W1_1C_REG_LOGIC_STATE 0x220 | ||
56 | |||
57 | struct w1_f1C_data { | ||
58 | u8 memory[W1_EEPROM_SIZE]; | ||
59 | u32 validcrc; | ||
60 | }; | ||
61 | |||
62 | /** | ||
63 | * Check the file size bounds and adjusts count as needed. | ||
64 | * This would not be needed if the file size didn't reset to 0 after a write. | ||
65 | */ | ||
66 | static inline size_t w1_f1C_fix_count(loff_t off, size_t count, size_t size) | ||
67 | { | ||
68 | if (off > size) | ||
69 | return 0; | ||
70 | |||
71 | if ((off + count) > size) | ||
72 | return size - off; | ||
73 | |||
74 | return count; | ||
75 | } | ||
76 | |||
77 | static int w1_f1C_refresh_block(struct w1_slave *sl, struct w1_f1C_data *data, | ||
78 | int block) | ||
79 | { | ||
80 | u8 wrbuf[3]; | ||
81 | int off = block * W1_PAGE_SIZE; | ||
82 | |||
83 | if (data->validcrc & (1 << block)) | ||
84 | return 0; | ||
85 | |||
86 | if (w1_reset_select_slave(sl)) { | ||
87 | data->validcrc = 0; | ||
88 | return -EIO; | ||
89 | } | ||
90 | |||
91 | wrbuf[0] = W1_F1C_READ_EEPROM; | ||
92 | wrbuf[1] = off & 0xff; | ||
93 | wrbuf[2] = off >> 8; | ||
94 | w1_write_block(sl->master, wrbuf, 3); | ||
95 | w1_read_block(sl->master, &data->memory[off], W1_PAGE_SIZE); | ||
96 | |||
97 | /* cache the block if the CRC is valid */ | ||
98 | if (crc16(CRC16_INIT, &data->memory[off], W1_PAGE_SIZE) == CRC16_VALID) | ||
99 | data->validcrc |= (1 << block); | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static int w1_f1C_read(struct w1_slave *sl, int addr, int len, char *data) | ||
105 | { | ||
106 | u8 wrbuf[3]; | ||
107 | |||
108 | /* read directly from the EEPROM */ | ||
109 | if (w1_reset_select_slave(sl)) | ||
110 | return -EIO; | ||
111 | |||
112 | wrbuf[0] = W1_F1C_READ_EEPROM; | ||
113 | wrbuf[1] = addr & 0xff; | ||
114 | wrbuf[2] = addr >> 8; | ||
115 | |||
116 | w1_write_block(sl->master, wrbuf, sizeof(wrbuf)); | ||
117 | return w1_read_block(sl->master, data, len); | ||
118 | } | ||
119 | |||
120 | static ssize_t w1_f1C_read_bin(struct file *filp, struct kobject *kobj, | ||
121 | struct bin_attribute *bin_attr, | ||
122 | char *buf, loff_t off, size_t count) | ||
123 | { | ||
124 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | ||
125 | struct w1_f1C_data *data = sl->family_data; | ||
126 | int i, min_page, max_page; | ||
127 | |||
128 | count = w1_f1C_fix_count(off, count, W1_EEPROM_SIZE); | ||
129 | if (count == 0) | ||
130 | return 0; | ||
131 | |||
132 | mutex_lock(&sl->master->mutex); | ||
133 | |||
134 | if (w1_enable_crccheck) { | ||
135 | min_page = (off >> W1_PAGE_BITS); | ||
136 | max_page = (off + count - 1) >> W1_PAGE_BITS; | ||
137 | for (i = min_page; i <= max_page; i++) { | ||
138 | if (w1_f1C_refresh_block(sl, data, i)) { | ||
139 | count = -EIO; | ||
140 | goto out_up; | ||
141 | } | ||
142 | } | ||
143 | memcpy(buf, &data->memory[off], count); | ||
144 | } else { | ||
145 | count = w1_f1C_read(sl, off, count, buf); | ||
146 | } | ||
147 | |||
148 | out_up: | ||
149 | mutex_unlock(&sl->master->mutex); | ||
150 | |||
151 | return count; | ||
152 | } | ||
153 | |||
154 | /** | ||
155 | * Writes to the scratchpad and reads it back for verification. | ||
156 | * Then copies the scratchpad to EEPROM. | ||
157 | * The data must be on one page. | ||
158 | * The master must be locked. | ||
159 | * | ||
160 | * @param sl The slave structure | ||
161 | * @param addr Address for the write | ||
162 | * @param len length must be <= (W1_PAGE_SIZE - (addr & W1_PAGE_MASK)) | ||
163 | * @param data The data to write | ||
164 | * @return 0=Success -1=failure | ||
165 | */ | ||
166 | static int w1_f1C_write(struct w1_slave *sl, int addr, int len, const u8 *data) | ||
167 | { | ||
168 | u8 wrbuf[4]; | ||
169 | u8 rdbuf[W1_PAGE_SIZE + 3]; | ||
170 | u8 es = (addr + len - 1) & 0x1f; | ||
171 | unsigned int tm = 10; | ||
172 | int i; | ||
173 | struct w1_f1C_data *f1C = sl->family_data; | ||
174 | |||
175 | /* Write the data to the scratchpad */ | ||
176 | if (w1_reset_select_slave(sl)) | ||
177 | return -1; | ||
178 | |||
179 | wrbuf[0] = W1_F1C_WRITE_SCRATCH; | ||
180 | wrbuf[1] = addr & 0xff; | ||
181 | wrbuf[2] = addr >> 8; | ||
182 | |||
183 | w1_write_block(sl->master, wrbuf, 3); | ||
184 | w1_write_block(sl->master, data, len); | ||
185 | |||
186 | /* Read the scratchpad and verify */ | ||
187 | if (w1_reset_select_slave(sl)) | ||
188 | return -1; | ||
189 | |||
190 | w1_write_8(sl->master, W1_F1C_READ_SCRATCH); | ||
191 | w1_read_block(sl->master, rdbuf, len + 3); | ||
192 | |||
193 | /* Compare what was read against the data written */ | ||
194 | if ((rdbuf[0] != wrbuf[1]) || (rdbuf[1] != wrbuf[2]) || | ||
195 | (rdbuf[2] != es) || (memcmp(data, &rdbuf[3], len) != 0)) | ||
196 | return -1; | ||
197 | |||
198 | /* Copy the scratchpad to EEPROM */ | ||
199 | if (w1_reset_select_slave(sl)) | ||
200 | return -1; | ||
201 | |||
202 | wrbuf[0] = W1_F1C_COPY_SCRATCH; | ||
203 | wrbuf[3] = es; | ||
204 | |||
205 | for (i = 0; i < sizeof(wrbuf); ++i) { | ||
206 | /* issue 10ms strong pullup (or delay) on the last byte | ||
207 | for writing the data from the scratchpad to EEPROM */ | ||
208 | if (w1_strong_pullup && i == sizeof(wrbuf)-1) | ||
209 | w1_next_pullup(sl->master, tm); | ||
210 | |||
211 | w1_write_8(sl->master, wrbuf[i]); | ||
212 | } | ||
213 | |||
214 | if (!w1_strong_pullup) | ||
215 | msleep(tm); | ||
216 | |||
217 | if (w1_enable_crccheck) { | ||
218 | /* invalidate cached data */ | ||
219 | f1C->validcrc &= ~(1 << (addr >> W1_PAGE_BITS)); | ||
220 | } | ||
221 | |||
222 | /* Reset the bus to wake up the EEPROM (this may not be needed) */ | ||
223 | w1_reset_bus(sl->master); | ||
224 | |||
225 | return 0; | ||
226 | } | ||
227 | |||
228 | static ssize_t w1_f1C_write_bin(struct file *filp, struct kobject *kobj, | ||
229 | struct bin_attribute *bin_attr, | ||
230 | char *buf, loff_t off, size_t count) | ||
231 | |||
232 | { | ||
233 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | ||
234 | int addr, len, idx; | ||
235 | |||
236 | count = w1_f1C_fix_count(off, count, W1_EEPROM_SIZE); | ||
237 | if (count == 0) | ||
238 | return 0; | ||
239 | |||
240 | if (w1_enable_crccheck) { | ||
241 | /* can only write full blocks in cached mode */ | ||
242 | if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) { | ||
243 | dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n", | ||
244 | (int)off, count); | ||
245 | return -EINVAL; | ||
246 | } | ||
247 | |||
248 | /* make sure the block CRCs are valid */ | ||
249 | for (idx = 0; idx < count; idx += W1_PAGE_SIZE) { | ||
250 | if (crc16(CRC16_INIT, &buf[idx], W1_PAGE_SIZE) | ||
251 | != CRC16_VALID) { | ||
252 | dev_err(&sl->dev, "bad CRC at offset %d\n", | ||
253 | (int)off); | ||
254 | return -EINVAL; | ||
255 | } | ||
256 | } | ||
257 | } | ||
258 | |||
259 | mutex_lock(&sl->master->mutex); | ||
260 | |||
261 | /* Can only write data to one page at a time */ | ||
262 | idx = 0; | ||
263 | while (idx < count) { | ||
264 | addr = off + idx; | ||
265 | len = W1_PAGE_SIZE - (addr & W1_PAGE_MASK); | ||
266 | if (len > (count - idx)) | ||
267 | len = count - idx; | ||
268 | |||
269 | if (w1_f1C_write(sl, addr, len, &buf[idx]) < 0) { | ||
270 | count = -EIO; | ||
271 | goto out_up; | ||
272 | } | ||
273 | idx += len; | ||
274 | } | ||
275 | |||
276 | out_up: | ||
277 | mutex_unlock(&sl->master->mutex); | ||
278 | |||
279 | return count; | ||
280 | } | ||
281 | |||
282 | static ssize_t w1_f1C_read_pio(struct file *filp, struct kobject *kobj, | ||
283 | struct bin_attribute *bin_attr, | ||
284 | char *buf, loff_t off, size_t count) | ||
285 | |||
286 | { | ||
287 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | ||
288 | int ret; | ||
289 | |||
290 | /* check arguments */ | ||
291 | if (off != 0 || count != 1 || buf == NULL) | ||
292 | return -EINVAL; | ||
293 | |||
294 | mutex_lock(&sl->master->mutex); | ||
295 | ret = w1_f1C_read(sl, W1_1C_REG_LOGIC_STATE, count, buf); | ||
296 | mutex_unlock(&sl->master->mutex); | ||
297 | |||
298 | return ret; | ||
299 | } | ||
300 | |||
301 | static ssize_t w1_f1C_write_pio(struct file *filp, struct kobject *kobj, | ||
302 | struct bin_attribute *bin_attr, | ||
303 | char *buf, loff_t off, size_t count) | ||
304 | |||
305 | { | ||
306 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | ||
307 | u8 wrbuf[3]; | ||
308 | u8 ack; | ||
309 | |||
310 | /* check arguments */ | ||
311 | if (off != 0 || count != 1 || buf == NULL) | ||
312 | return -EINVAL; | ||
313 | |||
314 | mutex_lock(&sl->master->mutex); | ||
315 | |||
316 | /* Write the PIO data */ | ||
317 | if (w1_reset_select_slave(sl)) { | ||
318 | mutex_unlock(&sl->master->mutex); | ||
319 | return -1; | ||
320 | } | ||
321 | |||
322 | /* set bit 7..2 to value '1' */ | ||
323 | *buf = *buf | 0xFC; | ||
324 | |||
325 | wrbuf[0] = W1_F1C_ACCESS_WRITE; | ||
326 | wrbuf[1] = *buf; | ||
327 | wrbuf[2] = ~(*buf); | ||
328 | w1_write_block(sl->master, wrbuf, 3); | ||
329 | |||
330 | w1_read_block(sl->master, &ack, sizeof(ack)); | ||
331 | |||
332 | mutex_unlock(&sl->master->mutex); | ||
333 | |||
334 | /* check for acknowledgement */ | ||
335 | if (ack != 0xAA) | ||
336 | return -EIO; | ||
337 | |||
338 | return count; | ||
339 | } | ||
340 | |||
341 | static ssize_t w1_f1C_show_crccheck(struct device *dev, | ||
342 | struct device_attribute *attr, char *buf) | ||
343 | { | ||
344 | if (put_user(w1_enable_crccheck + 0x30, buf)) | ||
345 | return -EFAULT; | ||
346 | |||
347 | return sizeof(w1_enable_crccheck); | ||
348 | } | ||
349 | |||
350 | static ssize_t w1_f1C_store_crccheck(struct device *dev, | ||
351 | struct device_attribute *attr, | ||
352 | const char *buf, size_t count) | ||
353 | { | ||
354 | char val; | ||
355 | |||
356 | if (count != 1 || !buf) | ||
357 | return -EINVAL; | ||
358 | |||
359 | if (get_user(val, buf)) | ||
360 | return -EFAULT; | ||
361 | |||
362 | /* convert to decimal */ | ||
363 | val = val - 0x30; | ||
364 | if (val != 0 && val != 1) | ||
365 | return -EINVAL; | ||
366 | |||
367 | /* set the new value */ | ||
368 | w1_enable_crccheck = val; | ||
369 | |||
370 | return sizeof(w1_enable_crccheck); | ||
371 | } | ||
372 | |||
373 | #define NB_SYSFS_BIN_FILES 2 | ||
374 | static struct bin_attribute w1_f1C_bin_attr[NB_SYSFS_BIN_FILES] = { | ||
375 | { | ||
376 | .attr = { | ||
377 | .name = "eeprom", | ||
378 | .mode = S_IRUGO | S_IWUSR, | ||
379 | }, | ||
380 | .size = W1_EEPROM_SIZE, | ||
381 | .read = w1_f1C_read_bin, | ||
382 | .write = w1_f1C_write_bin, | ||
383 | }, | ||
384 | { | ||
385 | .attr = { | ||
386 | .name = "pio", | ||
387 | .mode = S_IRUGO | S_IWUSR, | ||
388 | }, | ||
389 | .size = 1, | ||
390 | .read = w1_f1C_read_pio, | ||
391 | .write = w1_f1C_write_pio, | ||
392 | } | ||
393 | }; | ||
394 | |||
395 | static DEVICE_ATTR(crccheck, S_IWUSR | S_IRUGO, | ||
396 | w1_f1C_show_crccheck, w1_f1C_store_crccheck); | ||
397 | |||
398 | static int w1_f1C_add_slave(struct w1_slave *sl) | ||
399 | { | ||
400 | int err = 0; | ||
401 | int i; | ||
402 | struct w1_f1C_data *data = NULL; | ||
403 | |||
404 | if (w1_enable_crccheck) { | ||
405 | data = kzalloc(sizeof(struct w1_f1C_data), GFP_KERNEL); | ||
406 | if (!data) | ||
407 | return -ENOMEM; | ||
408 | sl->family_data = data; | ||
409 | } | ||
410 | |||
411 | /* create binary sysfs attributes */ | ||
412 | for (i = 0; i < NB_SYSFS_BIN_FILES && !err; ++i) | ||
413 | err = sysfs_create_bin_file( | ||
414 | &sl->dev.kobj, &(w1_f1C_bin_attr[i])); | ||
415 | |||
416 | if (!err) { | ||
417 | /* create device attributes */ | ||
418 | err = device_create_file(&sl->dev, &dev_attr_crccheck); | ||
419 | } | ||
420 | |||
421 | if (err) { | ||
422 | /* remove binary sysfs attributes */ | ||
423 | for (i = 0; i < NB_SYSFS_BIN_FILES; ++i) | ||
424 | sysfs_remove_bin_file( | ||
425 | &sl->dev.kobj, &(w1_f1C_bin_attr[i])); | ||
426 | |||
427 | kfree(data); | ||
428 | } | ||
429 | |||
430 | return err; | ||
431 | } | ||
432 | |||
433 | static void w1_f1C_remove_slave(struct w1_slave *sl) | ||
434 | { | ||
435 | int i; | ||
436 | |||
437 | kfree(sl->family_data); | ||
438 | sl->family_data = NULL; | ||
439 | |||
440 | /* remove device attributes */ | ||
441 | device_remove_file(&sl->dev, &dev_attr_crccheck); | ||
442 | |||
443 | /* remove binary sysfs attributes */ | ||
444 | for (i = 0; i < NB_SYSFS_BIN_FILES; ++i) | ||
445 | sysfs_remove_bin_file(&sl->dev.kobj, &(w1_f1C_bin_attr[i])); | ||
446 | } | ||
447 | |||
448 | static struct w1_family_ops w1_f1C_fops = { | ||
449 | .add_slave = w1_f1C_add_slave, | ||
450 | .remove_slave = w1_f1C_remove_slave, | ||
451 | }; | ||
452 | |||
453 | static struct w1_family w1_family_1C = { | ||
454 | .fid = W1_FAMILY_DS28E04, | ||
455 | .fops = &w1_f1C_fops, | ||
456 | }; | ||
457 | |||
458 | static int __init w1_f1C_init(void) | ||
459 | { | ||
460 | return w1_register_family(&w1_family_1C); | ||
461 | } | ||
462 | |||
463 | static void __exit w1_f1C_fini(void) | ||
464 | { | ||
465 | w1_unregister_family(&w1_family_1C); | ||
466 | } | ||
467 | |||
468 | module_init(w1_f1C_init); | ||
469 | module_exit(w1_f1C_fini); | ||
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index ff29ae747ee8..d90062b211f8 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c | |||
@@ -179,7 +179,7 @@ static ssize_t w1_therm_read(struct device *device, | |||
179 | int i, max_trying = 10; | 179 | int i, max_trying = 10; |
180 | ssize_t c = PAGE_SIZE; | 180 | ssize_t c = PAGE_SIZE; |
181 | 181 | ||
182 | i = mutex_lock_interruptible(&dev->mutex); | 182 | i = mutex_lock_interruptible(&dev->bus_mutex); |
183 | if (i != 0) | 183 | if (i != 0) |
184 | return i; | 184 | return i; |
185 | 185 | ||
@@ -207,19 +207,19 @@ static ssize_t w1_therm_read(struct device *device, | |||
207 | w1_write_8(dev, W1_CONVERT_TEMP); | 207 | w1_write_8(dev, W1_CONVERT_TEMP); |
208 | 208 | ||
209 | if (external_power) { | 209 | if (external_power) { |
210 | mutex_unlock(&dev->mutex); | 210 | mutex_unlock(&dev->bus_mutex); |
211 | 211 | ||
212 | sleep_rem = msleep_interruptible(tm); | 212 | sleep_rem = msleep_interruptible(tm); |
213 | if (sleep_rem != 0) | 213 | if (sleep_rem != 0) |
214 | return -EINTR; | 214 | return -EINTR; |
215 | 215 | ||
216 | i = mutex_lock_interruptible(&dev->mutex); | 216 | i = mutex_lock_interruptible(&dev->bus_mutex); |
217 | if (i != 0) | 217 | if (i != 0) |
218 | return i; | 218 | return i; |
219 | } else if (!w1_strong_pullup) { | 219 | } else if (!w1_strong_pullup) { |
220 | sleep_rem = msleep_interruptible(tm); | 220 | sleep_rem = msleep_interruptible(tm); |
221 | if (sleep_rem != 0) { | 221 | if (sleep_rem != 0) { |
222 | mutex_unlock(&dev->mutex); | 222 | mutex_unlock(&dev->bus_mutex); |
223 | return -EINTR; | 223 | return -EINTR; |
224 | } | 224 | } |
225 | } | 225 | } |
@@ -258,7 +258,7 @@ static ssize_t w1_therm_read(struct device *device, | |||
258 | 258 | ||
259 | c -= snprintf(buf + PAGE_SIZE - c, c, "t=%d\n", | 259 | c -= snprintf(buf + PAGE_SIZE - c, c, "t=%d\n", |
260 | w1_convert_temp(rom, sl->family->fid)); | 260 | w1_convert_temp(rom, sl->family->fid)); |
261 | mutex_unlock(&dev->mutex); | 261 | mutex_unlock(&dev->bus_mutex); |
262 | 262 | ||
263 | return PAGE_SIZE - c; | 263 | return PAGE_SIZE - c; |
264 | } | 264 | } |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 2f2e894ea0c8..1a574370d2cd 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -557,7 +557,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
557 | struct w1_master *md = NULL; | 557 | struct w1_master *md = NULL; |
558 | struct w1_slave *sl = NULL; | 558 | struct w1_slave *sl = NULL; |
559 | char *event_owner, *name; | 559 | char *event_owner, *name; |
560 | int err; | 560 | int err = 0; |
561 | 561 | ||
562 | if (dev->driver == &w1_master_driver) { | 562 | if (dev->driver == &w1_master_driver) { |
563 | md = container_of(dev, struct w1_master, dev); | 563 | md = container_of(dev, struct w1_master, dev); |
@@ -576,19 +576,17 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
576 | event_owner, name, dev_name(dev)); | 576 | event_owner, name, dev_name(dev)); |
577 | 577 | ||
578 | if (dev->driver != &w1_slave_driver || !sl) | 578 | if (dev->driver != &w1_slave_driver || !sl) |
579 | return 0; | 579 | goto end; |
580 | 580 | ||
581 | err = add_uevent_var(env, "W1_FID=%02X", sl->reg_num.family); | 581 | err = add_uevent_var(env, "W1_FID=%02X", sl->reg_num.family); |
582 | if (err) | 582 | if (err) |
583 | return err; | 583 | goto end; |
584 | 584 | ||
585 | err = add_uevent_var(env, "W1_SLAVE_ID=%024LX", | 585 | err = add_uevent_var(env, "W1_SLAVE_ID=%024LX", |
586 | (unsigned long long)sl->reg_num.id); | 586 | (unsigned long long)sl->reg_num.id); |
587 | if (err) | 587 | end: |
588 | return err; | 588 | return err; |
589 | 589 | } | |
590 | return 0; | ||
591 | }; | ||
592 | #else | 590 | #else |
593 | static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) | 591 | static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) |
594 | { | 592 | { |
@@ -887,16 +885,21 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb | |||
887 | * | 885 | * |
888 | * Return 0 - device(s) present, 1 - no devices present. | 886 | * Return 0 - device(s) present, 1 - no devices present. |
889 | */ | 887 | */ |
888 | mutex_lock(&dev->bus_mutex); | ||
890 | if (w1_reset_bus(dev)) { | 889 | if (w1_reset_bus(dev)) { |
890 | mutex_unlock(&dev->bus_mutex); | ||
891 | dev_dbg(&dev->dev, "No devices present on the wire.\n"); | 891 | dev_dbg(&dev->dev, "No devices present on the wire.\n"); |
892 | break; | 892 | break; |
893 | } | 893 | } |
894 | 894 | ||
895 | /* Do fast search on single slave bus */ | 895 | /* Do fast search on single slave bus */ |
896 | if (dev->max_slave_count == 1) { | 896 | if (dev->max_slave_count == 1) { |
897 | int rv; | ||
897 | w1_write_8(dev, W1_READ_ROM); | 898 | w1_write_8(dev, W1_READ_ROM); |
899 | rv = w1_read_block(dev, (u8 *)&rn, 8); | ||
900 | mutex_unlock(&dev->bus_mutex); | ||
898 | 901 | ||
899 | if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn) | 902 | if (rv == 8 && rn) |
900 | cb(dev, rn); | 903 | cb(dev, rn); |
901 | 904 | ||
902 | break; | 905 | break; |
@@ -929,10 +932,12 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb | |||
929 | rn |= (tmp64 << i); | 932 | rn |= (tmp64 << i); |
930 | 933 | ||
931 | if (kthread_should_stop()) { | 934 | if (kthread_should_stop()) { |
935 | mutex_unlock(&dev->bus_mutex); | ||
932 | dev_dbg(&dev->dev, "Abort w1_search\n"); | 936 | dev_dbg(&dev->dev, "Abort w1_search\n"); |
933 | return; | 937 | return; |
934 | } | 938 | } |
935 | } | 939 | } |
940 | mutex_unlock(&dev->bus_mutex); | ||
936 | 941 | ||
937 | if ( (triplet_ret & 0x03) != 0x03 ) { | 942 | if ( (triplet_ret & 0x03) != 0x03 ) { |
938 | if ( (desc_bit == last_zero) || (last_zero < 0)) | 943 | if ( (desc_bit == last_zero) || (last_zero < 0)) |
diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h index 4d012ca3f32c..45908e56c2f8 100644 --- a/drivers/w1/w1.h +++ b/drivers/w1/w1.h | |||
@@ -180,6 +180,7 @@ struct w1_master | |||
180 | 180 | ||
181 | struct task_struct *thread; | 181 | struct task_struct *thread; |
182 | struct mutex mutex; | 182 | struct mutex mutex; |
183 | struct mutex bus_mutex; | ||
183 | 184 | ||
184 | struct device_driver *driver; | 185 | struct device_driver *driver; |
185 | struct device dev; | 186 | struct device dev; |
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h index 874aeb05011b..b00ada44a89b 100644 --- a/drivers/w1/w1_family.h +++ b/drivers/w1/w1_family.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define W1_FAMILY_SMEM_01 0x01 | 30 | #define W1_FAMILY_SMEM_01 0x01 |
31 | #define W1_FAMILY_SMEM_81 0x81 | 31 | #define W1_FAMILY_SMEM_81 0x81 |
32 | #define W1_THERM_DS18S20 0x10 | 32 | #define W1_THERM_DS18S20 0x10 |
33 | #define W1_FAMILY_DS28E04 0x1C | ||
33 | #define W1_COUNTER_DS2423 0x1D | 34 | #define W1_COUNTER_DS2423 0x1D |
34 | #define W1_THERM_DS1822 0x22 | 35 | #define W1_THERM_DS1822 0x22 |
35 | #define W1_EEPROM_DS2433 0x23 | 36 | #define W1_EEPROM_DS2433 0x23 |
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c index 68288355727a..5a98649f6abc 100644 --- a/drivers/w1/w1_int.c +++ b/drivers/w1/w1_int.c | |||
@@ -76,6 +76,7 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, | |||
76 | 76 | ||
77 | INIT_LIST_HEAD(&dev->slist); | 77 | INIT_LIST_HEAD(&dev->slist); |
78 | mutex_init(&dev->mutex); | 78 | mutex_init(&dev->mutex); |
79 | mutex_init(&dev->bus_mutex); | ||
79 | 80 | ||
80 | memcpy(&dev->dev, device, sizeof(struct device)); | 81 | memcpy(&dev->dev, device, sizeof(struct device)); |
81 | dev_set_name(&dev->dev, "w1_bus_master%u", dev->id); | 82 | dev_set_name(&dev->dev, "w1_bus_master%u", dev->id); |
@@ -117,7 +118,7 @@ int w1_add_master_device(struct w1_bus_master *master) | |||
117 | return(-EINVAL); | 118 | return(-EINVAL); |
118 | } | 119 | } |
119 | /* While it would be electrically possible to make a device that | 120 | /* While it would be electrically possible to make a device that |
120 | * generated a strong pullup in bit bang mode, only hardare that | 121 | * generated a strong pullup in bit bang mode, only hardware that |
121 | * controls 1-wire time frames are even expected to support a strong | 122 | * controls 1-wire time frames are even expected to support a strong |
122 | * pullup. w1_io.c would need to support calling set_pullup before | 123 | * pullup. w1_io.c would need to support calling set_pullup before |
123 | * the last write_bit operation of a w1_write_8 which it currently | 124 | * the last write_bit operation of a w1_write_8 which it currently |