From: Lars-Peter Clausen <lars@metafoo.de>
To: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Jonathan Cameron <jic23@cam.ac.uk>, linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/5] iio: Introduce iio_validate_scan_mask_onehot
Date: Mon, 02 Jul 2012 15:13:13 +0200 [thread overview]
Message-ID: <4FF19E69.9040009@metafoo.de> (raw)
In-Reply-To: <alpine.DEB.2.01.1207021451180.26435@pmeerw.net>
On 07/02/2012 02:52 PM, Peter Meerwald wrote:
>
>> Add a helper function for validating a scan mask for devices where at most one
>> channel may be selected at a time. This is a common case among devices which
>> have scan mask restrictions so it makes sense to provide this function in the
>> core.
>
> personally, would find iio_validate_scan_mask_atmost_one clearer than
> iio_validate_scan_mask_onehot, but it is a bit longer also
I think the code can even be changed to be more strict and just check if
bitmap_weight == 1. A mask is only validating after enabling a channel and
not after disabling it, so there will always be at least one bit set when
the validate function is called.
- Lars
next prev parent reply other threads:[~2012-07-02 13:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-02 12:44 [PATCH 1/5] iio: Add callback to check whether a scan mask is valid Lars-Peter Clausen
2012-07-02 12:44 ` [PATCH 2/5] iio: Introduce iio_validate_scan_mask_onehot Lars-Peter Clausen
2012-07-02 12:52 ` Peter Meerwald
2012-07-02 13:13 ` Lars-Peter Clausen [this message]
2012-07-08 8:58 ` Jonathan Cameron
2012-07-02 12:44 ` [PATCH 3/5] staging:iio:ad7192: Use iio_validate_scan_mask_onehot Lars-Peter Clausen
2012-07-02 12:44 ` [PATCH 4/5] staging:iio:ad7793: " Lars-Peter Clausen
2012-07-02 12:44 ` [PATCH 5/5] staging:iio:ade7758: " 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=4FF19E69.9040009@metafoo.de \
--to=lars@metafoo.de \
--cc=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.