On 25/05/16 08:40, Linus Walleij wrote: > The code in runtime_[suspend|resume] was assuming that the > i2c client data was the bh1780 state container, but it contains > the IIO device. So first dereference the IIO device from the > i2c client, then get the state container using the iio_priv() > call. > > Fixes: 1f0477f18306 ("iio: light: new driver for the ROHM BH1780") > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Applied to the fixes-togreg-post-rc1 branch of iio.git and marked for stable. Thanks, Jonathan > --- > I have no idea how this screwed up in the submission, but I > guess I managed to test it with CONFIG_PM disabled or something. > Sorry! meh, happens to us all from time to time ;) > --- > drivers/iio/light/bh1780.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c > index f83595334ff1..5fd432df2c8f 100644 > --- a/drivers/iio/light/bh1780.c > +++ b/drivers/iio/light/bh1780.c > @@ -226,7 +226,8 @@ static int bh1780_remove(struct i2c_client *client) > static int bh1780_runtime_suspend(struct device *dev) > { > struct i2c_client *client = to_i2c_client(dev); > - struct bh1780_data *bh1780 = i2c_get_clientdata(client); > + struct iio_dev *indio_dev = i2c_get_clientdata(client); > + struct bh1780_data *bh1780 = iio_priv(indio_dev); > int ret; > > ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_POFF); > @@ -241,7 +242,8 @@ static int bh1780_runtime_suspend(struct device *dev) > static int bh1780_runtime_resume(struct device *dev) > { > struct i2c_client *client = to_i2c_client(dev); > - struct bh1780_data *bh1780 = i2c_get_clientdata(client); > + struct iio_dev *indio_dev = i2c_get_clientdata(client); > + struct bh1780_data *bh1780 = iio_priv(indio_dev); > int ret; > > ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_PON); > -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html