summaryrefslogtreecommitdiff
path: root/drivers/i2c/i2c-core-base.c
diff options
context:
space:
mode:
authorPhil Reid <preid@electromag.com.au>2017-08-24 12:31:04 +0300
committerWolfram Sang <wsa@the-dreams.de>2017-10-29 00:42:58 +0300
commitf8756c67b3de71a46255aa478ab590ff28e60ac9 (patch)
treee4bcc1d725d2047685ddb7bba3326ad9f7b2fb3b /drivers/i2c/i2c-core-base.c
parent69d17246ab255dda8e71c8d65396b4aa6121b7ad (diff)
downloadlinux-f8756c67b3de71a46255aa478ab590ff28e60ac9.tar.xz
i2c: core: call of_i2c_setup_smbus_alert in i2c_register_adapter
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>
Diffstat (limited to 'drivers/i2c/i2c-core-base.c')
-rw-r--r--drivers/i2c/i2c-core-base.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 56e46581b84b..130d22bed563 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -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>
@@ -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);
@@ -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);