From: Jonathan Cameron <jic23@kernel.org>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: linux-iio@vger.kernel.org, Jonathan Cameron <jic23@cam.ac.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Shawn Guo <shawn.guo@linaro.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] staging/iio/mxs-lradc: cleanup masklength
Date: Mon, 06 May 2013 17:27:38 +0100 [thread overview]
Message-ID: <5187D9FA.8000808@kernel.org> (raw)
In-Reply-To: <6bb527db65fb20f60bb95814bff3abc513733a7c.1367671597.git.mirq-linux@rere.qmqm.pl>
On 05/04/2013 02:19 PM, Michał Mirosław wrote:
> We know the exact iio->masklength = LRADC_MAX_TOTAL_CHANS.
> Let's use it consistently.
I guess this gives a small improvement in clarity so
applied to togreg branch of iio.git.
Thanks,
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
> drivers/staging/iio/adc/mxs-lradc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index 2856b8f..03299ea 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -620,7 +620,7 @@ static irqreturn_t mxs_lradc_trigger_handler(int irq, void *p)
> ((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET);
> unsigned int i, j = 0;
>
> - for_each_set_bit(i, iio->active_scan_mask, iio->masklength) {
> + for_each_set_bit(i, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
> lradc->buffer[j] = readl(lradc->base + LRADC_CH(j));
> writel(chan_value, lradc->base + LRADC_CH(j));
> lradc->buffer[j] &= LRADC_CH_VALUE_MASK;
> @@ -775,8 +775,7 @@ static bool mxs_lradc_validate_scan_mask(struct iio_dev *iio,
> const unsigned long *mask)
> {
> struct mxs_lradc *lradc = iio_priv(iio);
> - const int len = iio->masklength;
> - const int map_chans = bitmap_weight(mask, len);
> + const int map_chans = bitmap_weight(mask, LRADC_MAX_TOTAL_CHANS);
> int rsvd_chans = 0;
> unsigned long rsvd_mask = 0;
>
> @@ -793,7 +792,7 @@ static bool mxs_lradc_validate_scan_mask(struct iio_dev *iio,
> rsvd_chans++;
>
> /* Test for attempts to map channels with special mode of operation. */
> - if (bitmap_intersects(mask, &rsvd_mask, len))
> + if (bitmap_intersects(mask, &rsvd_mask, LRADC_MAX_TOTAL_CHANS))
> return false;
>
> /* Test for attempts to map more channels then available slots. */
> @@ -969,6 +968,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
> iio->modes = INDIO_DIRECT_MODE;
> iio->channels = mxs_lradc_chan_spec;
> iio->num_channels = ARRAY_SIZE(mxs_lradc_chan_spec);
> + iio->masklength = LRADC_MAX_TOTAL_CHANS;
>
> ret = iio_triggered_buffer_setup(iio, &iio_pollfunc_store_time,
> &mxs_lradc_trigger_handler,
>
prev parent reply other threads:[~2013-05-06 16:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-04 13:19 [PATCH 1/2] staging/iio/mxs-lradc: cleanup masklength Michał Mirosław
2013-05-04 13:19 ` [PATCH 2/2] staging/iio/mxs-lradc: fix preenable for multiple buffers Michał Mirosław
2013-05-06 16:30 ` Jonathan Cameron
2013-05-06 16:27 ` Jonathan Cameron [this message]
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=5187D9FA.8000808@kernel.org \
--to=jic23@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@cam.ac.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=mirq-linux@rere.qmqm.pl \
--cc=shawn.guo@linaro.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