Commit a7861ff0 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging: iio: max1363 fix bug due to scan_element directory move.

    The device found passed to the attr functions is that of the ring
    buffer, not the the iio_dev so we need to bounce through one more
    hop to get the right address.
Reported-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7aa3baeb
...@@ -151,7 +151,8 @@ static ssize_t max1363_show_precision_u(struct device *dev, ...@@ -151,7 +151,8 @@ static ssize_t max1363_show_precision_u(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_ring_buffer *ring = dev_get_drvdata(dev);
struct iio_dev *dev_info = ring->indio_dev;
struct max1363_state *st = iio_dev_get_devdata(dev_info); struct max1363_state *st = iio_dev_get_devdata(dev_info);
return sprintf(buf, "u%d/16\n", st->chip_info->bits); return sprintf(buf, "u%d/16\n", st->chip_info->bits);
} }
...@@ -160,7 +161,8 @@ static ssize_t max1363_show_precision_s(struct device *dev, ...@@ -160,7 +161,8 @@ static ssize_t max1363_show_precision_s(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_ring_buffer *ring = dev_get_drvdata(dev);
struct iio_dev *dev_info = ring->indio_dev;
struct max1363_state *st = iio_dev_get_devdata(dev_info); struct max1363_state *st = iio_dev_get_devdata(dev_info);
return sprintf(buf, "s%d/16\n", st->chip_info->bits); return sprintf(buf, "s%d/16\n", st->chip_info->bits);
} }
......
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