Linux IIO development
 help / color / mirror / Atom feed
* [PATCH RFC 0/3] iio: add helpers and accessors for active channels and masklength
@ 2024-06-12 14:20 Nuno Sa
  2024-06-12 14:20 ` [PATCH RFC 1/3] iio: core: add new helper to iterate active channels Nuno Sa
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Nuno Sa @ 2024-06-12 14:20 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Lars-Peter Clausen, Michael Hennerich

Hi Jonathan,

In [1], you suggested for an iterator for the active channels (so driver
don't directly access masklength). This RFC showcases that iterator and
goes one step further by giving an accessors for masklength so that
drivers can read that variable (we have drivers doing that). The
accessors uses ACCESS_PRIVATE() so it will warn us if some driver
directly access the variable making it more difficult to mess with it
(like changing it's value) without being noticed during review (or the
auto builders).

Anyways, before jumping in changing all the drivers using this, I guess
the questions are:

1) Is the iterator useful enough to add one (kind of like it and save a
line of code :))?
2) Do we care about going with the work of marking masklength private? 

If we go ahead the plan would be:

1) Add the helpers macros;
2) Convert all drivers that directly access 'masklength';
3) Annotate it as private.

[1]: https://lore.kernel.org/linux-iio/20240428142343.5067c898@jic23-huawei/

---
Nuno Sa (3):
      iio: core: add new helper to iterate active channels
      iio: imu: adis16475: make use of iio_for_each_active_channel()
      iio: core annotate masklength as private

 drivers/iio/imu/adis16475.c | 3 +--
 include/linux/iio/iio.h     | 8 +++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
---
base-commit: cc1ce839526a65620778617da0b022bd88e8a139
change-id: 20240612-dev-iio-scan-private-86f4a0fd288f
--

Thanks!
- Nuno Sá


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-17  6:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-12 14:20 [PATCH RFC 0/3] iio: add helpers and accessors for active channels and masklength Nuno Sa
2024-06-12 14:20 ` [PATCH RFC 1/3] iio: core: add new helper to iterate active channels Nuno Sa
2024-06-12 14:20 ` [PATCH RFC 2/3] iio: imu: adis16475: make use of iio_for_each_active_channel() Nuno Sa
2024-06-12 14:20 ` [PATCH RFC 3/3] iio: core annotate masklength as private Nuno Sa
2024-06-15 13:18 ` [PATCH RFC 0/3] iio: add helpers and accessors for active channels and masklength Jonathan Cameron
2024-06-17  6:34   ` Nuno Sá

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox