From: Vlad Dogaru <vlad.dogaru@intel.com>
To: linux-iio@vger.kernel.org, jic23@kernel.org, knaack.h@gmx.de
Cc: Vlad Dogaru <vlad.dogaru@intel.com>
Subject: [PATCH 2/2] iio: sx9500: fix bug in compensation code
Date: Tue, 30 Jun 2015 14:20:59 +0300 [thread overview]
Message-ID: <1435663259-21998-3-git-send-email-vlad.dogaru@intel.com> (raw)
In-Reply-To: <1435663259-21998-1-git-send-email-vlad.dogaru@intel.com>
The initial compensation was mistakingly toggling an extra bit in the
control register. Fix this and make sure it's less likely to happen by
introducing an additional macro.
Reported-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
---
drivers/iio/proximity/sx9500.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index ba1cbbe..798b973 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -80,6 +80,7 @@
#define SX9500_COMPSTAT_MASK GENMASK(3, 0)
#define SX9500_NUM_CHANNELS 4
+#define SX9500_CHAN_MASK GENMASK(SX9500_NUM_CHANNELS - 1, 0)
struct sx9500_data {
struct mutex mutex;
@@ -802,8 +803,7 @@ static int sx9500_init_compensation(struct iio_dev *indio_dev)
unsigned int val;
ret = regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0,
- GENMASK(SX9500_NUM_CHANNELS, 0),
- GENMASK(SX9500_NUM_CHANNELS, 0));
+ SX9500_CHAN_MASK, SX9500_CHAN_MASK);
if (ret < 0)
return ret;
@@ -823,7 +823,7 @@ static int sx9500_init_compensation(struct iio_dev *indio_dev)
out:
regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0,
- GENMASK(SX9500_NUM_CHANNELS, 0), 0);
+ SX9500_CHAN_MASK, 0);
return ret;
}
--
1.9.1
next prev parent reply other threads:[~2015-06-30 11:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 11:20 [PATCH 0/2] iio: sx9500: couple of bug fixes Vlad Dogaru
2015-06-30 11:20 ` [PATCH 1/2] iio: sx9500: rework error handling of raw readings Vlad Dogaru
2015-07-01 18:39 ` Hartmut Knaack
2015-07-05 13:02 ` Jonathan Cameron
2015-06-30 11:20 ` Vlad Dogaru [this message]
2015-07-01 18:42 ` [PATCH 2/2] iio: sx9500: fix bug in compensation code Hartmut Knaack
2015-07-05 13:04 ` 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=1435663259-21998-3-git-send-email-vlad.dogaru@intel.com \
--to=vlad.dogaru@intel.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.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;
as well as URLs for NNTP newsgroup(s).