aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1/w1.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-26 14:25:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-26 14:25:33 -0400
commitfa93669a1917f93b09142d4b2298329b82d7d36d (patch)
tree7f8d6dc9d1fbb086c59a799a3a7137c46fb9959e /drivers/w1/w1.c
parentb13bc8dda81c54a66a1c84e66f60b8feba659f28 (diff)
parent6791457a090d9a234a40b501c2536f0aefaeae4b (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/w1.c')
-rw-r--r--drivers/w1/w1.c23
1 files changed, 14 insertions, 9 deletions
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) 587end:
588 return err; 588 return err;
589 589}
590 return 0;
591};
592#else 590#else
593static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) 591static 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))