Linux IIO development
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/2] Sanity-check available_scan_masks array
Date: Sun, 29 Oct 2023 17:28:54 +0200	[thread overview]
Message-ID: <5d63087a-91c8-434e-aa47-a3d60e456e1f@gmail.com> (raw)
In-Reply-To: <20231028173221.4dd81185@jic23-huawei>

On 10/28/23 19:32, Jonathan Cameron wrote:
> On Sat, 21 Oct 2023 19:03:15 +0300
> Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> 
>> On 10/21/23 18:55, Jonathan Cameron wrote:
>>> On Mon, 16 Oct 2023 14:04:11 +0300
>>> Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>>>    
>>>> Sanity-check available_scan_masks array
>>>>
>>>> The available_scan_masks is an array of bitmasks representing the
>>>> channels which can be simultaneously(*) scanned by a driver from the
>>>> device. Following special characteristics apply:
>>>>
>>>> - When IIO is scanning through the array it will use the first mask
>>>>     which can be used to scan all enabled channels. This means drivers
>>>>     should order the array in the order of the preference. This does also
>>>>     mean that a mask which is a subset of a mask located earler in array
>>>>     will never be used because the earlier one will be picked by the core.
>>>> - Masks wider than size of long are supported only to some extent. The
>>>>     code scanning through the array will interpret the first mask with
>>>>     first long zeroed as end-of-array terminator. Changing this behaviour
>>>>     would make mask-arrays for multi-long masks to be terminated by more
>>>>     than one zero long. Failure to do so would result kernel to read
>>>>     beyond the array generating a potentially hazardous bug.
>>>>
>>>> Add a sanity-check to IIO-device registration emitting a warning if
>>>> available_scan_mask array is misordered or if mask width is larger than
>>>> a long while available_scan_mask-array is populated. Currently there
>>>> should be no in-tree drivers with available_scan_mask populated and mask
>>>> wider than a long.
>>>>
>>>> Revision history:
>>>> v1 => v2:
>>>> 	- Add patch 2/2 documenting why iio_scan_mask_match() checks only
>>>> 	  a long worth of bits while searching for the end of the
>>>> 	  available_scan_mask-array.
>>>> 	- Styling of patch 1/2 as per comments from Jonathan
>>>> 	v1 and related discussion here:
>>>> 	https://lore.kernel.org/lkml/ZRvjuZaQWdZw1U1I@dc78bmyyyyyyyyyyyyydt-3.rev.dnainternet.fi/
>>>>
>>>> Matti Vaittinen (2):
>>>>     iio: sanity check available_scan_masks array
>>>>     iio: buffer: document known issue

...

> 
> I've started queuing stuff up for rebasing post merge window, so I've
> added this as well. For now will only be exposed as the testing branch
> that 0-day pokes at.

Thanks Jonathan!


-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


      reply	other threads:[~2023-10-29 15:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 11:04 [PATCH v2 0/2] Sanity-check available_scan_masks array Matti Vaittinen
2023-10-16 11:04 ` [PATCH v2 1/2] iio: sanity check " Matti Vaittinen
2023-10-16 11:04 ` [PATCH v2 2/2] iio: buffer: document known issue Matti Vaittinen
2023-10-21 15:55 ` [PATCH v2 0/2] Sanity-check available_scan_masks array Jonathan Cameron
2023-10-21 16:03   ` Matti Vaittinen
2023-10-28 16:32     ` Jonathan Cameron
2023-10-29 15:28       ` 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=5d63087a-91c8-434e-aa47-a3d60e456e1f@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    /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