iio:trigger: Introduce iio_tigger_{set,get}_drvdata
Introduce iio_tigger_{set,get}_drvdata which allows to attach driver specific
data to a trigger. The functions wrap access to the triggers private_data field
and all current users are updated to use iio_tigger_{set,get}_drvdata instead of
directly accessing the private_data field. This is the first step towards
removing the private_data field from the iio_trigger struct.
The following coccinelle script has been used to update the drivers:
<smpl>
@@
struct iio_trigger *trigger;
expression priv;
@@
-trigger->private_data = priv
+iio_trigger_set_drv_data(trigger, priv)
@@
struct iio_trigger *trigger;
@@
-trigger->private_data
+iio_trigger_get_drv_data(trigger)
</smpl>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
committed by
Jonathan Cameron
parent
c5cf4606b6
commit
1e9663c62b
@@ -31,7 +31,7 @@
|
||||
static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
|
||||
bool state)
|
||||
{
|
||||
struct hid_sensor_common *st = trig->private_data;
|
||||
struct hid_sensor_common *st = iio_trigger_get_drvdata(trig);
|
||||
int state_val;
|
||||
|
||||
state_val = state ? 1 : 0;
|
||||
@@ -76,7 +76,7 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name,
|
||||
}
|
||||
|
||||
trig->dev.parent = indio_dev->dev.parent;
|
||||
trig->private_data = attrb;
|
||||
iio_trigger_set_drvdata(trig, attrb);
|
||||
trig->ops = &hid_sensor_trigger_ops;
|
||||
ret = iio_trigger_register(trig);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user