[PATCH 2/5] regmap: Expose regmap_writeable function to check if a register is writable

From: chengwei
Date: Tue Oct 18 2022 - 22:26:33 EST


Expose the regmap_writeable function for pinctrl-upboard reference.

Signed-off-by: Nicola Lunghi <nicola.lunghi@xxxxxxxxxx>
Signed-off-by: chengwei <larry.lai@xxxxxxxxxxxxxxx>
---
drivers/base/regmap/internal.h | 5 -----
drivers/base/regmap/regmap.c | 5 +++++
include/linux/regmap.h | 6 ++++++
3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index da8996e7a1f1..eec477755a5c 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -190,11 +190,6 @@ struct regcache_ops {
int (*drop)(struct regmap *map, unsigned int min, unsigned int max);
};

-bool regmap_cached(struct regmap *map, unsigned int reg);
-bool regmap_writeable(struct regmap *map, unsigned int reg);
-bool regmap_readable(struct regmap *map, unsigned int reg);
-bool regmap_volatile(struct regmap *map, unsigned int reg);
-bool regmap_precious(struct regmap *map, unsigned int reg);
bool regmap_writeable_noinc(struct regmap *map, unsigned int reg);
bool regmap_readable_noinc(struct regmap *map, unsigned int reg);

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index fee221c5008c..182536fcce46 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -100,6 +100,7 @@ bool regmap_writeable(struct regmap *map, unsigned int reg)

return true;
}
+EXPORT_SYMBOL_GPL(regmap_writeable);

bool regmap_cached(struct regmap *map, unsigned int reg)
{
@@ -123,6 +124,7 @@ bool regmap_cached(struct regmap *map, unsigned int reg)

return true;
}
+EXPORT_SYMBOL_GPL(regmap_cached);

bool regmap_readable(struct regmap *map, unsigned int reg)
{
@@ -143,6 +145,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg)

return true;
}
+EXPORT_SYMBOL_GPL(regmap_readable);

bool regmap_volatile(struct regmap *map, unsigned int reg)
{
@@ -160,6 +163,7 @@ bool regmap_volatile(struct regmap *map, unsigned int reg)
else
return true;
}
+EXPORT_SYMBOL_GPL(regmap_volatile);

bool regmap_precious(struct regmap *map, unsigned int reg)
{
@@ -174,6 +178,7 @@ bool regmap_precious(struct regmap *map, unsigned int reg)

return false;
}
+EXPORT_SYMBOL_GPL(regmap_precious);

bool regmap_writeable_noinc(struct regmap *map, unsigned int reg)
{
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 7cf2157134ac..4bfa681805cb 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1225,6 +1225,12 @@ void regcache_mark_dirty(struct regmap *map);
bool regmap_check_range_table(struct regmap *map, unsigned int reg,
const struct regmap_access_table *table);

+bool regmap_cached(struct regmap *map, unsigned int reg);
+bool regmap_writeable(struct regmap *map, unsigned int reg);
+bool regmap_readable(struct regmap *map, unsigned int reg);
+bool regmap_volatile(struct regmap *map, unsigned int reg);
+bool regmap_precious(struct regmap *map, unsigned int reg);
+
int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs,
int num_regs);
int regmap_parse_val(struct regmap *map, const void *buf,
--
2.17.1