[PATCH 3/3] reset: implement reset_control_get_count()
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Aug 5 05:59:31 PDT 2022
We have a nearly equivalent of_reset_control_get_count(). Rename it and
adjust the prototype to make kernel code easier to port.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/reset/core.c | 10 +++++-----
include/linux/reset.h | 7 +++++++
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 93fbaeccafd2..b252f94d6eb9 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -157,14 +157,14 @@ int reset_control_deassert(struct reset_control *rstc)
EXPORT_SYMBOL_GPL(reset_control_deassert);
/**
- * of_reset_control_count - Count reset lines
- * @node: device node
+ * reset_control_get_count - Count reset lines
+ * @dev: device
*
* Returns number of resets, 0 if none specified
*/
-static int of_reset_control_count(struct device_node *node)
+int reset_control_get_count(struct device_d *dev)
{
- return of_count_phandle_with_args(node, "resets", "#reset-cells");
+ return of_count_phandle_with_args(dev->device_node, "resets", "#reset-cells");
}
/**
@@ -357,7 +357,7 @@ int device_reset_all(struct device_d *dev)
struct reset_control *rstc;
int ret, i;
- for (i = 0; i < of_reset_control_count(dev->device_node); i++) {
+ for (i = 0; i < reset_control_get_count(dev); i++) {
int ret;
rstc = of_reset_control_get_by_index(dev->device_node, i);
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 91e9cdfb3279..c1282a84c72c 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -24,6 +24,8 @@ int __must_check device_reset_us(struct device_d *dev, int us);
int __must_check device_reset_all(struct device_d *dev);
+int reset_control_get_count(struct device_d *dev);
+
#else
static inline int reset_control_status(struct reset_control *rstc)
@@ -71,6 +73,11 @@ static inline int device_reset_all(struct device_d *dev)
return 0;
}
+static inline int reset_control_get_count(struct device_d *dev)
+{
+ return 0;
+}
+
#endif /* CONFIG_RESET_CONTROLLER */
static inline struct reset_control *reset_control_get_optional(struct device_d *dev, const char *id)
--
2.30.2
More information about the barebox
mailing list