summary refs log tree commit diff
path: root/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2021-03-09 11:36:13 -0800
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-03-25 19:13:50 +0000
commit995071d36bb9804b644265450142fcb91c427ee8 (patch)
treeebe33a3eebf243584b57f7e584b874e6815112d8 /drivers/iio/common/hid-sensors/hid-sensor-trigger.c
parent7b8d045e497a04dd88546da51f34fa3b102778d2 (diff)
downloadlinux-995071d36bb9804b644265450142fcb91c427ee8.tar.gz
iio: set default trig->dev.parent
When allocated with [devm_]iio_trigger_alloc(), set trig device parent to
the device the trigger is allocated for by default.

It can always be reassigned in the probe routine.

Change iio_trigger_alloc() API to add the device pointer to be coherent
with devm_iio_trigger_alloc, using similar interface to
iio_device_alloc().

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-2-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/common/hid-sensors/hid-sensor-trigger.c')
-rw-r--r--drivers/iio/common/hid-sensors/hid-sensor-trigger.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index 064c32bec9c7..95ddccb44f1c 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -255,14 +255,14 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name,
 		return ret;
 	}
 
-	trig = iio_trigger_alloc("%s-dev%d", name, indio_dev->id);
+	trig = iio_trigger_alloc(indio_dev->dev.parent,
+				 "%s-dev%d", name, indio_dev->id);
 	if (trig == NULL) {
 		dev_err(&indio_dev->dev, "Trigger Allocate Failed\n");
 		ret = -ENOMEM;
 		goto error_triggered_buffer_cleanup;
 	}
 
-	trig->dev.parent = indio_dev->dev.parent;
 	iio_trigger_set_drvdata(trig, attrb);
 	trig->ops = &hid_sensor_trigger_ops;
 	ret = iio_trigger_register(trig);