Commit 4bf81727 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Greg Kroah-Hartman

staging: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. Also this will eventually free up the drvdata pointer of the device
for driver specific data.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Acked-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 70b3fd34
...@@ -60,7 +60,7 @@ struct bfin_tmr_state { ...@@ -60,7 +60,7 @@ struct bfin_tmr_state {
static ssize_t iio_bfin_tmr_frequency_store(struct device *dev, static ssize_t iio_bfin_tmr_frequency_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
struct iio_trigger *trig = dev_get_drvdata(dev); struct iio_trigger *trig = to_iio_trigger(dev);
struct bfin_tmr_state *st = trig->private_data; struct bfin_tmr_state *st = trig->private_data;
long val; long val;
int ret; int ret;
...@@ -97,7 +97,7 @@ static ssize_t iio_bfin_tmr_frequency_show(struct device *dev, ...@@ -97,7 +97,7 @@ static ssize_t iio_bfin_tmr_frequency_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_trigger *trig = dev_get_drvdata(dev); struct iio_trigger *trig = to_iio_trigger(dev);
struct bfin_tmr_state *st = trig->private_data; struct bfin_tmr_state *st = trig->private_data;
return sprintf(buf, "%lu\n", return sprintf(buf, "%lu\n",
......
...@@ -41,7 +41,7 @@ static ssize_t iio_trig_periodic_read_freq(struct device *dev, ...@@ -41,7 +41,7 @@ static ssize_t iio_trig_periodic_read_freq(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_trigger *trig = dev_get_drvdata(dev); struct iio_trigger *trig = to_iio_trigger(dev);
struct iio_prtc_trigger_info *trig_info = trig->private_data; struct iio_prtc_trigger_info *trig_info = trig->private_data;
return sprintf(buf, "%u\n", trig_info->frequency); return sprintf(buf, "%u\n", trig_info->frequency);
} }
...@@ -51,7 +51,7 @@ static ssize_t iio_trig_periodic_write_freq(struct device *dev, ...@@ -51,7 +51,7 @@ static ssize_t iio_trig_periodic_write_freq(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_trigger *trig = dev_get_drvdata(dev); struct iio_trigger *trig = to_iio_trigger(dev);
struct iio_prtc_trigger_info *trig_info = trig->private_data; struct iio_prtc_trigger_info *trig_info = trig->private_data;
unsigned long val; unsigned long val;
int ret; int ret;
......
...@@ -92,7 +92,7 @@ static struct device iio_sysfs_trig_dev = { ...@@ -92,7 +92,7 @@ static struct device iio_sysfs_trig_dev = {
static ssize_t iio_sysfs_trigger_poll(struct device *dev, static ssize_t iio_sysfs_trigger_poll(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
struct iio_trigger *trig = dev_get_drvdata(dev); struct iio_trigger *trig = to_iio_trigger(dev);
iio_trigger_poll_chained(trig, 0); iio_trigger_poll_chained(trig, 0);
return count; return count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment