lkml.org 
[lkml]   [2016]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/7][RFC] regmap: regmap_field_xxx() uses regmap_raw_update_bits()
Date

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

It can be easy to add _check, _async, _check_async functions

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.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
\
 
 \ /
  Last update: 2016-02-10 04:01    [W:0.076 / U:5.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site