|
@@ -717,6 +717,27 @@ bool iio_trigger_using_own(struct iio_dev *indio_dev)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(iio_trigger_using_own);
|
|
EXPORT_SYMBOL(iio_trigger_using_own);
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * iio_trigger_validate_own_device - Check if a trigger and IIO device belong to
|
|
|
|
+ * the same device
|
|
|
|
+ * @trig: The IIO trigger to check
|
|
|
|
+ * @indio_dev: the IIO device to check
|
|
|
|
+ *
|
|
|
|
+ * This function can be used as the validate_device callback for triggers that
|
|
|
|
+ * can only be attached to their own device.
|
|
|
|
+ *
|
|
|
|
+ * Return: 0 if both the trigger and the IIO device belong to the same
|
|
|
|
+ * device, -EINVAL otherwise.
|
|
|
|
+ */
|
|
|
|
+int iio_trigger_validate_own_device(struct iio_trigger *trig,
|
|
|
|
+ struct iio_dev *indio_dev)
|
|
|
|
+{
|
|
|
|
+ if (indio_dev->dev.parent != trig->dev.parent)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(iio_trigger_validate_own_device);
|
|
|
|
+
|
|
void iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
|
|
void iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
|
|
{
|
|
{
|
|
indio_dev->groups[indio_dev->groupcounter++] =
|
|
indio_dev->groups[indio_dev->groupcounter++] =
|