Skip to content

Commit

Permalink
i2c: immediately mark ourselves as registered
Browse files Browse the repository at this point in the history
Mark the i2c bus as registered right after the the bus_register call,
not at the end of init. Otherwise, we can't register our own dummy
driver.

Reported-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Fixes: 9502665 ("i2c: do not use internal data from driver core")
  • Loading branch information
Wolfram Sang committed Mar 14, 2016
1 parent 34b57f4 commit b980a26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2105,6 +2105,9 @@ static int __init i2c_init(void)
retval = bus_register(&i2c_bus_type);
if (retval)
return retval;

is_registered = true;

#ifdef CONFIG_I2C_COMPAT
i2c_adapter_compat_class = class_compat_register("i2c-adapter");
if (!i2c_adapter_compat_class) {
Expand All @@ -2119,14 +2122,14 @@ static int __init i2c_init(void)
if (IS_ENABLED(CONFIG_OF_DYNAMIC))
WARN_ON(of_reconfig_notifier_register(&i2c_of_notifier));

is_registered = true;
return 0;

class_err:
#ifdef CONFIG_I2C_COMPAT
class_compat_unregister(i2c_adapter_compat_class);
bus_err:
#endif
is_registered = false;
bus_unregister(&i2c_bus_type);
return retval;
}
Expand Down

0 comments on commit b980a26

Please sign in to comment.