Support deferred probe for cases where communication on i2c bus fails. These failures could happen for a variety of reasons including bus arbitration error or power failure. Signed-off-by: Tomas Melin <tomas.melin@xxxxxxxxxxx> --- drivers/iio/adc/ti-ads1015.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index 075c75a87544..f7dfcb894408 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -1062,7 +1062,7 @@ static int ads1015_probe(struct i2c_client *client) ret = regmap_update_bits(data->regmap, ADS1015_CFG_REG, cfg_comp_mask, cfg_comp); if (ret) - return ret; + goto out; ret = devm_request_threaded_irq(&client->dev, client->irq, NULL, ads1015_event_handler, @@ -1074,7 +1074,7 @@ static int ads1015_probe(struct i2c_client *client) ret = ads1015_set_conv_mode(data, ADS1015_CONTINUOUS); if (ret) - return ret; + goto out; data->conv_invalid = true; @@ -1092,6 +1092,11 @@ static int ads1015_probe(struct i2c_client *client) } return 0; + +out: + if ((ret == -EAGAIN) || (ret == -ENXIO)) + return -EPROBE_DEFER; + return ret; } static void ads1015_remove(struct i2c_client *client) -- 2.39.2