iio: light: rpr0521 disable sensor -bugfix
authorMikko Koivunen <mikko.koivunen@fi.rohmeurope.com>
Thu, 18 May 2017 12:12:49 +0000 (15:12 +0300)
committerJonathan Cameron <jic23@kernel.org>
Sun, 21 May 2017 14:06:10 +0000 (15:06 +0100)
Sensor was marked enabled on each call even if the call was for disabling
sensor.

Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com>
Acked-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/light/rpr0521.c

index 7de0f397194b0b858bfe229cb88d47a45d87b979..03504f6ecd3b0639338ae69d76fcef9400723497 100644 (file)
@@ -197,7 +197,10 @@ static int rpr0521_als_enable(struct rpr0521_data *data, u8 status)
        if (ret < 0)
                return ret;
 
-       data->als_dev_en = true;
+       if (status & RPR0521_MODE_ALS_MASK)
+               data->als_dev_en = true;
+       else
+               data->als_dev_en = false;
 
        return 0;
 }
@@ -212,7 +215,10 @@ static int rpr0521_pxs_enable(struct rpr0521_data *data, u8 status)
        if (ret < 0)
                return ret;
 
-       data->pxs_dev_en = true;
+       if (status & RPR0521_MODE_PXS_MASK)
+               data->pxs_dev_en = true;
+       else
+               data->pxs_dev_en = false;
 
        return 0;
 }