[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y4ats2xm.wl%kuninori.morimoto.gx@renesas.com>
Date: Wed, 10 Feb 2016 02:44:39 +0000
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
To: Mark Brown <broonie@...nel.org>,
Greg KH <gregkh@...uxfoundation.org>
CC: Linux-Kernel <linux-kernel@...r.kernel.org>,
Linux-ALSA <alsa-devel@...a-project.org>
Subject: [PATCH 2/7][RFC] regmap: regmap_field_xxx() uses regmap_raw_update_bits()
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
It can be easy to add _check, _async, _check_async functions
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
---
drivers/base/regmap/regmap.c | 23 ++++++++++++++---------
include/linux/regmap.h | 14 ++++++++++----
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c91e67b..ed2fc15 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1690,7 +1690,7 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
EXPORT_SYMBOL_GPL(regmap_raw_write);
/**
- * regmap_field_write(): Write a value to a single register field
+ * _regmap_field_write(): Write a value to a single register field
*
* @field: Register field to write to
* @val: Value to be written
@@ -1698,12 +1698,14 @@ EXPORT_SYMBOL_GPL(regmap_raw_write);
* 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)
+int _regmap_field_write(struct regmap_field *field, unsigned int val,
+ bool *change, bool async, bool force)
{
- return regmap_update_bits(field->regmap, field->reg,
- field->mask, val << field->shift);
+ return regmap_raw_update_bits(field->regmap, field->reg,
+ field->mask, val << field->shift,
+ change, async, force);
}
-EXPORT_SYMBOL_GPL(regmap_field_write);
+EXPORT_SYMBOL_GPL(_regmap_field_write);
/**
* regmap_field_update_bits(): Perform a read/modify/write cycle
@@ -1716,14 +1718,17 @@ EXPORT_SYMBOL_GPL(regmap_field_write);
* 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)
+int _regmap_field_update_bits(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(field->regmap, field->reg,
- mask, val << field->shift);
+ return regmap_raw_update_bits(field->regmap, field->reg,
+ mask, val << field->shift,
+ change, async, force);
}
-EXPORT_SYMBOL_GPL(regmap_field_update_bits);
+EXPORT_SYMBOL_GPL(_regmap_field_update_bits);
/**
* regmap_fields_write(): Write a value to a single register field with port ID
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 0b8b76a..e3e54364 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -74,6 +74,11 @@ struct reg_sequence {
#define regmap_update_bits_check_async(map, reg, mask, val, change)\
regmap_raw_update_bits(map, reg, mask, val, change, true, false)
+#define regmap_field_write(field, val) \
+ _regmap_field_write(field, val, NULL, false, false)
+#define regmap_field_update_bits(field, mask, val)\
+ _regmap_field_update_bits(field, mask, val, NULL, false, false)
+
#ifdef CONFIG_REGMAP
enum regmap_endian {
@@ -772,10 +777,11 @@ 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(struct regmap_field *field,
- unsigned int mask, unsigned int val);
-
+int _regmap_field_write(struct regmap_field *field, unsigned int val,
+ bool *change, bool async, bool force);
+int _regmap_field_update_bits(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,
--
1.9.1
Powered by blists - more mailing lists