diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-06-21 13:11:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-23 00:08:11 -0400 |
commit | 971ff1db41b0f16f34cfdeb9e0460d7dc598e68e (patch) | |
tree | 34b0506cdead14e3002b70ef0029b9facb3729ef /drivers/iio/industrialio-trigger.c | |
parent | 4bf8172772254a38741de139a355e36eabbb5cb8 (diff) |
iio:trigger: Use to_iio_trigger() instead of dev_get_drvdata()
Use to_iio_trigger(dev) instead of dev_get_drvdata(dev). Both will return the
trigger which belongs to the device, but the the first on is a bit more
lightweight.
Since this is the last location where we used dev_get_drvdata() for retrieving
the trigger there is no need anymore to assign the the trigger to the devices
drvdata, so we can remove that as well.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/industrialio-trigger.c')
-rw-r--r-- | drivers/iio/industrialio-trigger.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index 0f582df75a19..ec653fb51d0b 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c | |||
@@ -45,7 +45,7 @@ static ssize_t iio_trigger_read_name(struct device *dev, | |||
45 | struct device_attribute *attr, | 45 | struct device_attribute *attr, |
46 | char *buf) | 46 | char *buf) |
47 | { | 47 | { |
48 | struct iio_trigger *trig = dev_get_drvdata(dev); | 48 | struct iio_trigger *trig = to_iio_trigger(dev); |
49 | return sprintf(buf, "%s\n", trig->name); | 49 | return sprintf(buf, "%s\n", trig->name); |
50 | } | 50 | } |
51 | 51 | ||
@@ -436,7 +436,6 @@ struct iio_trigger *iio_trigger_alloc(const char *fmt, ...) | |||
436 | trig->dev.type = &iio_trig_type; | 436 | trig->dev.type = &iio_trig_type; |
437 | trig->dev.bus = &iio_bus_type; | 437 | trig->dev.bus = &iio_bus_type; |
438 | device_initialize(&trig->dev); | 438 | device_initialize(&trig->dev); |
439 | dev_set_drvdata(&trig->dev, (void *)trig); | ||
440 | 439 | ||
441 | mutex_init(&trig->pool_lock); | 440 | mutex_init(&trig->pool_lock); |
442 | trig->subirq_base | 441 | trig->subirq_base |