All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/15 v2][RFC] cleanup regmap write functions
@ 2016-02-15  5:20 ` Kuninori Morimoto
  0 siblings, 0 replies; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:20 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


Hi Mark

Current regmap has many similar functions
        regmap_update_bits()
        regmap_update_bits_async()
        regmap_update_bits_check()
        regmap_update_bits_check_async()
But difference is very few.
And I would like to have _force_ feature on it too.

So, these patches add new regmap_update_bits_base()
which has _check, _async, and _force option.
Above functions are now defined as macro.

I used [RFC], because regmap has big effects.

1), 6), 9) adds new regmap_xxx_update_bits_base() functions
and current each functions are merged into it by macro.

Please review carefully especially 7), 10).
I think using ~0 mask is correct for
regmap_field_write() <-> regmap_field_update_bits_base()

 1) -  5) for regmap_xxx()
 6) -  8) for regmap_field_xxx()
 9) - 11) for regmap_fields_xxx()
12) - 13) adds _force_ macro
14)       remove unused regmap_write_bits() which was one of _force_ function
15)       rsnd driver uses _force_ function for register access

BTW, I noticed #if - #else - #endif on ${LINUX}/include/linux/regmap.h are strange.
Many functions/struct/macro are defined under #ifdef CONFIG_REGMAP,
but few are defined under #else. It can be trouble ?
Do we really need this #if ?

Kuninori Morimoto (15):
       1) regmap: add regmap_update_bits_base()
       2) regmap: merge regmap_update_bits() into macro
       3) regmap: merge regmap_update_bits_async() into macro
       4) regmap: merge regmap_update_bits_check() into macro
       5) regmap: merge regmap_update_bits_check_async() into macro
       6) regmap: add regmap_field_update_bits_base()
       7) regmap: merge regmap_field_write() into macro
       8) regmap: merge regmap_field_update_bits() into macro
       9) regmap: add regmap_fields_update_bits_base()
      10) regmap: merge regmap_fields_write() into macro
      11) regmap: merge regmap_fields_update_bits() into macro
      12) regmap: add regmap_field_force_xxx() macros
      13) regmap: add regmap_fields_force_xxx() macros
      14) regmpa: remove regmap_write_bits()
      15) ASoC: rsnd: rsnd_write() / rsnd_bset() uses regmap _force_ function

 drivers/base/regmap/regmap.c | 217 ++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------
 include/linux/regmap.h       |  94 ++++++++++++++++++++++++++++-----------------------------
 sound/soc/sh/rcar/gen.c      |  21 ++-----------
 sound/soc/sh/rcar/rsnd.h     |   2 --
 4 files changed, 87 insertions(+), 247 deletions(-)



Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 0/15 v2][RFC] cleanup regmap write functions
@ 2016-02-15  5:20 ` Kuninori Morimoto
  0 siblings, 0 replies; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:20 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-ALSA, Linux-Kernel


Hi Mark

Current regmap has many similar functions
        regmap_update_bits()
        regmap_update_bits_async()
        regmap_update_bits_check()
        regmap_update_bits_check_async()
But difference is very few.
And I would like to have _force_ feature on it too.

So, these patches add new regmap_update_bits_base()
which has _check, _async, and _force option.
Above functions are now defined as macro.

I used [RFC], because regmap has big effects.

1), 6), 9) adds new regmap_xxx_update_bits_base() functions
and current each functions are merged into it by macro.

Please review carefully especially 7), 10).
I think using ~0 mask is correct for
regmap_field_write() <-> regmap_field_update_bits_base()

 1) -  5) for regmap_xxx()
 6) -  8) for regmap_field_xxx()
 9) - 11) for regmap_fields_xxx()
12) - 13) adds _force_ macro
14)       remove unused regmap_write_bits() which was one of _force_ function
15)       rsnd driver uses _force_ function for register access

BTW, I noticed #if - #else - #endif on ${LINUX}/include/linux/regmap.h are strange.
Many functions/struct/macro are defined under #ifdef CONFIG_REGMAP,
but few are defined under #else. It can be trouble ?
Do we really need this #if ?

Kuninori Morimoto (15):
       1) regmap: add regmap_update_bits_base()
       2) regmap: merge regmap_update_bits() into macro
       3) regmap: merge regmap_update_bits_async() into macro
       4) regmap: merge regmap_update_bits_check() into macro
       5) regmap: merge regmap_update_bits_check_async() into macro
       6) regmap: add regmap_field_update_bits_base()
       7) regmap: merge regmap_field_write() into macro
       8) regmap: merge regmap_field_update_bits() into macro
       9) regmap: add regmap_fields_update_bits_base()
      10) regmap: merge regmap_fields_write() into macro
      11) regmap: merge regmap_fields_update_bits() into macro
      12) regmap: add regmap_field_force_xxx() macros
      13) regmap: add regmap_fields_force_xxx() macros
      14) regmpa: remove regmap_write_bits()
      15) ASoC: rsnd: rsnd_write() / rsnd_bset() uses regmap _force_ function

 drivers/base/regmap/regmap.c | 217 ++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------
 include/linux/regmap.h       |  94 ++++++++++++++++++++++++++++-----------------------------
 sound/soc/sh/rcar/gen.c      |  21 ++-----------
 sound/soc/sh/rcar/rsnd.h     |   2 --
 4 files changed, 87 insertions(+), 247 deletions(-)



Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 01/15 v2][RFC] regmap: add regmap_update_bits_base()
  2016-02-15  5:20 ` Kuninori Morimoto
  (?)
@ 2016-02-15  5:22 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: add regmap_update_bits_base()" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:22 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch adds new regmap_update_bits_base() which is feature
merged function. Above functions can be merged into it by macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 40 ++++++++++++++++++++++++++++++++++++++++
 include/linux/regmap.h       | 11 +++++++++++
 2 files changed, 51 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ee54e84..4e35b2f 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2648,6 +2648,46 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
 }
 
 /**
+ * regmap_update_bits_base:
+ *	Perform a read/modify/write cycle on the
+ *	register map with change, async, force option
+ *
+ * @map: Register map to update
+ * @reg: Register to update
+ * @mask: Bitmask to change
+ * @val: New value for bitmask
+ * @change: Boolean indicating if a write was done
+ * @async: Boolean indicating asynchronously
+ * @force: Boolean indicating use force update
+ *
+ * if async was true,
+ * With most buses the read must be done synchronously so this is most
+ * useful for devices with a cache which do not need to interact with
+ * the hardware to determine the current register value.
+ *
+ * Returns zero for success, a negative number on error.
+ */
+int regmap_update_bits_base(struct regmap *map, unsigned int reg,
+			    unsigned int mask, unsigned int val,
+			    bool *change, bool async, bool force)
+{
+	int ret;
+
+	map->lock(map->lock_arg);
+
+	map->async = async;
+
+	ret = _regmap_update_bits(map, reg, mask, val, change, force);
+
+	map->async = false;
+
+	map->unlock(map->lock_arg);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(regmap_update_bits_base);
+
+/**
  * regmap_update_bits: Perform a read/modify/write cycle on the register map
  *
  * @map: Register map to update
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 1839434..28e50a3 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -691,6 +691,9 @@ int regmap_raw_read(struct regmap *map, unsigned int reg,
 		    void *val, size_t val_len);
 int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
 		     size_t val_count);
+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_update_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
@@ -937,6 +940,14 @@ static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
+static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg,
+					  unsigned int mask, unsigned int val,
+					  bool *change, bool async, bool force)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+	return -EINVAL;
+}
+
 static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
 				     unsigned int mask, unsigned int val)
 {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 02/15 v2][RFC] regmap: merge regmap_update_bits() into macro
  2016-02-15  5:20 ` Kuninori Morimoto
  (?)
  (?)
@ 2016-02-15  5:22 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: merge regmap_update_bits() into macro" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:22 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch merges regmap_update_bits() into macro
by using regmap_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 23 -----------------------
 include/linux/regmap.h       | 12 +++---------
 2 files changed, 3 insertions(+), 32 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 4e35b2f..281898a 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2688,29 +2688,6 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_update_bits_base);
 
 /**
- * regmap_update_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_update_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, false);
-	map->unlock(map->lock_arg);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(regmap_update_bits);
-
-/**
  * regmap_write_bits: Perform a read/modify/write cycle on the register map
  *
  * @map: Register map to update
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 28e50a3..500b36c 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -65,6 +65,9 @@ struct reg_sequence {
 	unsigned int delay_us;
 };
 
+#define	regmap_update_bits(map, reg, mask, val) \
+	regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
+
 #ifdef CONFIG_REGMAP
 
 enum regmap_endian {
@@ -694,8 +697,6 @@ 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_update_bits(struct regmap *map, unsigned int reg,
-		       unsigned int mask, unsigned int val);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
 int regmap_update_bits_async(struct regmap *map, unsigned int reg,
@@ -948,13 +949,6 @@ static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
-static inline int regmap_update_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_write_bits(struct regmap *map, unsigned int reg,
 				     unsigned int mask, unsigned int val)
 {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 03/15 v2][RFC] regmap: merge regmap_update_bits_async() into macro
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (2 preceding siblings ...)
  (?)
@ 2016-02-15  5:23 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: merge regmap_update_bits_async() into macro" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:23 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch merges regmap_update_bits_async() into macro
by using regmap_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 34 ----------------------------------
 include/linux/regmap.h       | 12 ++----------
 2 files changed, 2 insertions(+), 44 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 281898a..c2255f6 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2711,40 +2711,6 @@ int regmap_write_bits(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_write_bits);
 
 /**
- * regmap_update_bits_async: Perform a read/modify/write cycle on the register
- *                           map asynchronously
- *
- * @map: Register map to update
- * @reg: Register to update
- * @mask: Bitmask to change
- * @val: New value for bitmask
- *
- * With most buses the read must be done synchronously so this is most
- * useful for devices with a cache which do not need to interact with
- * the hardware to determine the current register value.
- *
- * Returns zero for success, a negative number on error.
- */
-int regmap_update_bits_async(struct regmap *map, unsigned int reg,
-			     unsigned int mask, unsigned int val)
-{
-	int ret;
-
-	map->lock(map->lock_arg);
-
-	map->async = true;
-
-	ret = _regmap_update_bits(map, reg, mask, val, NULL, false);
-
-	map->async = false;
-
-	map->unlock(map->lock_arg);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(regmap_update_bits_async);
-
-/**
  * regmap_update_bits_check: Perform a read/modify/write cycle on the
  *                           register map and report if updated
  *
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 500b36c..90c8b0e 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -67,6 +67,8 @@ struct reg_sequence {
 
 #define	regmap_update_bits(map, reg, mask, val) \
 	regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
+#define	regmap_update_bits_async(map, reg, mask, val)\
+	regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -699,8 +701,6 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 			    bool *change, bool async, bool force);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
-int regmap_update_bits_async(struct regmap *map, unsigned int reg,
-			     unsigned int mask, unsigned int val);
 int regmap_update_bits_check(struct regmap *map, unsigned int reg,
 			     unsigned int mask, unsigned int val,
 			     bool *change);
@@ -956,14 +956,6 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
-static inline int regmap_update_bits_async(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_update_bits_check(struct regmap *map,
 					   unsigned int reg,
 					   unsigned int mask, unsigned int val,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 04/15 v2][RFC] regmap: merge regmap_update_bits_check() into macro
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (3 preceding siblings ...)
  (?)
@ 2016-02-15  5:23 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: merge regmap_update_bits_check() into macro" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:23 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch merges regmap_update_bits_check() into macro
by using regmap_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 25 -------------------------
 include/linux/regmap.h       | 14 ++------------
 2 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c2255f6..ce24e96 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2711,31 +2711,6 @@ int regmap_write_bits(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_write_bits);
 
 /**
- * regmap_update_bits_check: Perform a read/modify/write cycle on the
- *                           register map and report if updated
- *
- * @map: Register map to update
- * @reg: Register to update
- * @mask: Bitmask to change
- * @val: New value for bitmask
- * @change: Boolean indicating if a write was done
- *
- * Returns zero for success, a negative number on error.
- */
-int regmap_update_bits_check(struct regmap *map, unsigned int reg,
-			     unsigned int mask, unsigned int val,
-			     bool *change)
-{
-	int ret;
-
-	map->lock(map->lock_arg);
-	ret = _regmap_update_bits(map, reg, mask, val, change, false);
-	map->unlock(map->lock_arg);
-	return ret;
-}
-EXPORT_SYMBOL_GPL(regmap_update_bits_check);
-
-/**
  * regmap_update_bits_check_async: Perform a read/modify/write cycle on the
  *                                 register map asynchronously and report if
  *                                 updated
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 90c8b0e..dd227dd 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -69,6 +69,8 @@ struct reg_sequence {
 	regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
 #define	regmap_update_bits_async(map, reg, mask, val)\
 	regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
+#define	regmap_update_bits_check(map, reg, mask, val, change)\
+	regmap_update_bits_base(map, reg, mask, val, change, false, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -701,9 +703,6 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 			    bool *change, bool async, bool force);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
-int regmap_update_bits_check(struct regmap *map, unsigned int reg,
-			     unsigned int mask, unsigned int val,
-			     bool *change);
 int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
 				   unsigned int mask, unsigned int val,
 				   bool *change);
@@ -956,15 +955,6 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
-static inline int regmap_update_bits_check(struct regmap *map,
-					   unsigned int reg,
-					   unsigned int mask, unsigned int val,
-					   bool *change)
-{
-	WARN_ONCE(1, "regmap API is disabled");
-	return -EINVAL;
-}
-
 static inline int regmap_update_bits_check_async(struct regmap *map,
 						 unsigned int reg,
 						 unsigned int mask,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 05/15 v2][RFC] regmap: merge regmap_update_bits_check_async() into macro
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (4 preceding siblings ...)
  (?)
@ 2016-02-15  5:23 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: merge regmap_update_bits_check_async() into macro" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:23 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch merges regmap_update_bits_check_async() into macro
by using regmap_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 37 -------------------------------------
 include/linux/regmap.h       | 15 ++-------------
 2 files changed, 2 insertions(+), 50 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ce24e96..015135a 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2710,43 +2710,6 @@ int regmap_write_bits(struct regmap *map, unsigned int reg,
 }
 EXPORT_SYMBOL_GPL(regmap_write_bits);
 
-/**
- * regmap_update_bits_check_async: Perform a read/modify/write cycle on the
- *                                 register map asynchronously and report if
- *                                 updated
- *
- * @map: Register map to update
- * @reg: Register to update
- * @mask: Bitmask to change
- * @val: New value for bitmask
- * @change: Boolean indicating if a write was done
- *
- * With most buses the read must be done synchronously so this is most
- * useful for devices with a cache which do not need to interact with
- * the hardware to determine the current register value.
- *
- * Returns zero for success, a negative number on error.
- */
-int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
-				   unsigned int mask, unsigned int val,
-				   bool *change)
-{
-	int ret;
-
-	map->lock(map->lock_arg);
-
-	map->async = true;
-
-	ret = _regmap_update_bits(map, reg, mask, val, change, false);
-
-	map->async = false;
-
-	map->unlock(map->lock_arg);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(regmap_update_bits_check_async);
-
 void regmap_async_complete_cb(struct regmap_async *async, int ret)
 {
 	struct regmap *map = async->map;
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index dd227dd..4d8e1ed 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -71,6 +71,8 @@ struct reg_sequence {
 	regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
 #define	regmap_update_bits_check(map, reg, mask, val, change)\
 	regmap_update_bits_base(map, reg, mask, val, change, false, false)
+#define	regmap_update_bits_check_async(map, reg, mask, val, change)\
+	regmap_update_bits_base(map, reg, mask, val, change, true, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -703,9 +705,6 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 			    bool *change, bool async, bool force);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
-int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
-				   unsigned int mask, unsigned int val,
-				   bool *change);
 int regmap_get_val_bytes(struct regmap *map);
 int regmap_get_max_register(struct regmap *map);
 int regmap_get_reg_stride(struct regmap *map);
@@ -955,16 +954,6 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
-static inline int regmap_update_bits_check_async(struct regmap *map,
-						 unsigned int reg,
-						 unsigned int mask,
-						 unsigned int val,
-						 bool *change)
-{
-	WARN_ONCE(1, "regmap API is disabled");
-	return -EINVAL;
-}
-
 static inline int regmap_get_val_bytes(struct regmap *map)
 {
 	WARN_ONCE(1, "regmap API is disabled");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 06/15 v2][RFC] regmap: add regmap_field_update_bits_base()
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (5 preceding siblings ...)
  (?)
@ 2016-02-15  5:23 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: add regmap_field_update_bits_base()" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:23 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch adds new regmap_field_update_bits_base() which is using
regmap_update_bits_base().
Current regmap_field_xxx() can be merged into it by macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 27 +++++++++++++++++++++++++++
 include/linux/regmap.h       | 12 +++++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 015135a..e534105 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1690,6 +1690,33 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_raw_write);
 
 /**
+ * regmap_field_update_bits_base():
+ *	Perform a read/modify/write cycle on the register field
+ *	with change, async, force option
+ *
+ * @field: Register field to write to
+ * @mask: Bitmask to change
+ * @val: Value to be written
+ * @change: Boolean indicating if a write was done
+ * @async: Boolean indicating asynchronously
+ * @force: Boolean indicating use force update
+ *
+ * A value of zero will be returned on success, a negative errno will
+ * be returned in error cases.
+ */
+int regmap_field_update_bits_base(struct regmap_field *field,
+				  unsigned int mask, unsigned int val,
+				  bool *change, bool async, bool force)
+{
+	mask = (mask << field->shift) & field->mask;
+
+	return regmap_update_bits_base(field->regmap, field->reg,
+				       mask, val << field->shift,
+				       change, async, force);
+}
+EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);
+
+/**
  * regmap_field_write(): Write a value to a single register field
  *
  * @field: Register field to write to
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4d8e1ed..23bf765 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -773,9 +773,11 @@ void devm_regmap_field_free(struct device *dev,	struct regmap_field *field);
 
 int regmap_field_read(struct regmap_field *field, unsigned int *val);
 int regmap_field_write(struct regmap_field *field, unsigned int val);
+int regmap_field_update_bits_base(struct regmap_field *field,
+				  unsigned int mask, unsigned int val,
+				  bool *change, bool async, bool force);
 int regmap_field_update_bits(struct regmap_field *field,
 			     unsigned int mask, unsigned int val);
-
 int regmap_fields_write(struct regmap_field *field, unsigned int id,
 			unsigned int val);
 int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
@@ -954,6 +956,14 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
 	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)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+	return -EINVAL;
+}
+
 static inline int regmap_get_val_bytes(struct regmap *map)
 {
 	WARN_ONCE(1, "regmap API is disabled");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 07/15 v2][RFC] regmap: merge regmap_field_write() into macro
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (6 preceding siblings ...)
  (?)
@ 2016-02-15  5:24 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: merge regmap_field_write() into macro" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:24 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch merges regmap_field_write() into macro
by using regmap_field_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 16 ----------------
 include/linux/regmap.h       |  4 +++-
 2 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e534105..228dce2 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1717,22 +1717,6 @@ int regmap_field_update_bits_base(struct regmap_field *field,
 EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);
 
 /**
- * regmap_field_write(): Write a value to a single register field
- *
- * @field: Register field to write to
- * @val: Value to be written
- *
- * A value of zero will be returned on success, a negative errno will
- * be returned in error cases.
- */
-int regmap_field_write(struct regmap_field *field, unsigned int val)
-{
-	return regmap_update_bits(field->regmap, field->reg,
-				field->mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_field_write);
-
-/**
  * regmap_field_update_bits():	Perform a read/modify/write cycle
  *                              on the register field
  *
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 23bf765..13e9ebd 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -74,6 +74,9 @@ struct reg_sequence {
 #define	regmap_update_bits_check_async(map, reg, mask, val, change)\
 	regmap_update_bits_base(map, reg, mask, val, change, true, false)
 
+#define	regmap_field_write(field, val) \
+	regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
+
 #ifdef CONFIG_REGMAP
 
 enum regmap_endian {
@@ -772,7 +775,6 @@ struct regmap_field *devm_regmap_field_alloc(struct device *dev,
 void devm_regmap_field_free(struct device *dev,	struct regmap_field *field);
 
 int regmap_field_read(struct regmap_field *field, unsigned int *val);
-int regmap_field_write(struct regmap_field *field, unsigned int val);
 int regmap_field_update_bits_base(struct regmap_field *field,
 				  unsigned int mask, unsigned int val,
 				  bool *change, bool async, bool force);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 08/15 v2][RFC] regmap: merge regmap_field_update_bits() into macro
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (7 preceding siblings ...)
  (?)
@ 2016-02-15  5:24 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: merge regmap_field_update_bits() into macro" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:24 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch merges regmap_field_update_bits() into macro
by using regmap_field_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 20 --------------------
 include/linux/regmap.h       |  4 ++--
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 228dce2..606c9b5 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1717,26 +1717,6 @@ int regmap_field_update_bits_base(struct regmap_field *field,
 EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);
 
 /**
- * regmap_field_update_bits():	Perform a read/modify/write cycle
- *                              on the register field
- *
- * @field: Register field to write to
- * @mask: Bitmask to change
- * @val: Value to be written
- *
- * A value of zero will be returned on success, a negative errno will
- * be returned in error cases.
- */
-int regmap_field_update_bits(struct regmap_field *field, unsigned int mask, unsigned int val)
-{
-	mask = (mask << field->shift) & field->mask;
-
-	return regmap_update_bits(field->regmap, field->reg,
-				  mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_field_update_bits);
-
-/**
  * regmap_fields_write(): Write a value to a single register field with port ID
  *
  * @field: Register field to write to
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 13e9ebd..e525bee 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -76,6 +76,8 @@ struct reg_sequence {
 
 #define	regmap_field_write(field, val) \
 	regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
+#define	regmap_field_update_bits(field, mask, val)\
+	regmap_field_update_bits_base(field, mask, val, NULL, false, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -778,8 +780,6 @@ int regmap_field_read(struct regmap_field *field, unsigned int *val);
 int regmap_field_update_bits_base(struct regmap_field *field,
 				  unsigned int mask, unsigned int val,
 				  bool *change, bool async, bool force);
-int regmap_field_update_bits(struct regmap_field *field,
-			     unsigned int mask, unsigned int val);
 int regmap_fields_write(struct regmap_field *field, unsigned int id,
 			unsigned int val);
 int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 09/15 v2][RFC] regmap: add regmap_fields_update_bits_base()
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (8 preceding siblings ...)
  (?)
@ 2016-02-15  5:24 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: add regmap_fields_update_bits_base()" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:24 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch adds new regmap_fields_update_bits_base() which is using
regmap_update_bits_base().
Current regmap_fields_xxx() can be merged into it by macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 32 ++++++++++++++++++++++++++++++++
 include/linux/regmap.h       | 12 ++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 606c9b5..0c7773f 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1717,6 +1717,38 @@ int regmap_field_update_bits_base(struct regmap_field *field,
 EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);
 
 /**
+ * regmap_fields_update_bits_base():
+ *	Perform a read/modify/write cycle on the register field
+ *	with change, async, force option
+ *
+ * @field: Register field to write to
+ * @id: port ID
+ * @mask: Bitmask to change
+ * @val: Value to be written
+ * @change: Boolean indicating if a write was done
+ * @async: Boolean indicating asynchronously
+ * @force: Boolean indicating use force update
+ *
+ * A value of zero will be returned on success, a negative errno will
+ * be returned in error cases.
+ */
+int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
+				   unsigned int mask, unsigned int val,
+				   bool *change, bool async, bool force)
+{
+	if (id >= field->id_size)
+		return -EINVAL;
+
+	mask = (mask << field->shift) & field->mask;
+
+	return regmap_update_bits_base(field->regmap,
+				       field->reg + (field->id_offset * id),
+				       mask, val << field->shift,
+				       change, async, force);
+}
+EXPORT_SYMBOL_GPL(regmap_fields_update_bits_base);
+
+/**
  * regmap_fields_write(): Write a value to a single register field with port ID
  *
  * @field: Register field to write to
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index e525bee..2735a3d 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -788,6 +788,9 @@ int regmap_fields_read(struct regmap_field *field, unsigned int id,
 		       unsigned int *val);
 int regmap_fields_update_bits(struct regmap_field *field,  unsigned int id,
 			      unsigned int mask, unsigned int val);
+int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
+				   unsigned int mask, unsigned int val,
+				   bool *change, bool async, bool force);
 
 /**
  * Description of an IRQ for the generic regmap irq_chip.
@@ -966,6 +969,15 @@ static inline int regmap_field_update_bits_base(struct regmap_field *field,
 	return -EINVAL;
 }
 
+static inline int regmap_fields_update_bits_base(struct regmap_field *field,
+				   unsigned int id,
+				   unsigned int mask, unsigned int val,
+				   bool *change, bool async, bool force)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+	return -EINVAL;
+}
+
 static inline int regmap_get_val_bytes(struct regmap *map)
 {
 	WARN_ONCE(1, "regmap API is disabled");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 10/15 v2][RFC] regmap: merge regmap_fields_write() into macro
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (9 preceding siblings ...)
  (?)
@ 2016-02-15  5:25 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: merge regmap_fields_write() into macro" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:25 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch merges regmap_fields_write() into macro
by using regmap_fields_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 22 ----------------------
 include/linux/regmap.h       |  5 +++--
 2 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 0c7773f..4b14745 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1748,28 +1748,6 @@ int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
 }
 EXPORT_SYMBOL_GPL(regmap_fields_update_bits_base);
 
-/**
- * regmap_fields_write(): Write a value to a single register field with port ID
- *
- * @field: Register field to write to
- * @id: port ID
- * @val: Value to be written
- *
- * A value of zero will be returned on success, a negative errno will
- * be returned in error cases.
- */
-int regmap_fields_write(struct regmap_field *field, unsigned int id,
-			unsigned int val)
-{
-	if (id >= field->id_size)
-		return -EINVAL;
-
-	return regmap_update_bits(field->regmap,
-				  field->reg + (field->id_offset * id),
-				  field->mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_fields_write);
-
 int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
 			unsigned int val)
 {
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 2735a3d..5f438a4 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -79,6 +79,9 @@ struct reg_sequence {
 #define	regmap_field_update_bits(field, mask, val)\
 	regmap_field_update_bits_base(field, mask, val, NULL, false, false)
 
+#define	regmap_fields_write(field, id, val) \
+	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
+
 #ifdef CONFIG_REGMAP
 
 enum regmap_endian {
@@ -780,8 +783,6 @@ int regmap_field_read(struct regmap_field *field, unsigned int *val);
 int regmap_field_update_bits_base(struct regmap_field *field,
 				  unsigned int mask, unsigned int val,
 				  bool *change, bool async, bool force);
-int regmap_fields_write(struct regmap_field *field, unsigned int id,
-			unsigned int val);
 int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
 			unsigned int val);
 int regmap_fields_read(struct regmap_field *field, unsigned int id,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 11/15 v2][RFC] regmap: merge regmap_fields_update_bits() into macro
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (10 preceding siblings ...)
  (?)
@ 2016-02-15  5:25 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: merge regmap_fields_update_bits() into macro" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:25 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch merges regmap_fields_update_bits() into macro
by using regmap_field_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 26 --------------------------
 include/linux/regmap.h       |  4 ++--
 2 files changed, 2 insertions(+), 28 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 4b14745..79d7f51 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1760,32 +1760,6 @@ int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
 }
 EXPORT_SYMBOL_GPL(regmap_fields_force_write);
 
-/**
- * regmap_fields_update_bits():	Perform a read/modify/write cycle
- *                              on the register field
- *
- * @field: Register field to write to
- * @id: port ID
- * @mask: Bitmask to change
- * @val: Value to be written
- *
- * A value of zero will be returned on success, a negative errno will
- * be returned in error cases.
- */
-int regmap_fields_update_bits(struct regmap_field *field,  unsigned int id,
-			      unsigned int mask, unsigned int val)
-{
-	if (id >= field->id_size)
-		return -EINVAL;
-
-	mask = (mask << field->shift) & field->mask;
-
-	return regmap_update_bits(field->regmap,
-				  field->reg + (field->id_offset * id),
-				  mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_fields_update_bits);
-
 /*
  * regmap_bulk_write(): Write multiple registers to the device
  *
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 5f438a4..7d3d498 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -81,6 +81,8 @@ struct reg_sequence {
 
 #define	regmap_fields_write(field, id, val) \
 	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
+#define	regmap_fields_update_bits(field, id, mask, val)\
+	regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -787,8 +789,6 @@ int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
 			unsigned int val);
 int regmap_fields_read(struct regmap_field *field, unsigned int id,
 		       unsigned int *val);
-int regmap_fields_update_bits(struct regmap_field *field,  unsigned int id,
-			      unsigned int mask, unsigned int val);
 int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
 				   unsigned int mask, unsigned int val,
 				   bool *change, bool async, bool force);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 12/15 v2][RFC] regmap: add regmap_field_force_xxx() macros
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (11 preceding siblings ...)
  (?)
@ 2016-02-15  5:25 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: add regmap_field_force_xxx() macros" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:25 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/linux/regmap.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 7d3d498..d36ea89 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -76,8 +76,12 @@ struct reg_sequence {
 
 #define	regmap_field_write(field, val) \
 	regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
+#define	regmap_field_force_write(field, val) \
+	regmap_field_update_bits_base(field, ~0, val, NULL, false, true)
 #define	regmap_field_update_bits(field, mask, val)\
 	regmap_field_update_bits_base(field, mask, val, NULL, false, false)
+#define	regmap_field_force_update_bits(field, mask, val) \
+	regmap_field_update_bits_base(field, mask, val, NULL, false, true)
 
 #define	regmap_fields_write(field, id, val) \
 	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 13/15 v2][RFC] regmap: add regmap_fields_force_xxx() macros
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (12 preceding siblings ...)
  (?)
@ 2016-02-15  5:26 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: add regmap_fields_force_xxx() macros" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:26 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 12 ------------
 include/linux/regmap.h       |  6 ++++--
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 79d7f51..c7d4a63 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1748,18 +1748,6 @@ int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
 }
 EXPORT_SYMBOL_GPL(regmap_fields_update_bits_base);
 
-int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
-			unsigned int val)
-{
-	if (id >= field->id_size)
-		return -EINVAL;
-
-	return regmap_write_bits(field->regmap,
-				  field->reg + (field->id_offset * id),
-				  field->mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_fields_force_write);
-
 /*
  * regmap_bulk_write(): Write multiple registers to the device
  *
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index d36ea89..e0960b3 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -85,8 +85,12 @@ struct reg_sequence {
 
 #define	regmap_fields_write(field, id, val) \
 	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
+#define	regmap_fields_force_write(field, id, val) \
+	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, true)
 #define	regmap_fields_update_bits(field, id, mask, val)\
 	regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false)
+#define	regmap_fields_force_update_bits(field, id, mask, val) \
+	regmap_fields_update_bits_base(field, id, mask, val, NULL, false, true)
 
 #ifdef CONFIG_REGMAP
 
@@ -789,8 +793,6 @@ int regmap_field_read(struct regmap_field *field, unsigned int *val);
 int regmap_field_update_bits_base(struct regmap_field *field,
 				  unsigned int mask, unsigned int val,
 				  bool *change, bool async, bool force);
-int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
-			unsigned int val);
 int regmap_fields_read(struct regmap_field *field, unsigned int id,
 		       unsigned int *val);
 int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 14/15 v2][RFC] regmpa: remove regmap_write_bits()
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (13 preceding siblings ...)
  (?)
@ 2016-02-15  5:26 ` Kuninori Morimoto
  2016-02-26  3:17   ` Applied "regmap: remove regmap_write_bits()" to the asoc tree Mark Brown
  -1 siblings, 1 reply; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:26 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

We can use _force_ write by regmap_update_bits_base() option.
Let's remove unused regmap_write_bits()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c | 23 -----------------------
 include/linux/regmap.h       |  9 ---------
 2 files changed, 32 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c7d4a63..3fb04c3 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2650,29 +2650,6 @@ 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;
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index e0960b3..5315ff0 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -721,8 +721,6 @@ 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);
@@ -961,13 +959,6 @@ 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)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 15/15 v2][RFC] ASoC: rsnd: rsnd_write() / rsnd_bset() uses regmap _force_ function
  2016-02-15  5:20 ` Kuninori Morimoto
                   ` (14 preceding siblings ...)
  (?)
@ 2016-02-15  5:26 ` Kuninori Morimoto
  -1 siblings, 0 replies; 31+ messages in thread
From: Kuninori Morimoto @ 2016-02-15  5:26 UTC (permalink / raw)
  To: Mark Brown, Greg KH; +Cc: Linux-Kernel, Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Some R-Car sound requests picky register access which needs *force*
register write.
Some status register needs to set 1 to clear status, but we might
read 1 from its register. In such case, current regmap does nothing
and driver will be forever loop
To reduce code complexity, this patch uses regmap _force_
function for all register access.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/gen.c  | 21 ++-------------------
 sound/soc/sh/rcar/rsnd.h |  2 --
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index ea24247..a936c4b 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -104,23 +104,6 @@ void rsnd_write(struct rsnd_priv *priv,
 	if (!rsnd_is_accessible_reg(priv, gen, reg))
 		return;
 
-	regmap_fields_write(gen->regs[reg], rsnd_mod_id(mod), data);
-
-	dev_dbg(dev, "w %s[%d] - %-18s (%4d) : %08x\n",
-		rsnd_mod_name(mod), rsnd_mod_id(mod),
-		rsnd_reg_name(gen, reg), reg, data);
-}
-
-void rsnd_force_write(struct rsnd_priv *priv,
-		      struct rsnd_mod *mod,
-		      enum rsnd_reg reg, u32 data)
-{
-	struct device *dev = rsnd_priv_to_dev(priv);
-	struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
-
-	if (!rsnd_is_accessible_reg(priv, gen, reg))
-		return;
-
 	regmap_fields_force_write(gen->regs[reg], rsnd_mod_id(mod), data);
 
 	dev_dbg(dev, "w %s[%d] - %-18s (%4d) : %08x\n",
@@ -137,8 +120,8 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,
 	if (!rsnd_is_accessible_reg(priv, gen, reg))
 		return;
 
-	regmap_fields_update_bits(gen->regs[reg], rsnd_mod_id(mod),
-				  mask, data);
+	regmap_fields_force_update_bits(gen->regs[reg],
+					rsnd_mod_id(mod), mask, data);
 
 	dev_dbg(dev, "b %s[%d] - %-18s (%4d) : %08x/%08x\n",
 		rsnd_mod_name(mod), rsnd_mod_id(mod),
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 317dd79..b536a12 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -147,8 +147,6 @@ struct rsnd_dai_stream;
 	rsnd_read(rsnd_mod_to_priv(m), m, RSND_REG_##r)
 #define rsnd_mod_write(m, r, d) \
 	rsnd_write(rsnd_mod_to_priv(m), m, RSND_REG_##r, d)
-#define rsnd_mod_force_write(m, r, d) \
-	rsnd_force_write(rsnd_mod_to_priv(m), m, RSND_REG_##r, d)
 #define rsnd_mod_bset(m, r, s, d) \
 	rsnd_bset(rsnd_mod_to_priv(m), m, RSND_REG_##r, s, d)
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: remove regmap_write_bits()" to the asoc tree
  2016-02-15  5:26 ` [PATCH 14/15 v2][RFC] regmpa: remove regmap_write_bits() Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: remove regmap_write_bits()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 23b92e4cf5fd99e3d58298f6423f106bffb9ca42 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:26:32 +0000
Subject: [PATCH] regmap: remove regmap_write_bits()

We can use _force_ write by regmap_update_bits_base() option.
Let's remove unused regmap_write_bits()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 23 -----------------------
 include/linux/regmap.h       |  9 ---------
 2 files changed, 32 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c7d4a636778d..3fb04c36ae5e 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2650,29 +2650,6 @@ 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;
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index e0960b3ff290..5315ff0adb85 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -721,8 +721,6 @@ 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);
@@ -961,13 +959,6 @@ 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)
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: add regmap_fields_force_xxx() macros" to the asoc tree
  2016-02-15  5:26 ` [PATCH 13/15 v2][RFC] regmap: add regmap_fields_force_xxx() macros Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: add regmap_fields_force_xxx() macros

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From e6ef243fa4660f3206137bd5f3e69b13a9b7c28a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:26:14 +0000
Subject: [PATCH] regmap: add regmap_fields_force_xxx() macros

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 12 ------------
 include/linux/regmap.h       |  6 ++++--
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 79d7f51019d7..c7d4a636778d 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1748,18 +1748,6 @@ int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
 }
 EXPORT_SYMBOL_GPL(regmap_fields_update_bits_base);
 
-int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
-			unsigned int val)
-{
-	if (id >= field->id_size)
-		return -EINVAL;
-
-	return regmap_write_bits(field->regmap,
-				  field->reg + (field->id_offset * id),
-				  field->mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_fields_force_write);
-
 /*
  * regmap_bulk_write(): Write multiple registers to the device
  *
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index d36ea89adc50..e0960b3ff290 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -85,8 +85,12 @@ struct reg_sequence {
 
 #define	regmap_fields_write(field, id, val) \
 	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
+#define	regmap_fields_force_write(field, id, val) \
+	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, true)
 #define	regmap_fields_update_bits(field, id, mask, val)\
 	regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false)
+#define	regmap_fields_force_update_bits(field, id, mask, val) \
+	regmap_fields_update_bits_base(field, id, mask, val, NULL, false, true)
 
 #ifdef CONFIG_REGMAP
 
@@ -789,8 +793,6 @@ int regmap_field_read(struct regmap_field *field, unsigned int *val);
 int regmap_field_update_bits_base(struct regmap_field *field,
 				  unsigned int mask, unsigned int val,
 				  bool *change, bool async, bool force);
-int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
-			unsigned int val);
 int regmap_fields_read(struct regmap_field *field, unsigned int id,
 		       unsigned int *val);
 int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: add regmap_field_force_xxx() macros" to the asoc tree
  2016-02-15  5:25 ` [PATCH 12/15 v2][RFC] regmap: add regmap_field_force_xxx() macros Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: add regmap_field_force_xxx() macros

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 489061bba6c655a2f98d39be17df118c0fd09d57 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:25:54 +0000
Subject: [PATCH] regmap: add regmap_field_force_xxx() macros

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/linux/regmap.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 7d3d498fd3e8..d36ea89adc50 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -76,8 +76,12 @@ struct reg_sequence {
 
 #define	regmap_field_write(field, val) \
 	regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
+#define	regmap_field_force_write(field, val) \
+	regmap_field_update_bits_base(field, ~0, val, NULL, false, true)
 #define	regmap_field_update_bits(field, mask, val)\
 	regmap_field_update_bits_base(field, mask, val, NULL, false, false)
+#define	regmap_field_force_update_bits(field, mask, val) \
+	regmap_field_update_bits_base(field, mask, val, NULL, false, true)
 
 #define	regmap_fields_write(field, id, val) \
 	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: merge regmap_fields_update_bits() into macro" to the asoc tree
  2016-02-15  5:25 ` [PATCH 11/15 v2][RFC] regmap: merge regmap_fields_update_bits() into macro Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: merge regmap_fields_update_bits() into macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 48138609135fc9c363f034596e14bff5dbf9f33f Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:25:32 +0000
Subject: [PATCH] regmap: merge regmap_fields_update_bits() into macro

This patch merges regmap_fields_update_bits() into macro
by using regmap_field_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 26 --------------------------
 include/linux/regmap.h       |  4 ++--
 2 files changed, 2 insertions(+), 28 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 4b14745249ba..79d7f51019d7 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1760,32 +1760,6 @@ int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
 }
 EXPORT_SYMBOL_GPL(regmap_fields_force_write);
 
-/**
- * regmap_fields_update_bits():	Perform a read/modify/write cycle
- *                              on the register field
- *
- * @field: Register field to write to
- * @id: port ID
- * @mask: Bitmask to change
- * @val: Value to be written
- *
- * A value of zero will be returned on success, a negative errno will
- * be returned in error cases.
- */
-int regmap_fields_update_bits(struct regmap_field *field,  unsigned int id,
-			      unsigned int mask, unsigned int val)
-{
-	if (id >= field->id_size)
-		return -EINVAL;
-
-	mask = (mask << field->shift) & field->mask;
-
-	return regmap_update_bits(field->regmap,
-				  field->reg + (field->id_offset * id),
-				  mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_fields_update_bits);
-
 /*
  * regmap_bulk_write(): Write multiple registers to the device
  *
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 5f438a4df5e6..7d3d498fd3e8 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -81,6 +81,8 @@ struct reg_sequence {
 
 #define	regmap_fields_write(field, id, val) \
 	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
+#define	regmap_fields_update_bits(field, id, mask, val)\
+	regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -787,8 +789,6 @@ int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
 			unsigned int val);
 int regmap_fields_read(struct regmap_field *field, unsigned int id,
 		       unsigned int *val);
-int regmap_fields_update_bits(struct regmap_field *field,  unsigned int id,
-			      unsigned int mask, unsigned int val);
 int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
 				   unsigned int mask, unsigned int val,
 				   bool *change, bool async, bool force);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: merge regmap_fields_write() into macro" to the asoc tree
  2016-02-15  5:25 ` [PATCH 10/15 v2][RFC] regmap: merge regmap_fields_write() into macro Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: merge regmap_fields_write() into macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From bbf2c46f46e23a496337e143cd012c013c6c7910 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:25:15 +0000
Subject: [PATCH] regmap: merge regmap_fields_write() into macro

This patch merges regmap_fields_write() into macro
by using regmap_fields_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 22 ----------------------
 include/linux/regmap.h       |  5 +++--
 2 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 0c7773fadd48..4b14745249ba 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1748,28 +1748,6 @@ int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
 }
 EXPORT_SYMBOL_GPL(regmap_fields_update_bits_base);
 
-/**
- * regmap_fields_write(): Write a value to a single register field with port ID
- *
- * @field: Register field to write to
- * @id: port ID
- * @val: Value to be written
- *
- * A value of zero will be returned on success, a negative errno will
- * be returned in error cases.
- */
-int regmap_fields_write(struct regmap_field *field, unsigned int id,
-			unsigned int val)
-{
-	if (id >= field->id_size)
-		return -EINVAL;
-
-	return regmap_update_bits(field->regmap,
-				  field->reg + (field->id_offset * id),
-				  field->mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_fields_write);
-
 int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
 			unsigned int val)
 {
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 2735a3df7eab..5f438a4df5e6 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -79,6 +79,9 @@ struct reg_sequence {
 #define	regmap_field_update_bits(field, mask, val)\
 	regmap_field_update_bits_base(field, mask, val, NULL, false, false)
 
+#define	regmap_fields_write(field, id, val) \
+	regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
+
 #ifdef CONFIG_REGMAP
 
 enum regmap_endian {
@@ -780,8 +783,6 @@ int regmap_field_read(struct regmap_field *field, unsigned int *val);
 int regmap_field_update_bits_base(struct regmap_field *field,
 				  unsigned int mask, unsigned int val,
 				  bool *change, bool async, bool force);
-int regmap_fields_write(struct regmap_field *field, unsigned int id,
-			unsigned int val);
 int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
 			unsigned int val);
 int regmap_fields_read(struct regmap_field *field, unsigned int id,
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: add regmap_fields_update_bits_base()" to the asoc tree
  2016-02-15  5:24 ` [PATCH 09/15 v2][RFC] regmap: add regmap_fields_update_bits_base() Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: add regmap_fields_update_bits_base()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From e126edec184ea3049cc1f8b652c6eeb06aa65fda Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:24:51 +0000
Subject: [PATCH] regmap: add regmap_fields_update_bits_base()

This patch adds new regmap_fields_update_bits_base() which is using
regmap_update_bits_base().
Current regmap_fields_xxx() can be merged into it by macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 32 ++++++++++++++++++++++++++++++++
 include/linux/regmap.h       | 12 ++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 606c9b53526b..0c7773fadd48 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1717,6 +1717,38 @@ int regmap_field_update_bits_base(struct regmap_field *field,
 EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);
 
 /**
+ * regmap_fields_update_bits_base():
+ *	Perform a read/modify/write cycle on the register field
+ *	with change, async, force option
+ *
+ * @field: Register field to write to
+ * @id: port ID
+ * @mask: Bitmask to change
+ * @val: Value to be written
+ * @change: Boolean indicating if a write was done
+ * @async: Boolean indicating asynchronously
+ * @force: Boolean indicating use force update
+ *
+ * A value of zero will be returned on success, a negative errno will
+ * be returned in error cases.
+ */
+int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
+				   unsigned int mask, unsigned int val,
+				   bool *change, bool async, bool force)
+{
+	if (id >= field->id_size)
+		return -EINVAL;
+
+	mask = (mask << field->shift) & field->mask;
+
+	return regmap_update_bits_base(field->regmap,
+				       field->reg + (field->id_offset * id),
+				       mask, val << field->shift,
+				       change, async, force);
+}
+EXPORT_SYMBOL_GPL(regmap_fields_update_bits_base);
+
+/**
  * regmap_fields_write(): Write a value to a single register field with port ID
  *
  * @field: Register field to write to
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index e525beeaa2c6..2735a3df7eab 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -788,6 +788,9 @@ int regmap_fields_read(struct regmap_field *field, unsigned int id,
 		       unsigned int *val);
 int regmap_fields_update_bits(struct regmap_field *field,  unsigned int id,
 			      unsigned int mask, unsigned int val);
+int regmap_fields_update_bits_base(struct regmap_field *field,  unsigned int id,
+				   unsigned int mask, unsigned int val,
+				   bool *change, bool async, bool force);
 
 /**
  * Description of an IRQ for the generic regmap irq_chip.
@@ -966,6 +969,15 @@ static inline int regmap_field_update_bits_base(struct regmap_field *field,
 	return -EINVAL;
 }
 
+static inline int regmap_fields_update_bits_base(struct regmap_field *field,
+				   unsigned int id,
+				   unsigned int mask, unsigned int val,
+				   bool *change, bool async, bool force)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+	return -EINVAL;
+}
+
 static inline int regmap_get_val_bytes(struct regmap *map)
 {
 	WARN_ONCE(1, "regmap API is disabled");
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: merge regmap_field_update_bits() into macro" to the asoc tree
  2016-02-15  5:24 ` [PATCH 08/15 v2][RFC] regmap: merge regmap_field_update_bits() into macro Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: merge regmap_field_update_bits() into macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 721ed64dda3774c619874866ca4f9a38ae6750af Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:24:33 +0000
Subject: [PATCH] regmap: merge regmap_field_update_bits() into macro

This patch merges regmap_field_update_bits() into macro
by using regmap_field_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 20 --------------------
 include/linux/regmap.h       |  4 ++--
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 228dce237658..606c9b53526b 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1717,26 +1717,6 @@ int regmap_field_update_bits_base(struct regmap_field *field,
 EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);
 
 /**
- * regmap_field_update_bits():	Perform a read/modify/write cycle
- *                              on the register field
- *
- * @field: Register field to write to
- * @mask: Bitmask to change
- * @val: Value to be written
- *
- * A value of zero will be returned on success, a negative errno will
- * be returned in error cases.
- */
-int regmap_field_update_bits(struct regmap_field *field, unsigned int mask, unsigned int val)
-{
-	mask = (mask << field->shift) & field->mask;
-
-	return regmap_update_bits(field->regmap, field->reg,
-				  mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_field_update_bits);
-
-/**
  * regmap_fields_write(): Write a value to a single register field with port ID
  *
  * @field: Register field to write to
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 13e9ebdea1c7..e525beeaa2c6 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -76,6 +76,8 @@ struct reg_sequence {
 
 #define	regmap_field_write(field, val) \
 	regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
+#define	regmap_field_update_bits(field, mask, val)\
+	regmap_field_update_bits_base(field, mask, val, NULL, false, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -778,8 +780,6 @@ int regmap_field_read(struct regmap_field *field, unsigned int *val);
 int regmap_field_update_bits_base(struct regmap_field *field,
 				  unsigned int mask, unsigned int val,
 				  bool *change, bool async, bool force);
-int regmap_field_update_bits(struct regmap_field *field,
-			     unsigned int mask, unsigned int val);
 int regmap_fields_write(struct regmap_field *field, unsigned int id,
 			unsigned int val);
 int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: merge regmap_field_write() into macro" to the asoc tree
  2016-02-15  5:24 ` [PATCH 07/15 v2][RFC] regmap: merge regmap_field_write() into macro Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: merge regmap_field_write() into macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 3674124b35894631f8f4d33ab041e713078bfd4b Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:24:15 +0000
Subject: [PATCH] regmap: merge regmap_field_write() into macro

This patch merges regmap_field_write() into macro
by using regmap_field_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 16 ----------------
 include/linux/regmap.h       |  4 +++-
 2 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e534105f47f6..228dce237658 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1717,22 +1717,6 @@ int regmap_field_update_bits_base(struct regmap_field *field,
 EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);
 
 /**
- * regmap_field_write(): Write a value to a single register field
- *
- * @field: Register field to write to
- * @val: Value to be written
- *
- * A value of zero will be returned on success, a negative errno will
- * be returned in error cases.
- */
-int regmap_field_write(struct regmap_field *field, unsigned int val)
-{
-	return regmap_update_bits(field->regmap, field->reg,
-				field->mask, val << field->shift);
-}
-EXPORT_SYMBOL_GPL(regmap_field_write);
-
-/**
  * regmap_field_update_bits():	Perform a read/modify/write cycle
  *                              on the register field
  *
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 23bf7657e485..13e9ebdea1c7 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -74,6 +74,9 @@ struct reg_sequence {
 #define	regmap_update_bits_check_async(map, reg, mask, val, change)\
 	regmap_update_bits_base(map, reg, mask, val, change, true, false)
 
+#define	regmap_field_write(field, val) \
+	regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
+
 #ifdef CONFIG_REGMAP
 
 enum regmap_endian {
@@ -772,7 +775,6 @@ struct regmap_field *devm_regmap_field_alloc(struct device *dev,
 void devm_regmap_field_free(struct device *dev,	struct regmap_field *field);
 
 int regmap_field_read(struct regmap_field *field, unsigned int *val);
-int regmap_field_write(struct regmap_field *field, unsigned int val);
 int regmap_field_update_bits_base(struct regmap_field *field,
 				  unsigned int mask, unsigned int val,
 				  bool *change, bool async, bool force);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: add regmap_field_update_bits_base()" to the asoc tree
  2016-02-15  5:23 ` [PATCH 06/15 v2][RFC] regmap: add regmap_field_update_bits_base() Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: add regmap_field_update_bits_base()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 28972eaa34f384eef5e33f36e00d8fa21ca44375 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:23:55 +0000
Subject: [PATCH] regmap: add regmap_field_update_bits_base()

This patch adds new regmap_field_update_bits_base() which is using
regmap_update_bits_base().
Current regmap_field_xxx() can be merged into it by macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 27 +++++++++++++++++++++++++++
 include/linux/regmap.h       | 12 +++++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 015135a656b7..e534105f47f6 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1690,6 +1690,33 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_raw_write);
 
 /**
+ * regmap_field_update_bits_base():
+ *	Perform a read/modify/write cycle on the register field
+ *	with change, async, force option
+ *
+ * @field: Register field to write to
+ * @mask: Bitmask to change
+ * @val: Value to be written
+ * @change: Boolean indicating if a write was done
+ * @async: Boolean indicating asynchronously
+ * @force: Boolean indicating use force update
+ *
+ * A value of zero will be returned on success, a negative errno will
+ * be returned in error cases.
+ */
+int regmap_field_update_bits_base(struct regmap_field *field,
+				  unsigned int mask, unsigned int val,
+				  bool *change, bool async, bool force)
+{
+	mask = (mask << field->shift) & field->mask;
+
+	return regmap_update_bits_base(field->regmap, field->reg,
+				       mask, val << field->shift,
+				       change, async, force);
+}
+EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);
+
+/**
  * regmap_field_write(): Write a value to a single register field
  *
  * @field: Register field to write to
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4d8e1edb4407..23bf7657e485 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -773,9 +773,11 @@ void devm_regmap_field_free(struct device *dev,	struct regmap_field *field);
 
 int regmap_field_read(struct regmap_field *field, unsigned int *val);
 int regmap_field_write(struct regmap_field *field, unsigned int val);
+int regmap_field_update_bits_base(struct regmap_field *field,
+				  unsigned int mask, unsigned int val,
+				  bool *change, bool async, bool force);
 int regmap_field_update_bits(struct regmap_field *field,
 			     unsigned int mask, unsigned int val);
-
 int regmap_fields_write(struct regmap_field *field, unsigned int id,
 			unsigned int val);
 int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
@@ -954,6 +956,14 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
 	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)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+	return -EINVAL;
+}
+
 static inline int regmap_get_val_bytes(struct regmap *map)
 {
 	WARN_ONCE(1, "regmap API is disabled");
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: merge regmap_update_bits_check_async() into macro" to the asoc tree
  2016-02-15  5:23 ` [PATCH 05/15 v2][RFC] regmap: merge regmap_update_bits_check_async() into macro Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: merge regmap_update_bits_check_async() into macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 89d8d4b833b0b29e0e95bd0cd51e80f5ee7a6b0a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:23:37 +0000
Subject: [PATCH] regmap: merge regmap_update_bits_check_async() into macro

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch merges regmap_update_bits_check_async() into macro
by using regmap_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 37 -------------------------------------
 include/linux/regmap.h       | 15 ++-------------
 2 files changed, 2 insertions(+), 50 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ce24e9688b05..015135a656b7 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2710,43 +2710,6 @@ int regmap_write_bits(struct regmap *map, unsigned int reg,
 }
 EXPORT_SYMBOL_GPL(regmap_write_bits);
 
-/**
- * regmap_update_bits_check_async: Perform a read/modify/write cycle on the
- *                                 register map asynchronously and report if
- *                                 updated
- *
- * @map: Register map to update
- * @reg: Register to update
- * @mask: Bitmask to change
- * @val: New value for bitmask
- * @change: Boolean indicating if a write was done
- *
- * With most buses the read must be done synchronously so this is most
- * useful for devices with a cache which do not need to interact with
- * the hardware to determine the current register value.
- *
- * Returns zero for success, a negative number on error.
- */
-int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
-				   unsigned int mask, unsigned int val,
-				   bool *change)
-{
-	int ret;
-
-	map->lock(map->lock_arg);
-
-	map->async = true;
-
-	ret = _regmap_update_bits(map, reg, mask, val, change, false);
-
-	map->async = false;
-
-	map->unlock(map->lock_arg);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(regmap_update_bits_check_async);
-
 void regmap_async_complete_cb(struct regmap_async *async, int ret)
 {
 	struct regmap *map = async->map;
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index dd227dd5e5f8..4d8e1edb4407 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -71,6 +71,8 @@ struct reg_sequence {
 	regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
 #define	regmap_update_bits_check(map, reg, mask, val, change)\
 	regmap_update_bits_base(map, reg, mask, val, change, false, false)
+#define	regmap_update_bits_check_async(map, reg, mask, val, change)\
+	regmap_update_bits_base(map, reg, mask, val, change, true, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -703,9 +705,6 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 			    bool *change, bool async, bool force);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
-int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
-				   unsigned int mask, unsigned int val,
-				   bool *change);
 int regmap_get_val_bytes(struct regmap *map);
 int regmap_get_max_register(struct regmap *map);
 int regmap_get_reg_stride(struct regmap *map);
@@ -955,16 +954,6 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
-static inline int regmap_update_bits_check_async(struct regmap *map,
-						 unsigned int reg,
-						 unsigned int mask,
-						 unsigned int val,
-						 bool *change)
-{
-	WARN_ONCE(1, "regmap API is disabled");
-	return -EINVAL;
-}
-
 static inline int regmap_get_val_bytes(struct regmap *map)
 {
 	WARN_ONCE(1, "regmap API is disabled");
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: merge regmap_update_bits_check() into macro" to the asoc tree
  2016-02-15  5:23 ` [PATCH 04/15 v2][RFC] regmap: merge regmap_update_bits_check() into macro Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: merge regmap_update_bits_check() into macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 98c2dc48694a47109fff430a216fc13a9b45a4a1 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:23:17 +0000
Subject: [PATCH] regmap: merge regmap_update_bits_check() into macro

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch merges regmap_update_bits_check() into macro
by using regmap_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 25 -------------------------
 include/linux/regmap.h       | 14 ++------------
 2 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c2255f604c03..ce24e9688b05 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2711,31 +2711,6 @@ int regmap_write_bits(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_write_bits);
 
 /**
- * regmap_update_bits_check: Perform a read/modify/write cycle on the
- *                           register map and report if updated
- *
- * @map: Register map to update
- * @reg: Register to update
- * @mask: Bitmask to change
- * @val: New value for bitmask
- * @change: Boolean indicating if a write was done
- *
- * Returns zero for success, a negative number on error.
- */
-int regmap_update_bits_check(struct regmap *map, unsigned int reg,
-			     unsigned int mask, unsigned int val,
-			     bool *change)
-{
-	int ret;
-
-	map->lock(map->lock_arg);
-	ret = _regmap_update_bits(map, reg, mask, val, change, false);
-	map->unlock(map->lock_arg);
-	return ret;
-}
-EXPORT_SYMBOL_GPL(regmap_update_bits_check);
-
-/**
  * regmap_update_bits_check_async: Perform a read/modify/write cycle on the
  *                                 register map asynchronously and report if
  *                                 updated
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 90c8b0e99f9d..dd227dd5e5f8 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -69,6 +69,8 @@ struct reg_sequence {
 	regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
 #define	regmap_update_bits_async(map, reg, mask, val)\
 	regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
+#define	regmap_update_bits_check(map, reg, mask, val, change)\
+	regmap_update_bits_base(map, reg, mask, val, change, false, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -701,9 +703,6 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 			    bool *change, bool async, bool force);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
-int regmap_update_bits_check(struct regmap *map, unsigned int reg,
-			     unsigned int mask, unsigned int val,
-			     bool *change);
 int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
 				   unsigned int mask, unsigned int val,
 				   bool *change);
@@ -956,15 +955,6 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
-static inline int regmap_update_bits_check(struct regmap *map,
-					   unsigned int reg,
-					   unsigned int mask, unsigned int val,
-					   bool *change)
-{
-	WARN_ONCE(1, "regmap API is disabled");
-	return -EINVAL;
-}
-
 static inline int regmap_update_bits_check_async(struct regmap *map,
 						 unsigned int reg,
 						 unsigned int mask,
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: merge regmap_update_bits_async() into macro" to the asoc tree
  2016-02-15  5:23 ` [PATCH 03/15 v2][RFC] regmap: merge regmap_update_bits_async() into macro Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: merge regmap_update_bits_async() into macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 30ed9cb7a49b499ebc6061e4ff38e88cb4857cad Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:23:01 +0000
Subject: [PATCH] regmap: merge regmap_update_bits_async() into macro

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch merges regmap_update_bits_async() into macro
by using regmap_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 34 ----------------------------------
 include/linux/regmap.h       | 12 ++----------
 2 files changed, 2 insertions(+), 44 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 281898a97e8f..c2255f604c03 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2711,40 +2711,6 @@ int regmap_write_bits(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_write_bits);
 
 /**
- * regmap_update_bits_async: Perform a read/modify/write cycle on the register
- *                           map asynchronously
- *
- * @map: Register map to update
- * @reg: Register to update
- * @mask: Bitmask to change
- * @val: New value for bitmask
- *
- * With most buses the read must be done synchronously so this is most
- * useful for devices with a cache which do not need to interact with
- * the hardware to determine the current register value.
- *
- * Returns zero for success, a negative number on error.
- */
-int regmap_update_bits_async(struct regmap *map, unsigned int reg,
-			     unsigned int mask, unsigned int val)
-{
-	int ret;
-
-	map->lock(map->lock_arg);
-
-	map->async = true;
-
-	ret = _regmap_update_bits(map, reg, mask, val, NULL, false);
-
-	map->async = false;
-
-	map->unlock(map->lock_arg);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(regmap_update_bits_async);
-
-/**
  * regmap_update_bits_check: Perform a read/modify/write cycle on the
  *                           register map and report if updated
  *
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 500b36cbc7aa..90c8b0e99f9d 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -67,6 +67,8 @@ struct reg_sequence {
 
 #define	regmap_update_bits(map, reg, mask, val) \
 	regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
+#define	regmap_update_bits_async(map, reg, mask, val)\
+	regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
 
 #ifdef CONFIG_REGMAP
 
@@ -699,8 +701,6 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 			    bool *change, bool async, bool force);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
-int regmap_update_bits_async(struct regmap *map, unsigned int reg,
-			     unsigned int mask, unsigned int val);
 int regmap_update_bits_check(struct regmap *map, unsigned int reg,
 			     unsigned int mask, unsigned int val,
 			     bool *change);
@@ -956,14 +956,6 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
-static inline int regmap_update_bits_async(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_update_bits_check(struct regmap *map,
 					   unsigned int reg,
 					   unsigned int mask, unsigned int val,
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: merge regmap_update_bits() into macro" to the asoc tree
  2016-02-15  5:22 ` [PATCH 02/15 v2][RFC] regmap: merge regmap_update_bits() into macro Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: merge regmap_update_bits() into macro

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From ca7a94464b5457a8dc5add19f6fc3bea59d6193f Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:22:42 +0000
Subject: [PATCH] regmap: merge regmap_update_bits() into macro

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch merges regmap_update_bits() into macro
by using regmap_update_bits_base().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 23 -----------------------
 include/linux/regmap.h       | 12 +++---------
 2 files changed, 3 insertions(+), 32 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 4e35b2f41304..281898a97e8f 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2688,29 +2688,6 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_update_bits_base);
 
 /**
- * regmap_update_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_update_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, false);
-	map->unlock(map->lock_arg);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(regmap_update_bits);
-
-/**
  * regmap_write_bits: Perform a read/modify/write cycle on the register map
  *
  * @map: Register map to update
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 28e50a3d2872..500b36cbc7aa 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -65,6 +65,9 @@ struct reg_sequence {
 	unsigned int delay_us;
 };
 
+#define	regmap_update_bits(map, reg, mask, val) \
+	regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
+
 #ifdef CONFIG_REGMAP
 
 enum regmap_endian {
@@ -694,8 +697,6 @@ 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_update_bits(struct regmap *map, unsigned int reg,
-		       unsigned int mask, unsigned int val);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
 int regmap_update_bits_async(struct regmap *map, unsigned int reg,
@@ -948,13 +949,6 @@ static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
-static inline int regmap_update_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_write_bits(struct regmap *map, unsigned int reg,
 				     unsigned int mask, unsigned int val)
 {
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Applied "regmap: add regmap_update_bits_base()" to the asoc tree
  2016-02-15  5:22 ` [PATCH 01/15 v2][RFC] regmap: add regmap_update_bits_base() Kuninori Morimoto
@ 2016-02-26  3:17   ` Mark Brown
  0 siblings, 0 replies; 31+ messages in thread
From: Mark Brown @ 2016-02-26  3:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   regmap: add regmap_update_bits_base()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 91d31b9f8e7662726f273fc32b25f4099d78de4a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 15 Feb 2016 05:22:18 +0000
Subject: [PATCH] regmap: add regmap_update_bits_base()

Current regmap has many similar update functions like below,
but the difference is very few.
	regmap_update_bits()
	regmap_update_bits_async()
	regmap_update_bits_check()
	regmap_update_bits_check_async()
Furthermore, we can add *force* write option too in the future.

This patch adds new regmap_update_bits_base() which is feature
merged function. Above functions can be merged into it by macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 40 ++++++++++++++++++++++++++++++++++++++++
 include/linux/regmap.h       | 11 +++++++++++
 2 files changed, 51 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ee54e841de4a..4e35b2f41304 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2648,6 +2648,46 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
 }
 
 /**
+ * regmap_update_bits_base:
+ *	Perform a read/modify/write cycle on the
+ *	register map with change, async, force option
+ *
+ * @map: Register map to update
+ * @reg: Register to update
+ * @mask: Bitmask to change
+ * @val: New value for bitmask
+ * @change: Boolean indicating if a write was done
+ * @async: Boolean indicating asynchronously
+ * @force: Boolean indicating use force update
+ *
+ * if async was true,
+ * With most buses the read must be done synchronously so this is most
+ * useful for devices with a cache which do not need to interact with
+ * the hardware to determine the current register value.
+ *
+ * Returns zero for success, a negative number on error.
+ */
+int regmap_update_bits_base(struct regmap *map, unsigned int reg,
+			    unsigned int mask, unsigned int val,
+			    bool *change, bool async, bool force)
+{
+	int ret;
+
+	map->lock(map->lock_arg);
+
+	map->async = async;
+
+	ret = _regmap_update_bits(map, reg, mask, val, change, force);
+
+	map->async = false;
+
+	map->unlock(map->lock_arg);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(regmap_update_bits_base);
+
+/**
  * regmap_update_bits: Perform a read/modify/write cycle on the register map
  *
  * @map: Register map to update
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 18394343f489..28e50a3d2872 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -691,6 +691,9 @@ int regmap_raw_read(struct regmap *map, unsigned int reg,
 		    void *val, size_t val_len);
 int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
 		     size_t val_count);
+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_update_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val);
 int regmap_write_bits(struct regmap *map, unsigned int reg,
@@ -937,6 +940,14 @@ static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
 	return -EINVAL;
 }
 
+static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg,
+					  unsigned int mask, unsigned int val,
+					  bool *change, bool async, bool force)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+	return -EINVAL;
+}
+
 static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
 				     unsigned int mask, unsigned int val)
 {
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2016-02-26  3:17 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-15  5:20 [PATCH 0/15 v2][RFC] cleanup regmap write functions Kuninori Morimoto
2016-02-15  5:20 ` Kuninori Morimoto
2016-02-15  5:22 ` [PATCH 01/15 v2][RFC] regmap: add regmap_update_bits_base() Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: add regmap_update_bits_base()" to the asoc tree Mark Brown
2016-02-15  5:22 ` [PATCH 02/15 v2][RFC] regmap: merge regmap_update_bits() into macro Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: merge regmap_update_bits() into macro" to the asoc tree Mark Brown
2016-02-15  5:23 ` [PATCH 03/15 v2][RFC] regmap: merge regmap_update_bits_async() into macro Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: merge regmap_update_bits_async() into macro" to the asoc tree Mark Brown
2016-02-15  5:23 ` [PATCH 04/15 v2][RFC] regmap: merge regmap_update_bits_check() into macro Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: merge regmap_update_bits_check() into macro" to the asoc tree Mark Brown
2016-02-15  5:23 ` [PATCH 05/15 v2][RFC] regmap: merge regmap_update_bits_check_async() into macro Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: merge regmap_update_bits_check_async() into macro" to the asoc tree Mark Brown
2016-02-15  5:23 ` [PATCH 06/15 v2][RFC] regmap: add regmap_field_update_bits_base() Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: add regmap_field_update_bits_base()" to the asoc tree Mark Brown
2016-02-15  5:24 ` [PATCH 07/15 v2][RFC] regmap: merge regmap_field_write() into macro Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: merge regmap_field_write() into macro" to the asoc tree Mark Brown
2016-02-15  5:24 ` [PATCH 08/15 v2][RFC] regmap: merge regmap_field_update_bits() into macro Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: merge regmap_field_update_bits() into macro" to the asoc tree Mark Brown
2016-02-15  5:24 ` [PATCH 09/15 v2][RFC] regmap: add regmap_fields_update_bits_base() Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: add regmap_fields_update_bits_base()" to the asoc tree Mark Brown
2016-02-15  5:25 ` [PATCH 10/15 v2][RFC] regmap: merge regmap_fields_write() into macro Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: merge regmap_fields_write() into macro" to the asoc tree Mark Brown
2016-02-15  5:25 ` [PATCH 11/15 v2][RFC] regmap: merge regmap_fields_update_bits() into macro Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: merge regmap_fields_update_bits() into macro" to the asoc tree Mark Brown
2016-02-15  5:25 ` [PATCH 12/15 v2][RFC] regmap: add regmap_field_force_xxx() macros Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: add regmap_field_force_xxx() macros" to the asoc tree Mark Brown
2016-02-15  5:26 ` [PATCH 13/15 v2][RFC] regmap: add regmap_fields_force_xxx() macros Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: add regmap_fields_force_xxx() macros" to the asoc tree Mark Brown
2016-02-15  5:26 ` [PATCH 14/15 v2][RFC] regmpa: remove regmap_write_bits() Kuninori Morimoto
2016-02-26  3:17   ` Applied "regmap: remove regmap_write_bits()" to the asoc tree Mark Brown
2016-02-15  5:26 ` [PATCH 15/15 v2][RFC] ASoC: rsnd: rsnd_write() / rsnd_bset() uses regmap _force_ function Kuninori Morimoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.