summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Paulo Gonçalves <joao.goncalves@toradex.com>2024-06-14 17:36:58 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-06-17 22:49:02 +0300
commit74cb21576ea5247efbbb7d92f71cafee12159cd9 (patch)
tree36b6cf982b48177f2169ba8477d9afb2152ee25a
parent8fe050e94daeb0280338d04ff8c6207dea44ddfc (diff)
downloadlinux-74cb21576ea5247efbbb7d92f71cafee12159cd9.tar.xz
iio: trigger: Fix condition for own trigger
The condition for checking if triggers belong to the same IIO device to set attached_own_device is currently inverted, causing iio_trigger_using_own() to return an incorrect value. Fix it by testing for the correct return value of iio_validate_own_trigger(). Cc: stable@vger.kernel.org Fixes: 517985ebc531 ("iio: trigger: Add simple trigger_validation helper") Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://lore.kernel.org/r/20240614143658.3531097-1-jpaulo.silvagoncalves@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/industrialio-trigger.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index 16de57846bd9..2e84776f4fbd 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -315,7 +315,7 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig,
* this is the case if the IIO device and the trigger device share the
* same parent device.
*/
- if (iio_validate_own_trigger(pf->indio_dev, trig))
+ if (!iio_validate_own_trigger(pf->indio_dev, trig))
trig->attached_own_device = true;
return ret;