[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wpqds2x2.wl%kuninori.morimoto.gx@renesas.com>
Date: Wed, 10 Feb 2016 02:45:00 +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 3/7][RFC] regmap: regmap_fields_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 | 32 ++++++++++++++++++--------------
include/linux/regmap.h | 15 +++++++++++----
2 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ed2fc15..9329c27 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1731,7 +1731,7 @@ int _regmap_field_update_bits(struct regmap_field *field,
EXPORT_SYMBOL_GPL(_regmap_field_update_bits);
/**
- * regmap_fields_write(): Write a value to a single register field with port ID
+ * _regmap_fields_write(): Write a value to a single register field with port ID
*
* @field: Register field to write to
* @id: port ID
@@ -1740,17 +1740,19 @@ EXPORT_SYMBOL_GPL(_regmap_field_update_bits);
* 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)
+int _regmap_fields_write(struct regmap_field *field,
+ unsigned int id, unsigned int val,
+ bool *change, bool async, bool force)
{
if (id >= field->id_size)
return -EINVAL;
- return regmap_update_bits(field->regmap,
- field->reg + (field->id_offset * id),
- field->mask, val << field->shift);
+ return regmap_raw_update_bits(field->regmap,
+ field->reg + (field->id_offset * id),
+ field->mask, val << field->shift,
+ change, async, force);
}
-EXPORT_SYMBOL_GPL(regmap_fields_write);
+EXPORT_SYMBOL_GPL(_regmap_fields_write);
int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
unsigned int val)
@@ -1765,7 +1767,7 @@ 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
+ * _regmap_fields_update_bits(): Perform a read/modify/write cycle
* on the register field
*
* @field: Register field to write to
@@ -1776,19 +1778,21 @@ EXPORT_SYMBOL_GPL(regmap_fields_force_write);
* 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)
+int _regmap_fields_update_bits(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(field->regmap,
- field->reg + (field->id_offset * id),
- mask, val << field->shift);
+ return regmap_raw_update_bits(field->regmap,
+ field->reg + (field->id_offset * id),
+ mask, val << field->shift,
+ change, async, force);
}
-EXPORT_SYMBOL_GPL(regmap_fields_update_bits);
+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 e3e54364..687223d 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -79,6 +79,11 @@ struct reg_sequence {
#define regmap_field_update_bits(field, mask, val)\
_regmap_field_update_bits(field, mask, val, NULL, false, false)
+#define regmap_fields_write(field, id, val)\
+ _regmap_fields_write(field, id, val, NULL, false, false)
+#define regmap_fields_update_bits(field, id, mask, val)\
+ _regmap_fields_update_bits(field, id, mask, val, NULL, false, false)
+
#ifdef CONFIG_REGMAP
enum regmap_endian {
@@ -782,14 +787,16 @@ 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,
bool *change, bool async, bool force);
-int regmap_fields_write(struct regmap_field *field, unsigned int id,
- unsigned int val);
+int _regmap_fields_write(struct regmap_field *field,
+ unsigned int id, 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(struct regmap_field *field, unsigned int id,
- unsigned int mask, unsigned int val);
+int _regmap_fields_update_bits(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.
--
1.9.1
Powered by blists - more mailing lists