lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1460569154-25030-2-git-send-email-srinivas.kandagatla@linaro.org>
Date:	Wed, 13 Apr 2016 18:39:12 +0100
From:	Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To:	Mark Brown <broonie@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
	Maxime Ripard <maxime.ripard@...e-electrons.com>,
	linux-kernel@...r.kernel.org, rjendra@....qualcomm.com
Subject: [PATCH v1 1/3] regmap: add regmap_can_raw_read() api

This patch adds regmap_can_raw_read() api so that users like nvmem can
check if the regmap is capable of doing a raw accessors. This can also
be used by other infrastructures like nvmem which are based on regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
---
 drivers/base/regmap/regmap.c | 13 ++++++++++++-
 include/linux/regmap.h       |  7 +++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index df2d2ef..23f17fd 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1482,6 +1482,18 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
 }
 
 /**
+ * regmap_can_raw_read - Test if regmap_raw_read() is supported
+ *
+ * @map: Map to check.
+ */
+bool regmap_can_raw_read(struct regmap *map)
+{
+	return map->bus && map->bus->read && map->format.format_val &&
+		map->format.format_reg;
+}
+EXPORT_SYMBOL_GPL(regmap_can_raw_read);
+
+/**
  * regmap_can_raw_write - Test if regmap_raw_write() is supported
  *
  * @map: Map to check.
@@ -2492,7 +2504,6 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
 		 * them we have a series of single read operations.
 		 */
 		size_t total_size = val_bytes * val_count;
-
 		if (!map->use_single_read &&
 		    (!map->max_raw_read || map->max_raw_read > total_size)) {
 			ret = regmap_raw_read(map, reg, val,
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 3dc08ce..be3da4c 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -728,6 +728,7 @@ int regmap_get_val_bytes(struct regmap *map);
 int regmap_get_max_register(struct regmap *map);
 int regmap_get_reg_stride(struct regmap *map);
 int regmap_async_complete(struct regmap *map);
+bool regmap_can_raw_read(struct regmap *map);
 bool regmap_can_raw_write(struct regmap *map);
 size_t regmap_get_raw_read_max(struct regmap *map);
 size_t regmap_get_raw_write_max(struct regmap *map);
@@ -1045,6 +1046,12 @@ static inline void regmap_async_complete(struct regmap *map)
 	WARN_ONCE(1, "regmap API is disabled");
 }
 
+static inline bool regmap_can_raw_read(struct regmap *map)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+	return false;
+}
+
 static inline int regmap_register_patch(struct regmap *map,
 					const struct reg_sequence *regs,
 					int num_regs)
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ