Linux IIO development
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Subject: Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks()
Date: Tue, 29 Apr 2025 06:50:24 +0300	[thread overview]
Message-ID: <d76b01c2-a08e-419c-93bf-92395ea75251@gmail.com> (raw)
In-Reply-To: <CAOMZO5CtU8_4gp4gM_DYj-6PCTROT5N1jRqb9-6PMq9PxOy1bw@mail.gmail.com>

On 28/04/2025 22:04, Fabio Estevam wrote:
> Hi Matti,
> 
> On Mon, Apr 28, 2025 at 2:38 AM Matti Vaittinen
> <mazziesaccount@gmail.com> wrote:
> 
>> I believe it'd be more informative if we printed the actual bit masks -
>> but I am not sure if we know the size of the mask. If we keep printing
>> the indexes, then we might want to add brackets [] to indicate the value
>> is an index? How about:
>>
>> "available_scan_masks: mask[8] subset of mask[0]. Never used"
>>
>> instead of:
>> available_scan_mask 8 subset of 0. Never used
>>
>> Would that be more obvious?
> 
> I still find the "Never used" part a bit cryptic. What exactly is never used?

When user wants to enable some channels, the IIO core scans the 
available_scan_masks -array in order to find a supported configuration 
which meets the requirements. IIO core does this scanning in the order, 
and stops when first suitable mask is found from the available_scan_masks.

This means that if we have a mask which is a subset of a mask which is 
earlier in the array, this latter mask will never be used because the 
earlier one (the superset) will always be found first and picked by the 
IIO core.

Eg, if mask[0] consists of bits
0,3,5,7

and mask[1] consists of bits
0,5

- then if user wants to enable channels 0 or 5 (or 0 and 5) - the 
mask[0] will always be picked by the IIO core because it fulfills the 
needs. This means IIO will always enable channels 0,3,5 and 7 - and 
never use the smaller configuration of only channels 0 and 5.

Hence, the ordering of the masks matters, and this check (and print) was 
added.

I hope this clarifies.

Yours,
	-- Matti

      reply	other threads:[~2025-04-29  3:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 20:23 max1363 : Warnings from iio_sanity_check_avail_scan_masks() Fabio Estevam
2025-04-26 15:00 ` Jonathan Cameron
2025-04-26 21:00   ` Fabio Estevam
2025-04-27 10:23     ` Jonathan Cameron
2025-04-28 19:03       ` Fabio Estevam
2025-04-28 21:16         ` Fabio Estevam
2025-04-29  3:59           ` Matti Vaittinen
2025-04-29 10:42             ` Fabio Estevam
2025-04-29 14:29             ` Fabio Estevam
2025-04-28  5:38   ` Matti Vaittinen
2025-04-28 19:04     ` Fabio Estevam
2025-04-29  3:50       ` Matti Vaittinen [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=d76b01c2-a08e-419c-93bf-92395ea75251@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=festevam@gmail.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