diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2016-02-15 00:23:37 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-02-19 11:15:56 -0500 |
commit | 89d8d4b833b0b29e0e95bd0cd51e80f5ee7a6b0a (patch) | |
tree | 68e7f922970dd217b53a40f6ac109672583f87b0 | |
parent | 98c2dc48694a47109fff430a216fc13a9b45a4a1 (diff) |
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>
-rw-r--r-- | drivers/base/regmap/regmap.c | 37 | ||||
-rw-r--r-- | 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, | |||
2710 | } | 2710 | } |
2711 | EXPORT_SYMBOL_GPL(regmap_write_bits); | 2711 | EXPORT_SYMBOL_GPL(regmap_write_bits); |
2712 | 2712 | ||
2713 | /** | ||
2714 | * regmap_update_bits_check_async: Perform a read/modify/write cycle on the | ||
2715 | * register map asynchronously and report if | ||
2716 | * updated | ||
2717 | * | ||
2718 | * @map: Register map to update | ||
2719 | * @reg: Register to update | ||
2720 | * @mask: Bitmask to change | ||
2721 | * @val: New value for bitmask | ||
2722 | * @change: Boolean indicating if a write was done | ||
2723 | * | ||
2724 | * With most buses the read must be done synchronously so this is most | ||
2725 | * useful for devices with a cache which do not need to interact with | ||
2726 | * the hardware to determine the current register value. | ||
2727 | * | ||
2728 | * Returns zero for success, a negative number on error. | ||
2729 | */ | ||
2730 | int regmap_update_bits_check_async(struct regmap *map, unsigned int reg, | ||
2731 | unsigned int mask, unsigned int val, | ||
2732 | bool *change) | ||
2733 | { | ||
2734 | int ret; | ||
2735 | |||
2736 | map->lock(map->lock_arg); | ||
2737 | |||
2738 | map->async = true; | ||
2739 | |||
2740 | ret = _regmap_update_bits(map, reg, mask, val, change, false); | ||
2741 | |||
2742 | map->async = false; | ||
2743 | |||
2744 | map->unlock(map->lock_arg); | ||
2745 | |||
2746 | return ret; | ||
2747 | } | ||
2748 | EXPORT_SYMBOL_GPL(regmap_update_bits_check_async); | ||
2749 | |||
2750 | void regmap_async_complete_cb(struct regmap_async *async, int ret) | 2713 | void regmap_async_complete_cb(struct regmap_async *async, int ret) |
2751 | { | 2714 | { |
2752 | struct regmap *map = async->map; | 2715 | 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 { | |||
71 | regmap_update_bits_base(map, reg, mask, val, NULL, true, false) | 71 | regmap_update_bits_base(map, reg, mask, val, NULL, true, false) |
72 | #define regmap_update_bits_check(map, reg, mask, val, change)\ | 72 | #define regmap_update_bits_check(map, reg, mask, val, change)\ |
73 | regmap_update_bits_base(map, reg, mask, val, change, false, false) | 73 | regmap_update_bits_base(map, reg, mask, val, change, false, false) |
74 | #define regmap_update_bits_check_async(map, reg, mask, val, change)\ | ||
75 | regmap_update_bits_base(map, reg, mask, val, change, true, false) | ||
74 | 76 | ||
75 | #ifdef CONFIG_REGMAP | 77 | #ifdef CONFIG_REGMAP |
76 | 78 | ||
@@ -703,9 +705,6 @@ int regmap_update_bits_base(struct regmap *map, unsigned int reg, | |||
703 | bool *change, bool async, bool force); | 705 | bool *change, bool async, bool force); |
704 | int regmap_write_bits(struct regmap *map, unsigned int reg, | 706 | int regmap_write_bits(struct regmap *map, unsigned int reg, |
705 | unsigned int mask, unsigned int val); | 707 | unsigned int mask, unsigned int val); |
706 | int regmap_update_bits_check_async(struct regmap *map, unsigned int reg, | ||
707 | unsigned int mask, unsigned int val, | ||
708 | bool *change); | ||
709 | int regmap_get_val_bytes(struct regmap *map); | 708 | int regmap_get_val_bytes(struct regmap *map); |
710 | int regmap_get_max_register(struct regmap *map); | 709 | int regmap_get_max_register(struct regmap *map); |
711 | int regmap_get_reg_stride(struct regmap *map); | 710 | int regmap_get_reg_stride(struct regmap *map); |
@@ -955,16 +954,6 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg, | |||
955 | return -EINVAL; | 954 | return -EINVAL; |
956 | } | 955 | } |
957 | 956 | ||
958 | static inline int regmap_update_bits_check_async(struct regmap *map, | ||
959 | unsigned int reg, | ||
960 | unsigned int mask, | ||
961 | unsigned int val, | ||
962 | bool *change) | ||
963 | { | ||
964 | WARN_ONCE(1, "regmap API is disabled"); | ||
965 | return -EINVAL; | ||
966 | } | ||
967 | |||
968 | static inline int regmap_get_val_bytes(struct regmap *map) | 957 | static inline int regmap_get_val_bytes(struct regmap *map) |
969 | { | 958 | { |
970 | WARN_ONCE(1, "regmap API is disabled"); | 959 | WARN_ONCE(1, "regmap API is disabled"); |