From: Lars-Peter Clausen <lars@metafoo.de>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Jonathan Cameron <jic23@kernel.org>, <devel@driverdev.osuosl.org>,
<linux-iio@vger.kernel.org>, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 3/3] staging:iio: Fix scan mask update
Date: Thu, 8 Dec 2011 18:35:53 +0100 [thread overview]
Message-ID: <1323365753-7645-3-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1323365753-7645-1-git-send-email-lars@metafoo.de>
When updating the scan mask we have to check the actual scan mask for if the
channel is already enabled, not the matching scan mask from the available
scan masks. The bit will already be set there and as a result the actual
scan mask will not get updated and the channel stays disabled.
Also fix the return value of iio_scan_el_store which would return 1 instead of
the number of bytes written if the channel was already active in the scan mask.
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
drivers/staging/iio/industrialio-buffer.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/iio/industrialio-buffer.c b/drivers/staging/iio/industrialio-buffer.c
index 552e33f..a03a574 100644
--- a/drivers/staging/iio/industrialio-buffer.c
+++ b/drivers/staging/iio/industrialio-buffer.c
@@ -173,7 +173,7 @@ static ssize_t iio_scan_el_store(struct device *dev,
error_ret:
mutex_unlock(&indio_dev->mlock);
- return ret ? ret : len;
+ return ret < 0 ? ret : len;
}
@@ -624,16 +624,8 @@ int iio_scan_mask_query(struct iio_dev *indio_dev,
if (!buffer->scan_mask)
return 0;
- if (indio_dev->available_scan_masks)
- mask = iio_scan_mask_match(indio_dev->available_scan_masks,
- indio_dev->masklength,
- buffer->scan_mask);
- else
- mask = buffer->scan_mask;
- if (!mask)
- return 0;
- return test_bit(bit, mask);
+ return test_bit(bit, buffer->scan_mask);
};
EXPORT_SYMBOL_GPL(iio_scan_mask_query);
--
1.7.7.3
next prev parent reply other threads:[~2011-12-08 17:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-08 17:35 [PATCH 1/3] staging:iio: Fix sw_ring memory corruption Lars-Peter Clausen
2011-12-08 17:35 ` [PATCH 2/3] staging:iio:kfifo_buf: Fix potential buffer overflow in iio_read_first_n_kfifo Lars-Peter Clausen
[not found] ` <20111208201722.GA31926@kroah.com>
2011-12-09 9:58 ` Lars-Peter Clausen
2011-12-09 15:11 ` Greg KH
2011-12-08 17:35 ` Lars-Peter Clausen [this message]
2011-12-08 20:18 ` [PATCH 3/3] staging:iio: Fix scan mask update Greg KH
2011-12-09 9:49 ` Lars-Peter Clausen
2011-12-09 15:11 ` Greg KH
2011-12-18 18:02 ` Jonathan Cameron
2011-12-18 19:44 ` Lars-Peter Clausen
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=1323365753-7645-3-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--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).