Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Vasileios Amoiridis <vassilisamir@gmail.com>
Cc: lars@metafoo.de, krzysztof.kozlowski@linaro.org,
	nuno.sa@analog.com, u.kleine-koenig@baylibre.com,
	abhashkumarjha123@gmail.com, jstephan@baylibre.com,
	dlechner@baylibre.com, jackoalan@gmail.com, k.wrona@samsung.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] iio: core: mark scan_timestamp as __private
Date: Thu, 19 Dec 2024 17:49:09 +0000	[thread overview]
Message-ID: <20241219174909.5d03e529@jic23-huawei> (raw)
In-Reply-To: <20241214191421.94172-5-vassilisamir@gmail.com>

On Sat, 14 Dec 2024 20:14:21 +0100
Vasileios Amoiridis <vassilisamir@gmail.com> wrote:

> Since there are no more direct accesses to the indio_dev->scan_timestamp
> value, it can be marked as __private and use the macro ACCESS_PRIVATE()
> in order to access it. Like this, static checkers will be able to inform
> in case someone tries to either write to the value, or read its value
> directly.
> 
> Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Applied.  Thanks

I'll push this out as testing shortly and we can see if 0-day finds
any problems with it.

Jonathan



> ---
>  drivers/iio/industrialio-buffer.c | 2 +-
>  include/linux/iio/buffer.h        | 2 +-
>  include/linux/iio/iio.h           | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index 2708f87df719..a80f7cc25a27 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -1137,7 +1137,7 @@ static int iio_enable_buffers(struct iio_dev *indio_dev,
>  	int ret;
>  
>  	indio_dev->active_scan_mask = config->scan_mask;
> -	indio_dev->scan_timestamp = config->scan_timestamp;
> +	ACCESS_PRIVATE(indio_dev, scan_timestamp) = config->scan_timestamp;
>  	indio_dev->scan_bytes = config->scan_bytes;
>  	iio_dev_opaque->currentmode = config->mode;
>  
> diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
> index 418b1307d3f2..3b8d618bb3df 100644
> --- a/include/linux/iio/buffer.h
> +++ b/include/linux/iio/buffer.h
> @@ -37,7 +37,7 @@ int iio_pop_from_buffer(struct iio_buffer *buffer, void *data);
>  static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
>  	void *data, int64_t timestamp)
>  {
> -	if (indio_dev->scan_timestamp) {
> +	if (ACCESS_PRIVATE(indio_dev, scan_timestamp)) {
>  		size_t ts_offset = indio_dev->scan_bytes / sizeof(int64_t) - 1;
>  		((int64_t *)data)[ts_offset] = timestamp;
>  	}
> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> index ae65890d4567..56161e02f002 100644
> --- a/include/linux/iio/iio.h
> +++ b/include/linux/iio/iio.h
> @@ -611,7 +611,7 @@ struct iio_dev {
>  	const unsigned long		*available_scan_masks;
>  	unsigned int			__private masklength;
>  	const unsigned long		*active_scan_mask;
> -	bool				scan_timestamp;
> +	bool				__private scan_timestamp;
>  	struct iio_trigger		*trig;
>  	struct iio_poll_func		*pollfunc;
>  	struct iio_poll_func		*pollfunc_event;


      reply	other threads:[~2024-12-19 17:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-14 19:14 [PATCH v2 0/4] iio: mark scan_timestamp as __private Vasileios Amoiridis
2024-12-14 19:14 ` [PATCH v2 1/4] iio: adc: dln2-adc: zero full struct instead of just the padding Vasileios Amoiridis
2024-12-19 17:41   ` Jonathan Cameron
2024-12-14 19:14 ` [PATCH v2 2/4] iio: adc: max1363: make use of iio_is_soft_ts_enabled() Vasileios Amoiridis
2024-12-19 17:45   ` Jonathan Cameron
2024-12-14 19:14 ` [PATCH v2 3/4] iio: common: ssp_sensors: drop conditional optimization for simplicity Vasileios Amoiridis
2024-12-16 21:57   ` David Lechner
2024-12-17 23:41     ` Vasileios Amoiridis
2024-12-18 15:17       ` David Lechner
2024-12-18 21:13         ` Vasileios Amoiridis
2024-12-19 17:47           ` Jonathan Cameron
2024-12-14 19:14 ` [PATCH v2 4/4] iio: core: mark scan_timestamp as __private Vasileios Amoiridis
2024-12-19 17:49   ` 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=20241219174909.5d03e529@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=abhashkumarjha123@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=jackoalan@gmail.com \
    --cc=jstephan@baylibre.com \
    --cc=k.wrona@samsung.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=vassilisamir@gmail.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