From: Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org>
To: linux-iio@vger.kernel.org, linux-staging@lists.linux.dev
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Ramona Gradinariu" <ramona.gradinariu@analog.com>,
"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Marcus Folkesson" <marcus.folkesson@gmail.com>,
"Kent Gustavsson" <kent@minoris.se>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Heiko Stuebner" <heiko@sntech.de>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Francesco Dolcini" <francesco@dolcini.it>,
"João Paulo Gonçalves" <jpaulo.silvagoncalves@gmail.com>,
"Haibo Chen" <haibo.chen@nxp.com>,
"Michal Simek" <michal.simek@amd.com>,
"Benson Leung" <bleung@chromium.org>,
"Guenter Roeck" <groeck@chromium.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: [PATCH 23/23] iio: core: annotate masklength as __private
Date: Fri, 26 Jul 2024 10:23:15 +0200 [thread overview]
Message-ID: <20240726-dev-iio-masklength-private3-v1-23-82913fc0fb87@analog.com> (raw)
In-Reply-To: <20240726-dev-iio-masklength-private3-v1-0-82913fc0fb87@analog.com>
From: Nuno Sa <nuno.sa@analog.com>
Now that all users are using the proper accessors, we can mark
masklength as __private so that no one tries to write. We also get help
from checkers in warning us in case someone does it.
To access the private field from IIO core code, we need to use the
ACCESS_PRIVATE() macro.
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
drivers/iio/industrialio-buffer.c | 2 +-
include/linux/iio/iio.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 3d0b1d25fdd7..8104696cd475 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -2269,7 +2269,7 @@ int iio_buffers_alloc_sysfs_and_mask(struct iio_dev *indio_dev)
for (i = 0; i < indio_dev->num_channels; i++)
ml = max(ml, channels[i].scan_index + 1);
- indio_dev->masklength = ml;
+ ACCESS_PRIVATE(indio_dev, masklength) = ml;
}
if (!iio_dev_opaque->attached_buffers_cnt)
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index dd6bbc468283..f6c0499853bb 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -609,7 +609,7 @@ struct iio_dev {
int scan_bytes;
const unsigned long *available_scan_masks;
- unsigned masklength;
+ unsigned __private masklength;
const unsigned long *active_scan_mask;
bool scan_timestamp;
struct iio_trigger *trig;
@@ -861,7 +861,7 @@ static inline const struct iio_scan_type
*/
static inline unsigned int iio_get_masklength(const struct iio_dev *indio_dev)
{
- return indio_dev->masklength;
+ return ACCESS_PRIVATE(indio_dev, masklength);
}
/**
--
2.45.2
next prev parent reply other threads:[~2024-07-26 8:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 8:22 [PATCH 00/23] iio: make masklength __private (final round) Nuno Sa via B4 Relay
2024-07-26 8:22 ` [PATCH 01/23] iio: accel: adxl380: make use of iio_get_masklength() Nuno Sa via B4 Relay
2024-07-26 8:22 ` [PATCH 02/23] iio: adc: max1118: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-26 8:22 ` [PATCH 03/23] " Nuno Sa via B4 Relay
2024-07-26 8:22 ` [PATCH 04/23] iio: adc: mcp3911: " Nuno Sa via B4 Relay
2024-07-26 8:22 ` [PATCH 05/23] iio: adc: mt6360-adc: " Nuno Sa via B4 Relay
2024-07-26 12:14 ` AngeloGioacchino Del Regno
2024-07-26 8:22 ` [PATCH 06/23] iio: adc: rockchip_saradc: " Nuno Sa via B4 Relay
2024-07-29 16:52 ` Heiko Stübner
2024-07-26 8:22 ` [PATCH 07/23] iio: adc: rtq6056: " Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 08/23] iio: adc: stm32-adc: make use of iio_get_masklength() Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 09/23] iio: adc: stm32-dfsdm-adc: " Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 10/23] iio: adc: ti-adc0832: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 11/23] iio: adc: ti-adc084s021: " Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 12/23] iio: adc: ti-ads1015: make use of iio_get_masklength() Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 13/23] iio: adc: ti-ads1119: " Nuno Sa via B4 Relay
2024-07-28 19:55 ` João Paulo Gonçalves
2024-07-26 8:23 ` [PATCH 14/23] iio: adc: ti-ads1298: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 15/23] iio: adc: ti-adc12138: " Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 16/23] iio: adc: ti-ads124s08: " Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 17/23] iio: adc: ti-ads131e08: " Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 18/23] iio: adc: ti-ads8688: " Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 19/23] iio: adc: vf610_adc: make use of iio_get_masklength() Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 20/23] iio: adc: xilinx-xadc-core: use new '.masklength' accessors Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 21/23] iio: common: cros_ec_sensors_core: " Nuno Sa via B4 Relay
2024-07-26 8:23 ` [PATCH 22/23] staging: iio: impedance-analyzer: ad5933: make use of iio_get_masklength() Nuno Sa via B4 Relay
2024-07-26 8:23 ` Nuno Sa via B4 Relay [this message]
2024-08-14 18:46 ` [PATCH 00/23] iio: make masklength __private (final round) Jonathan Cameron
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=20240726-dev-iio-masklength-private3-v1-23-82913fc0fb87@analog.com \
--to=devnull+nuno.sa.analog.com@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=alexandre.torgue@foss.st.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=antoniu.miclaus@analog.com \
--cc=bleung@chromium.org \
--cc=francesco@dolcini.it \
--cc=gregkh@linuxfoundation.org \
--cc=groeck@chromium.org \
--cc=haibo.chen@nxp.com \
--cc=heiko@sntech.de \
--cc=jic23@kernel.org \
--cc=jpaulo.silvagoncalves@gmail.com \
--cc=kent@minoris.se \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=marcus.folkesson@gmail.com \
--cc=matthias.bgg@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=michal.simek@amd.com \
--cc=nuno.sa@analog.com \
--cc=ramona.gradinariu@analog.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