From: Alison Schofield Date: Sun, 15 Jan 2017 03:52:50 +0000 (-0800) Subject: iio: health: afe4404: retrieve a valid iio_dev in suspend/resume X-Git-Tag: v4.14-rc1~1455^2~94^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=802ecfc113df1e15af1d028427cbbe785ae9cc4a;p=platform%2Fkernel%2Flinux-rpi.git iio: health: afe4404: retrieve a valid iio_dev in suspend/resume The suspend/resume functions were using dev_to_iio_dev() to get the iio_dev. That only works on IIO dev's. Replace it with i2c functions to get the correct iio_dev. Signed-off-by: Alison Schofield Acked-by: Andrew F. Davis Cc: Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c index 45266404..964f523 100644 --- a/drivers/iio/health/afe4404.c +++ b/drivers/iio/health/afe4404.c @@ -428,7 +428,7 @@ MODULE_DEVICE_TABLE(of, afe4404_of_match); static int __maybe_unused afe4404_suspend(struct device *dev) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct afe4404_data *afe = iio_priv(indio_dev); int ret; @@ -449,7 +449,7 @@ static int __maybe_unused afe4404_suspend(struct device *dev) static int __maybe_unused afe4404_resume(struct device *dev) { - struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct afe4404_data *afe = iio_priv(indio_dev); int ret;