diff options
author | Nuno Sá <nuno.sa@analog.com> | 2022-09-13 09:34:13 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-09-21 19:42:53 +0200 |
commit | f13c81a3359ccfb2cd8ea2d0609d7d7a91e3dde7 (patch) | |
tree | 981c59bfa33b6837cea93b11744625e56451c412 /drivers | |
parent | iio: dac: ad5593r: Fix i2c read protocol requirements (diff) | |
download | linux-f13c81a3359ccfb2cd8ea2d0609d7d7a91e3dde7.tar.xz linux-f13c81a3359ccfb2cd8ea2d0609d7d7a91e3dde7.zip |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/iio/dac/ad5593r.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/iio/dac/ad5593r.c b/drivers/iio/dac/ad5593r.c index 356dc0bab115..420981e7c5c3 100644 --- a/drivers/iio/dac/ad5593r.c +++ b/drivers/iio/dac/ad5593r.c @@ -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); } |