iio: dac: ad5593r: add check for i2c functionality

Make sure that the needed i2c functionality is supported during probe.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Link: https://lore.kernel.org/r/20220913073413.140475-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Nuno Sá 2022-09-13 09:34:13 +02:00 committed by Jonathan Cameron
parent 558a25f903
commit f13c81a335

View File

@ -102,6 +102,10 @@ static const struct ad5592r_rw_ops ad5593r_rw_ops = {
static int ad5593r_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
if (!i2c_check_functionality(i2c->adapter,
I2C_FUNC_SMBUS_BYTE | I2C_FUNC_I2C))
return -EOPNOTSUPP;
return ad5592r_probe(&i2c->dev, id->name, &ad5593r_rw_ops);
}