From: Giuseppe Barba <giuseppe.barba@st.com>
To: <linux-iio@vger.kernel.org>
Cc: <denis.ciocca@st.com>, <jic23@kernel.org>,
Giuseppe Barba <giuseppe.barba@st.com>
Subject: [PATCH V2 2/5] iio: st-sensors: add support for single full scale device
Date: Mon, 20 Jul 2015 16:20:26 +0200 [thread overview]
Message-ID: <1437402029-29786-3-git-send-email-giuseppe.barba@st.com> (raw)
In-Reply-To: <1437402029-29786-1-git-send-email-giuseppe.barba@st.com>
Some sensors could have only one full scale value. This means that the sensor
hasn't a full scale register.
This commit add a check on the configured full scale address to support such
kind of sensors.
Signed-off-by: Giuseppe Barba <giuseppe.barba@st.com>
---
drivers/iio/common/st_sensors/st_sensors_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 6323d32..712dbed 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -126,6 +126,9 @@ static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs)
int err, i = 0;
struct st_sensor_data *sdata = iio_priv(indio_dev);
+ if (sdata->sensor_settings->fs.addr == 0)
+ return 0;
+
err = st_sensors_match_fs(sdata->sensor_settings, fs, &i);
if (err < 0)
goto st_accel_set_fullscale_error;
--
1.9.1
next prev parent reply other threads:[~2015-07-20 14:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 14:20 [PATCH V2 0/5] Added ST LSM303AGR sensor Giuseppe Barba
2015-07-20 14:20 ` [PATCH V2 1/5] iio: st-sensors: add configuration for WhoAmI address Giuseppe Barba
2015-07-21 3:51 ` Denis Ciocca
2015-07-21 7:33 ` Giuseppe BARBA
2015-07-20 14:20 ` Giuseppe Barba [this message]
2015-07-20 14:20 ` [PATCH V2 3/5] iio: st_magn: Add irq trigger handling Giuseppe Barba
2015-07-20 14:20 ` [PATCH V2 4/5] iio: st-accel: add support for lsm303agr accelerometer Giuseppe Barba
2015-07-20 14:20 ` [PATCH V2 5/5] iio: st-magn: add support for lsm303agr magnetometer Giuseppe Barba
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=1437402029-29786-3-git-send-email-giuseppe.barba@st.com \
--to=giuseppe.barba@st.com \
--cc=denis.ciocca@st.com \
--cc=jic23@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).