Skip to content

Commit

Permalink
iio:trigger: Use to_iio_trigger() instead of dev_get_drvdata()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars-Peter Clausen authored and Greg Kroah-Hartman committed Jun 23, 2012
1 parent 4bf8172 commit 971ff1d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/iio/industrialio-trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static ssize_t iio_trigger_read_name(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct iio_trigger *trig = dev_get_drvdata(dev);
struct iio_trigger *trig = to_iio_trigger(dev);
return sprintf(buf, "%s\n", trig->name);
}

Expand Down Expand Up @@ -436,7 +436,6 @@ struct iio_trigger *iio_trigger_alloc(const char *fmt, ...)
trig->dev.type = &iio_trig_type;
trig->dev.bus = &iio_bus_type;
device_initialize(&trig->dev);
dev_set_drvdata(&trig->dev, (void *)trig);

mutex_init(&trig->pool_lock);
trig->subirq_base
Expand Down

0 comments on commit 971ff1d

Please sign in to comment.