]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
i2c: clarify comments about the dev_released completion
authorWolfram Sang <wsa@the-dreams.de>
Thu, 29 Jan 2015 21:45:09 +0000 (22:45 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Thu, 5 Feb 2015 21:29:21 +0000 (22:29 +0100)
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: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-core.c

index 72d53e40ebab7cc3af26588a0901f8b38b50fe6e..4764a1fa0b56119cf6383bf83a528f62446d768b 100644 (file)
@@ -1666,11 +1666,15 @@ void i2c_del_adapter(struct i2c_adapter *adap)
        /* device name is gone after device_unregister */
        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);
        device_unregister(&adap->dev);
-
-       /* wait for sysfs to drop all references */
        wait_for_completion(&adap->dev_released);
 
        /* free bus id */