From: "Nuno Sá" <nuno.sa@analog.com>
To: <linux-iio@vger.kernel.org>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Jonathan Cameron <jic23@kernel.org>,
Michael Hennerich <michael.hennerich@analog.com>
Subject: [PATCH 2/2] iio: dac: ad5593r: add check for i2c functionality
Date: Tue, 13 Sep 2022 09:34:13 +0200 [thread overview]
Message-ID: <20220913073413.140475-3-nuno.sa@analog.com> (raw)
In-Reply-To: <20220913073413.140475-1-nuno.sa@analog.com>
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>
---
drivers/iio/dac/ad5593r.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/iio/dac/ad5593r.c b/drivers/iio/dac/ad5593r.c
index 43ee4efb250c..f09433e298db 100644
--- a/drivers/iio/dac/ad5593r.c
+++ b/drivers/iio/dac/ad5593r.c
@@ -98,6 +98,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);
}
--
2.37.3
next prev parent reply other threads:[~2022-09-13 7:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 7:34 [PATCH 0/2] ad5593r fix read protocol Nuno Sá
2022-09-13 7:34 ` [PATCH 1/2] iio: dac: ad5593r: Fix i2c read protocol requirements Nuno Sá
2022-09-13 7:34 ` Nuno Sá [this message]
2022-09-15 14:38 ` [PATCH 0/2] ad5593r fix read protocol Jonathan Cameron
2022-09-16 6:05 ` Nuno Sá
2022-09-16 15:30 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220913073413.140475-3-nuno.sa@analog.com \
--to=nuno.sa@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox