From: Jonathan Cameron Date: Thu, 7 Oct 2010 12:10:21 +0000 (+0100) Subject: staging: iio: max1363 fix bug due to scan_element directory move. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a7861ff082fe75fd7d7fd22c87c37c8425674ae2;p=linux-beck.git 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: Michael Hennerich Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c index 06c602467c6e..dde097afb430 100644 --- a/drivers/staging/iio/adc/max1363_core.c +++ b/drivers/staging/iio/adc/max1363_core.c @@ -151,7 +151,8 @@ static ssize_t max1363_show_precision_u(struct device *dev, struct device_attribute *attr, 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); 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, struct device_attribute *attr, 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); return sprintf(buf, "s%d/16\n", st->chip_info->bits); }