Skip to contentSkip to conversation

iio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled()

PATCH In review David Lechner 3 participants 3 messages Jan 8, 2024 – Jan 13, 2024 IIO

lore
Share & tools
lore

David Lechner

author reviewer
#0 lore raw

PATCH 1/1 iio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled()

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.

---
 drivers/iio/industrialio-core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/industrialio-core.c +1 -3
index c77745b594bd..8855d377d710 100644
@@ -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);
 
Signature · 1 line
2.43.0
Reviewed-by Nuno Sa on v1 1/1
#1 lore raw
Quoted 8 lines · David Lechner

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.

---

LGTM,

Quoted 18 lines

 drivers/iio/industrialio-core.c | 4 +---

 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/industrialio-core.c +0 -0
index c77745b594bd..8855d377d710 100644
@@ -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);

drivers/iio/industrialio-core.c +1 -3
-	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);

maintainer
#2 lore raw
Quoted 4 lines · On Tue, 09 Jan 2024 15:07:57 +0100 Nuno Sá <[email protected]> wrote:
Quoted 3 lines · David Lechner

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

Quoted 8 lines
Quoted 5 lines

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

---

LGTM,

Applied to the togreg branch of iio.git and pushed out as testing for all the normal reasons.

Quoted 20 lines
Quoted 19 lines

 drivers/iio/industrialio-core.c | 4 +---

 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/industrialio-core.c +0 -0
index c77745b594bd..8855d377d710 100644
@@ -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);

drivers/iio/industrialio-core.c +1 -3
-	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);