diff mbox series

iio:magn:hmc5843: Fix passing true where iio_shared_by enum required.

Message ID 20200913112546.715624-1-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series iio:magn:hmc5843: Fix passing true where iio_shared_by enum required. | expand

Commit Message

Jonathan Cameron Sept. 13, 2020, 11:25 a.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

So it's obvious that the code is wrong in passing true, but I'm assuming
that will actually evaluate to 1 and hence IIO_SHARED_BY_TYPE.
The documentation however has this attribute as IIO_SHARED_BY_ALL.
My current assumption is the documentation is wrong.
If anyone knows otherwise please shout out!

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes: 7247645f6865 ("iio: hmc5843: Move hmc5843 out of staging")
Cc: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/iio/magnetometer/hmc5843_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Lars-Peter Clausen Sept. 18, 2020, 1:35 p.m. UTC | #1
On 9/13/20 1:25 PM, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> So it's obvious that the code is wrong in passing true, but I'm assuming
> that will actually evaluate to 1 and hence IIO_SHARED_BY_TYPE.
> The documentation however has this attribute as IIO_SHARED_BY_ALL.
> My current assumption is the documentation is wrong.
> If anyone knows otherwise please shout out!
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Fixes: 7247645f6865 ("iio: hmc5843: Move hmc5843 out of staging")
> Cc: H. Nikolaus Schaller <hns@goldelico.com>

Obviously correct.

Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>

> ---
>   drivers/iio/magnetometer/hmc5843_core.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/hmc5843_core.c b/drivers/iio/magnetometer/hmc5843_core.c
> index 1474ba63babe..780faea61d82 100644
> --- a/drivers/iio/magnetometer/hmc5843_core.c
> +++ b/drivers/iio/magnetometer/hmc5843_core.c
> @@ -245,7 +245,7 @@ static const struct iio_enum hmc5843_meas_conf_enum = {
>   };
>   
>   static const struct iio_chan_spec_ext_info hmc5843_ext_info[] = {
> -	IIO_ENUM("meas_conf", true, &hmc5843_meas_conf_enum),
> +	IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5843_meas_conf_enum),
>   	IIO_ENUM_AVAILABLE("meas_conf", &hmc5843_meas_conf_enum),
>   	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
>   	{ }
> @@ -259,7 +259,7 @@ static const struct iio_enum hmc5983_meas_conf_enum = {
>   };
>   
>   static const struct iio_chan_spec_ext_info hmc5983_ext_info[] = {
> -	IIO_ENUM("meas_conf", true, &hmc5983_meas_conf_enum),
> +	IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5983_meas_conf_enum),
>   	IIO_ENUM_AVAILABLE("meas_conf", &hmc5983_meas_conf_enum),
>   	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
>   	{ }
Matt Ranostay Sept. 18, 2020, 7:15 p.m. UTC | #2
On Sun, Sep 13, 2020 at 4:27 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> So it's obvious that the code is wrong in passing true, but I'm assuming
> that will actually evaluate to 1 and hence IIO_SHARED_BY_TYPE.
> The documentation however has this attribute as IIO_SHARED_BY_ALL.
> My current assumption is the documentation is wrong.
> If anyone knows otherwise please shout out!
>

Yeah this is much easier to understand than the odd boolean value.

Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Fixes: 7247645f6865 ("iio: hmc5843: Move hmc5843 out of staging")
> Cc: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  drivers/iio/magnetometer/hmc5843_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/hmc5843_core.c b/drivers/iio/magnetometer/hmc5843_core.c
> index 1474ba63babe..780faea61d82 100644
> --- a/drivers/iio/magnetometer/hmc5843_core.c
> +++ b/drivers/iio/magnetometer/hmc5843_core.c
> @@ -245,7 +245,7 @@ static const struct iio_enum hmc5843_meas_conf_enum = {
>  };
>
>  static const struct iio_chan_spec_ext_info hmc5843_ext_info[] = {
> -       IIO_ENUM("meas_conf", true, &hmc5843_meas_conf_enum),
> +       IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5843_meas_conf_enum),
>         IIO_ENUM_AVAILABLE("meas_conf", &hmc5843_meas_conf_enum),
>         IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
>         { }
> @@ -259,7 +259,7 @@ static const struct iio_enum hmc5983_meas_conf_enum = {
>  };
>
>  static const struct iio_chan_spec_ext_info hmc5983_ext_info[] = {
> -       IIO_ENUM("meas_conf", true, &hmc5983_meas_conf_enum),
> +       IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5983_meas_conf_enum),
>         IIO_ENUM_AVAILABLE("meas_conf", &hmc5983_meas_conf_enum),
>         IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
>         { }
> --
> 2.28.0
>
Jonathan Cameron Sept. 19, 2020, 12:10 p.m. UTC | #3
On Fri, 18 Sep 2020 12:15:20 -0700
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> On Sun, Sep 13, 2020 at 4:27 AM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > So it's obvious that the code is wrong in passing true, but I'm assuming
> > that will actually evaluate to 1 and hence IIO_SHARED_BY_TYPE.
> > The documentation however has this attribute as IIO_SHARED_BY_ALL.
> > My current assumption is the documentation is wrong.
> > If anyone knows otherwise please shout out!
> >  
> 
> Yeah this is much easier to understand than the odd boolean value.
> 
> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
> 
Thanks all.

Applied to the togreg branch of iio.git. I've not marked it for
stable as it has no functional affect.

Jonathan

> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Fixes: 7247645f6865 ("iio: hmc5843: Move hmc5843 out of staging")
> > Cc: H. Nikolaus Schaller <hns@goldelico.com>
> > ---
> >  drivers/iio/magnetometer/hmc5843_core.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/magnetometer/hmc5843_core.c b/drivers/iio/magnetometer/hmc5843_core.c
> > index 1474ba63babe..780faea61d82 100644
> > --- a/drivers/iio/magnetometer/hmc5843_core.c
> > +++ b/drivers/iio/magnetometer/hmc5843_core.c
> > @@ -245,7 +245,7 @@ static const struct iio_enum hmc5843_meas_conf_enum = {
> >  };
> >
> >  static const struct iio_chan_spec_ext_info hmc5843_ext_info[] = {
> > -       IIO_ENUM("meas_conf", true, &hmc5843_meas_conf_enum),
> > +       IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5843_meas_conf_enum),
> >         IIO_ENUM_AVAILABLE("meas_conf", &hmc5843_meas_conf_enum),
> >         IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
> >         { }
> > @@ -259,7 +259,7 @@ static const struct iio_enum hmc5983_meas_conf_enum = {
> >  };
> >
> >  static const struct iio_chan_spec_ext_info hmc5983_ext_info[] = {
> > -       IIO_ENUM("meas_conf", true, &hmc5983_meas_conf_enum),
> > +       IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5983_meas_conf_enum),
> >         IIO_ENUM_AVAILABLE("meas_conf", &hmc5983_meas_conf_enum),
> >         IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
> >         { }
> > --
> > 2.28.0
> >
H. Nikolaus Schaller Sept. 20, 2020, 5:12 p.m. UTC | #4
> Am 13.09.2020 um 13:25 schrieb Jonathan Cameron <jic23@kernel.org>:
> 
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> So it's obvious that the code is wrong in passing true, but I'm assuming
> that will actually evaluate to 1 and hence IIO_SHARED_BY_TYPE.
> The documentation however has this attribute as IIO_SHARED_BY_ALL.
> My current assumption is the documentation is wrong.
> If anyone knows otherwise please shout out!
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Fixes: 7247645f6865 ("iio: hmc5843: Move hmc5843 out of staging")
> Cc: H. Nikolaus Schaller <hns@goldelico.com>

Tested-by: H. Nikolaus Schaller <hns@goldelico.com>

on GTA04 (omap3-gta04.dtsi).

> ---
> drivers/iio/magnetometer/hmc5843_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/magnetometer/hmc5843_core.c b/drivers/iio/magnetometer/hmc5843_core.c
> index 1474ba63babe..780faea61d82 100644
> --- a/drivers/iio/magnetometer/hmc5843_core.c
> +++ b/drivers/iio/magnetometer/hmc5843_core.c
> @@ -245,7 +245,7 @@ static const struct iio_enum hmc5843_meas_conf_enum = {
> };
> 
> static const struct iio_chan_spec_ext_info hmc5843_ext_info[] = {
> -	IIO_ENUM("meas_conf", true, &hmc5843_meas_conf_enum),
> +	IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5843_meas_conf_enum),
> 	IIO_ENUM_AVAILABLE("meas_conf", &hmc5843_meas_conf_enum),
> 	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
> 	{ }
> @@ -259,7 +259,7 @@ static const struct iio_enum hmc5983_meas_conf_enum = {
> };
> 
> static const struct iio_chan_spec_ext_info hmc5983_ext_info[] = {
> -	IIO_ENUM("meas_conf", true, &hmc5983_meas_conf_enum),
> +	IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5983_meas_conf_enum),
> 	IIO_ENUM_AVAILABLE("meas_conf", &hmc5983_meas_conf_enum),
> 	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
> 	{ }
> -- 
> 2.28.0
>
Jonathan Cameron Sept. 21, 2020, 6:06 p.m. UTC | #5
On Sun, 20 Sep 2020 19:12:47 +0200
"H. Nikolaus Schaller" <hns@goldelico.com> wrote:

> > Am 13.09.2020 um 13:25 schrieb Jonathan Cameron <jic23@kernel.org>:
> > 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > So it's obvious that the code is wrong in passing true, but I'm assuming
> > that will actually evaluate to 1 and hence IIO_SHARED_BY_TYPE.
> > The documentation however has this attribute as IIO_SHARED_BY_ALL.
> > My current assumption is the documentation is wrong.
> > If anyone knows otherwise please shout out!
> > 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Fixes: 7247645f6865 ("iio: hmc5843: Move hmc5843 out of staging")
> > Cc: H. Nikolaus Schaller <hns@goldelico.com>  
> 
> Tested-by: H. Nikolaus Schaller <hns@goldelico.com>
> 
> on GTA04 (omap3-gta04.dtsi).
Thanks, that's great.  Added the tag and re-pushed as testing for the
autobuilders to work their magic.

Thanks,

Jonathan

> 
> > ---
> > drivers/iio/magnetometer/hmc5843_core.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/magnetometer/hmc5843_core.c b/drivers/iio/magnetometer/hmc5843_core.c
> > index 1474ba63babe..780faea61d82 100644
> > --- a/drivers/iio/magnetometer/hmc5843_core.c
> > +++ b/drivers/iio/magnetometer/hmc5843_core.c
> > @@ -245,7 +245,7 @@ static const struct iio_enum hmc5843_meas_conf_enum = {
> > };
> > 
> > static const struct iio_chan_spec_ext_info hmc5843_ext_info[] = {
> > -	IIO_ENUM("meas_conf", true, &hmc5843_meas_conf_enum),
> > +	IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5843_meas_conf_enum),
> > 	IIO_ENUM_AVAILABLE("meas_conf", &hmc5843_meas_conf_enum),
> > 	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
> > 	{ }
> > @@ -259,7 +259,7 @@ static const struct iio_enum hmc5983_meas_conf_enum = {
> > };
> > 
> > static const struct iio_chan_spec_ext_info hmc5983_ext_info[] = {
> > -	IIO_ENUM("meas_conf", true, &hmc5983_meas_conf_enum),
> > +	IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5983_meas_conf_enum),
> > 	IIO_ENUM_AVAILABLE("meas_conf", &hmc5983_meas_conf_enum),
> > 	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
> > 	{ }
> > -- 
> > 2.28.0
> >   
>
diff mbox series

Patch

diff --git a/drivers/iio/magnetometer/hmc5843_core.c b/drivers/iio/magnetometer/hmc5843_core.c
index 1474ba63babe..780faea61d82 100644
--- a/drivers/iio/magnetometer/hmc5843_core.c
+++ b/drivers/iio/magnetometer/hmc5843_core.c
@@ -245,7 +245,7 @@  static const struct iio_enum hmc5843_meas_conf_enum = {
 };
 
 static const struct iio_chan_spec_ext_info hmc5843_ext_info[] = {
-	IIO_ENUM("meas_conf", true, &hmc5843_meas_conf_enum),
+	IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5843_meas_conf_enum),
 	IIO_ENUM_AVAILABLE("meas_conf", &hmc5843_meas_conf_enum),
 	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
 	{ }
@@ -259,7 +259,7 @@  static const struct iio_enum hmc5983_meas_conf_enum = {
 };
 
 static const struct iio_chan_spec_ext_info hmc5983_ext_info[] = {
-	IIO_ENUM("meas_conf", true, &hmc5983_meas_conf_enum),
+	IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5983_meas_conf_enum),
 	IIO_ENUM_AVAILABLE("meas_conf", &hmc5983_meas_conf_enum),
 	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
 	{ }