aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/iio/industrialio-core.c4
-rw-r--r--include/linux/iio/iio.h6
2 files changed, 8 insertions, 2 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 15c86a8cd704..17ec4cee51dc 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -1423,7 +1423,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)
1423static void iio_dev_release(struct device *device) 1423static void iio_dev_release(struct device *device)
1424{ 1424{
1425 struct iio_dev *indio_dev = dev_to_iio_dev(device); 1425 struct iio_dev *indio_dev = dev_to_iio_dev(device);
1426 if (indio_dev->modes & (INDIO_BUFFER_TRIGGERED | INDIO_EVENT_TRIGGERED)) 1426 if (indio_dev->modes & INDIO_ALL_TRIGGERED_MODES)
1427 iio_device_unregister_trigger_consumer(indio_dev); 1427 iio_device_unregister_trigger_consumer(indio_dev);
1428 iio_device_unregister_eventset(indio_dev); 1428 iio_device_unregister_eventset(indio_dev);
1429 iio_device_unregister_sysfs(indio_dev); 1429 iio_device_unregister_sysfs(indio_dev);
@@ -1705,7 +1705,7 @@ int iio_device_register(struct iio_dev *indio_dev)
1705 "Failed to register event set\n"); 1705 "Failed to register event set\n");
1706 goto error_free_sysfs; 1706 goto error_free_sysfs;
1707 } 1707 }
1708 if (indio_dev->modes & (INDIO_BUFFER_TRIGGERED | INDIO_EVENT_TRIGGERED)) 1708 if (indio_dev->modes & INDIO_ALL_TRIGGERED_MODES)
1709 iio_device_register_trigger_consumer(indio_dev); 1709 iio_device_register_trigger_consumer(indio_dev);
1710 1710
1711 if ((indio_dev->modes & INDIO_ALL_BUFFER_MODES) && 1711 if ((indio_dev->modes & INDIO_ALL_BUFFER_MODES) &&
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 3f5ea2e9a39e..d68bec297a45 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -352,10 +352,16 @@ unsigned int iio_get_time_res(const struct iio_dev *indio_dev);
352#define INDIO_BUFFER_SOFTWARE 0x04 352#define INDIO_BUFFER_SOFTWARE 0x04
353#define INDIO_BUFFER_HARDWARE 0x08 353#define INDIO_BUFFER_HARDWARE 0x08
354#define INDIO_EVENT_TRIGGERED 0x10 354#define INDIO_EVENT_TRIGGERED 0x10
355#define INDIO_HARDWARE_TRIGGERED 0x20
355 356
356#define INDIO_ALL_BUFFER_MODES \ 357#define INDIO_ALL_BUFFER_MODES \
357 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE) 358 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE)
358 359
360#define INDIO_ALL_TRIGGERED_MODES \
361 (INDIO_BUFFER_TRIGGERED \
362 | INDIO_EVENT_TRIGGERED \
363 | INDIO_HARDWARE_TRIGGERED)
364
359#define INDIO_MAX_RAW_ELEMENTS 4 365#define INDIO_MAX_RAW_ELEMENTS 4
360 366
361struct iio_trigger; /* forward declaration */ 367struct iio_trigger; /* forward declaration */