iio: magnetometer: ak8974: mark INT_CLEAR as precious
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Thu, 17 Aug 2017 13:56:11 +0000 (15:56 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 20 Aug 2017 14:17:39 +0000 (15:17 +0100)
Reading INT_CLEAR has side effects - disallow reading it via debugfs.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/magnetometer/ak8974.c

index b1c209faf1b12c640eac746ec49fef2560826df9..866f20b818b182d83123dd7830d1ca1853dab42f 100644 (file)
@@ -661,11 +661,17 @@ static bool ak8974_writeable_reg(struct device *dev, unsigned int reg)
        }
 }
 
+static bool ak8974_precious_reg(struct device *dev, unsigned int reg)
+{
+       return reg == AK8974_INT_CLEAR;
+}
+
 static const struct regmap_config ak8974_regmap_config = {
        .reg_bits = 8,
        .val_bits = 8,
        .max_register = 0xff,
        .writeable_reg = ak8974_writeable_reg,
+       .precious_reg = ak8974_precious_reg,
 };
 
 static int ak8974_probe(struct i2c_client *i2c,