diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2020-02-28 18:12:20 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2020-03-10 12:19:52 +0100 |
commit | ed680522268da2f6f2a67505dd144e718d726712 (patch) | |
tree | b1ece58be4d20c46e21e8d0cd7d5b7f3e0744ed8 /drivers/i2c/busses/i2c-xlp9xx.c | |
parent | i2c: stm32f7: add a new st, stm32mp15-i2c compatible (diff) | |
download | linux-ed680522268da2f6f2a67505dd144e718d726712.tar.xz linux-ed680522268da2f6f2a67505dd144e718d726712.zip |
i2c: convert SMBus alert setup function to return an ERRPTR
Only few drivers use this call, so drivers and I2C core are converted at
once with this patch. By simply using i2c_new_client_device() instead of
i2c_new_device(), we easily can return an ERRPTR for this function as
well. To make out of tree users aware that something changed, the
function is renamed to i2c_new_smbus_alert_device().
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-xlp9xx.c')
-rw-r--r-- | drivers/i2c/busses/i2c-xlp9xx.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-xlp9xx.c b/drivers/i2c/busses/i2c-xlp9xx.c index 8a873975cf12..823945bc3249 100644 --- a/drivers/i2c/busses/i2c-xlp9xx.c +++ b/drivers/i2c/busses/i2c-xlp9xx.c @@ -491,12 +491,16 @@ static int xlp9xx_i2c_get_frequency(struct platform_device *pdev, static int xlp9xx_i2c_smbus_setup(struct xlp9xx_i2c_dev *priv, struct platform_device *pdev) { + struct i2c_client *ara; + if (!priv->alert_data.irq) return -EINVAL; - priv->ara = i2c_setup_smbus_alert(&priv->adapter, &priv->alert_data); - if (!priv->ara) - return -ENODEV; + ara = i2c_new_smbus_alert_device(&priv->adapter, &priv->alert_data); + if (IS_ERR(ara)) + return PTR_ERR(ara); + + priv->ara = ara; return 0; } |