Commit 26680ee2 authored by Wolfram Sang's avatar Wolfram Sang

i2c: clarify comments about the dev_released completion

There was quite some confusion why this completion is there and if it is
still necessary. Sadly, it is. However, let's improve the comments and
share what we rediscovered.
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 3a33a854
...@@ -1666,11 +1666,15 @@ void i2c_del_adapter(struct i2c_adapter *adap) ...@@ -1666,11 +1666,15 @@ void i2c_del_adapter(struct i2c_adapter *adap)
/* device name is gone after device_unregister */ /* device name is gone after device_unregister */
dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
/* clean up the sysfs representation */ /* wait until all references to the device are gone
*
* FIXME: This is old code and should ideally be replaced by an
* alternative which results in decoupling the lifetime of the struct
* device from the i2c_adapter, like spi or netdev do. Any solution
* should be throughly tested with DEBUG_KOBJECT_RELEASE enabled!
*/
init_completion(&adap->dev_released); init_completion(&adap->dev_released);
device_unregister(&adap->dev); device_unregister(&adap->dev);
/* wait for sysfs to drop all references */
wait_for_completion(&adap->dev_released); wait_for_completion(&adap->dev_released);
/* free bus id */ /* free bus id */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment