]> git.baikalelectronics.ru Git - kernel.git/commit
w1: avoid recursive device_add
authorDavid Fries <david@fries.net>
Wed, 16 Apr 2014 06:21:21 +0000 (01:21 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Apr 2014 21:07:51 +0000 (14:07 -0700)
commit4d345cb64a905944b479bb96c1fa06055e50426f
treeb70c5385376b8463fc4d1850574d7c7d8be9e4b1
parentf03472b70d0e45ea99a732c0223702e05d02132c
w1: avoid recursive device_add

__w1_attach_slave_device calls device_add which calls w1_bus_notify
which calls the w1_bq27000 slave driver, which calls
platform_device_add and device_add and deadlocks on getting
&(&priv->bus_notifier)->rwsem as it is still held in the previous
device_add.  This avoids the problem by processing the family
add/remove outside of the slave device_add call.

Commit a6c12f3b0116d60bf2f introduced this deadlock and added
a KOBJ_ADD, as the add was already reported in device_register two add
events were being sent.  This change suppresses the device_register
add so that any slave device sysfs entries are setup before the add
goes out.

Belisko Marek reported this change fixed the deadlock he was seeing on
ARM device tree, while testing on my x86-64 system never saw the
deadlock.

Reported-by: Belisko Marek <marek.belisko@gmail.com>
Signed-off-by: David Fries <David@Fries.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/w1/w1.c