]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
regmap: Keep regmap_write_bits()
authorMark Brown <broonie@kernel.org>
Mon, 29 Feb 2016 13:58:33 +0000 (22:58 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 29 Feb 2016 13:58:33 +0000 (22:58 +0900)
It turns out we do have a MFD driver using this.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap.c
include/linux/regmap.h

index 3fb04c36ae5e1cdbf9461c6b5c40f487a7fa9a22..c7d4a636778dd4bb03d1a77fcc0c8954f4264bcd 100644 (file)
@@ -2650,6 +2650,29 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 }
 EXPORT_SYMBOL_GPL(regmap_update_bits_base);
 
+/**
+ * regmap_write_bits: Perform a read/modify/write cycle on the register map
+ *
+ * @map: Register map to update
+ * @reg: Register to update
+ * @mask: Bitmask to change
+ * @val: New value for bitmask
+ *
+ * Returns zero for success, a negative number on error.
+ */
+int regmap_write_bits(struct regmap *map, unsigned int reg,
+                     unsigned int mask, unsigned int val)
+{
+       int ret;
+
+       map->lock(map->lock_arg);
+       ret = _regmap_update_bits(map, reg, mask, val, NULL, true);
+       map->unlock(map->lock_arg);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regmap_write_bits);
+
 void regmap_async_complete_cb(struct regmap_async *async, int ret)
 {
        struct regmap *map = async->map;
index 5315ff0adb855c515c9c40605bbfa91c5a2da78d..e0960b3ff29068b9a434e6527c3c71e71fb7ad91 100644 (file)
@@ -721,6 +721,8 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
 int regmap_update_bits_base(struct regmap *map, unsigned int reg,
                            unsigned int mask, unsigned int val,
                            bool *change, bool async, bool force);
+int regmap_write_bits(struct regmap *map, unsigned int reg,
+                      unsigned int mask, unsigned int val);
 int regmap_get_val_bytes(struct regmap *map);
 int regmap_get_max_register(struct regmap *map);
 int regmap_get_reg_stride(struct regmap *map);
@@ -959,6 +961,13 @@ static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg,
        return -EINVAL;
 }
 
+static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
+                                    unsigned int mask, unsigned int val)
+{
+       WARN_ONCE(1, "regmap API is disabled");
+       return -EINVAL;
+}
+
 static inline int regmap_field_update_bits_base(struct regmap_field *field,
                                        unsigned int mask, unsigned int val,
                                        bool *change, bool async, bool force)