Skip to content

Commit

Permalink
i2c: core: call of_i2c_setup_smbus_alert in i2c_register_adapter
Browse files Browse the repository at this point in the history
Add a call to of_i2c_setup_smbus_alert when a i2c adapter is registered
so the the smbalert driver can be registered.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Phil Reid authored and Wolfram Sang committed Oct 28, 2017
1 parent 69d1724 commit f8756c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/i2c/i2c-core-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/errno.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/i2c-smbus.h>
#include <linux/idr.h>
#include <linux/init.h>
#include <linux/irqflags.h>
Expand Down Expand Up @@ -1259,6 +1260,10 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
goto out_list;
}

res = of_i2c_setup_smbus_alert(adap);
if (res)
goto out_reg;

dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);

pm_runtime_no_callbacks(&adap->dev);
Expand Down Expand Up @@ -1290,6 +1295,10 @@ static int i2c_register_adapter(struct i2c_adapter *adap)

return 0;

out_reg:
init_completion(&adap->dev_released);
device_unregister(&adap->dev);
wait_for_completion(&adap->dev_released);
out_list:
mutex_lock(&core_lock);
idr_remove(&i2c_adapter_idr, adap->nr);
Expand Down

0 comments on commit f8756c6

Please sign in to comment.