public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH v1 1/1] iio: Mark iio_dev::priv member with __private
Date: Fri, 1 Nov 2024 15:02:56 +0000	[thread overview]
Message-ID: <20241101150256.19f542f3@jic23-huawei> (raw)
In-Reply-To: <20241101105342.3645018-1-andriy.shevchenko@linux.intel.com>

On Fri,  1 Nov 2024 12:53:42 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> The member is not supposed to be accessed directly, mark it with
> __private to catch the misuses up.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Makes sense.  Applied and pushed out as testing for all the normal reasons.


Jonathan

> ---
>  drivers/iio/industrialio-core.c | 2 +-
>  include/linux/iio/iio.h         | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 6a6568d4a2cb..4c543490e56c 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -1665,7 +1665,7 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
>  	indio_dev = &iio_dev_opaque->indio_dev;
>  
>  	if (sizeof_priv)
> -		indio_dev->priv = (char *)iio_dev_opaque +
> +		ACCESS_PRIVATE(indio_dev, priv) = (char *)iio_dev_opaque +
>  			ALIGN(sizeof(*iio_dev_opaque), IIO_DMA_MINALIGN);
>  
>  	indio_dev->dev.parent = parent;
> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> index 445d6666a291..5c6682bd4cb9 100644
> --- a/include/linux/iio/iio.h
> +++ b/include/linux/iio/iio.h
> @@ -624,7 +624,7 @@ struct iio_dev {
>  	const struct iio_info		*info;
>  	const struct iio_buffer_setup_ops	*setup_ops;
>  
> -	void				*priv;
> +	void				*priv __private;
>  };
>  
>  int iio_device_id(struct iio_dev *indio_dev);
> @@ -785,7 +785,7 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv);
>  /* The information at the returned address is guaranteed to be cacheline aligned */
>  static inline void *iio_priv(const struct iio_dev *indio_dev)
>  {
> -	return indio_dev->priv;
> +	return ACCESS_PRIVATE(indio_dev, priv);
>  }
>  
>  void iio_device_free(struct iio_dev *indio_dev);


      reply	other threads:[~2024-11-01 15:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 10:53 [PATCH v1 1/1] iio: Mark iio_dev::priv member with __private Andy Shevchenko
2024-11-01 15:02 ` 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=20241101150256.19f542f3@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@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