Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled()
@ 2024-01-08 20:06 David Lechner
  2024-01-09 14:07 ` Nuno Sá
  0 siblings, 1 reply; 3+ messages in thread
From: David Lechner @ 2024-01-08 20:06 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: David Lechner, linux-iio, linux-kernel

This replaces use of individual buffer mode flags with
INDIO_ALL_BUFFER_MODES in the iio_buffer_enabled() function.

This simplifies the code and makes it robust in case of the addition of
new buffer modes.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/industrialio-core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index c77745b594bd..8855d377d710 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -210,9 +210,7 @@ bool iio_buffer_enabled(struct iio_dev *indio_dev)
 {
 	struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
 
-	return iio_dev_opaque->currentmode &
-	       (INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE |
-		INDIO_BUFFER_TRIGGERED);
+	return iio_dev_opaque->currentmode & INDIO_ALL_BUFFER_MODES;
 }
 EXPORT_SYMBOL_GPL(iio_buffer_enabled);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled()
  2024-01-08 20:06 [PATCH] iio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled() David Lechner
@ 2024-01-09 14:07 ` Nuno Sá
  2024-01-13 15:26   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Nuno Sá @ 2024-01-09 14:07 UTC (permalink / raw)
  To: David Lechner, Jonathan Cameron; +Cc: linux-iio, linux-kernel

On Mon, 2024-01-08 at 14:06 -0600, David Lechner wrote:
> This replaces use of individual buffer mode flags with
> INDIO_ALL_BUFFER_MODES in the iio_buffer_enabled() function.
> 
> This simplifies the code and makes it robust in case of the addition of
> new buffer modes.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---

LGTM,
Reviewed-by: Nuno Sa <nuno.sa@analog.com>

>  drivers/iio/industrialio-core.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index c77745b594bd..8855d377d710 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -210,9 +210,7 @@ bool iio_buffer_enabled(struct iio_dev *indio_dev)
>  {
>  	struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
>  
> -	return iio_dev_opaque->currentmode &
> -	       (INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE |
> -		INDIO_BUFFER_TRIGGERED);
> +	return iio_dev_opaque->currentmode & INDIO_ALL_BUFFER_MODES;
>  }
>  EXPORT_SYMBOL_GPL(iio_buffer_enabled);
>  


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled()
  2024-01-09 14:07 ` Nuno Sá
@ 2024-01-13 15:26   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2024-01-13 15:26 UTC (permalink / raw)
  To: Nuno Sá; +Cc: David Lechner, linux-iio, linux-kernel

On Tue, 09 Jan 2024 15:07:57 +0100
Nuno Sá <noname.nuno@gmail.com> wrote:

> On Mon, 2024-01-08 at 14:06 -0600, David Lechner wrote:
> > This replaces use of individual buffer mode flags with
> > INDIO_ALL_BUFFER_MODES in the iio_buffer_enabled() function.
> > 
> > This simplifies the code and makes it robust in case of the addition of
> > new buffer modes.
> > 
> > Signed-off-by: David Lechner <dlechner@baylibre.com>
> > ---  
> 
> LGTM,
> Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Applied to the togreg branch of iio.git and pushed out as testing for all the
normal reasons.

> 
> >  drivers/iio/industrialio-core.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > index c77745b594bd..8855d377d710 100644
> > --- a/drivers/iio/industrialio-core.c
> > +++ b/drivers/iio/industrialio-core.c
> > @@ -210,9 +210,7 @@ bool iio_buffer_enabled(struct iio_dev *indio_dev)
> >  {
> >  	struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
> >  
> > -	return iio_dev_opaque->currentmode &
> > -	       (INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE |
> > -		INDIO_BUFFER_TRIGGERED);
> > +	return iio_dev_opaque->currentmode & INDIO_ALL_BUFFER_MODES;
> >  }
> >  EXPORT_SYMBOL_GPL(iio_buffer_enabled);
> >    
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-13 15:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-08 20:06 [PATCH] iio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled() David Lechner
2024-01-09 14:07 ` Nuno Sá
2024-01-13 15:26   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox