diff mbox series

[2/9] iio: avoid shadowing of variable name in to_iio_dev_opaque()

Message ID 20210426174911.397061-3-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series iio: Move more things from iio_dev to iio_dev_opaque | expand

Commit Message

Jonathan Cameron April 26, 2021, 5:49 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

indio_dev was both the macro input parameter and the field name
in this macro.  That causes trouble if the instance of
struct iio_dev passed in is not called indio_dev.

Whilst a fix of sorts, no need to backport as it seems we never
hit this previously due to some very consistent naming in IIO.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 include/linux/iio/iio-opaque.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alexandru Ardelean April 27, 2021, 7:45 a.m. UTC | #1
On Mon, Apr 26, 2021 at 8:50 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> indio_dev was both the macro input parameter and the field name
> in this macro.  That causes trouble if the instance of
> struct iio_dev passed in is not called indio_dev.
>
> Whilst a fix of sorts, no need to backport as it seems we never
> hit this previously due to some very consistent naming in IIO.
>

Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  include/linux/iio/iio-opaque.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/iio/iio-opaque.h b/include/linux/iio/iio-opaque.h
> index e66b029d99de..f876e3aede2c 100644
> --- a/include/linux/iio/iio-opaque.h
> +++ b/include/linux/iio/iio-opaque.h
> @@ -48,7 +48,7 @@ struct iio_dev_opaque {
>  #endif
>  };
>
> -#define to_iio_dev_opaque(indio_dev)           \
> -       container_of(indio_dev, struct iio_dev_opaque, indio_dev)
> +#define to_iio_dev_opaque(_indio_dev)          \
> +       container_of((_indio_dev), struct iio_dev_opaque, indio_dev)
>
>  #endif
> --
> 2.31.1
>
diff mbox series

Patch

diff --git a/include/linux/iio/iio-opaque.h b/include/linux/iio/iio-opaque.h
index e66b029d99de..f876e3aede2c 100644
--- a/include/linux/iio/iio-opaque.h
+++ b/include/linux/iio/iio-opaque.h
@@ -48,7 +48,7 @@  struct iio_dev_opaque {
 #endif
 };
 
-#define to_iio_dev_opaque(indio_dev)		\
-	container_of(indio_dev, struct iio_dev_opaque, indio_dev)
+#define to_iio_dev_opaque(_indio_dev)		\
+	container_of((_indio_dev), struct iio_dev_opaque, indio_dev)
 
 #endif