All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-05-25 10:37 ` Dong Aisheng
  0 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, linux-arm-kernel, sboyd, mturquette, shawnguo,
	linux-imx, Dong Aisheng

This patch series is a continue of discussion from here,
https://patchwork.kernel.org/patch/9986293/
that some users may want to handle all available clocks from device
tree without need to know the detailed clock information likes clock
numbers and names. This is useful in writing some generic drivers to
handle clock part.

Note:
This patch series is tested on MX6Q SDB cpufreq driver with a minor change
to switch to use clk_bulk_get_all.
But patch 4 only test compiling. Hopefully someone could help test
the function.

v2->v3:
 * address all comments from Stephen
 * fix build warnings on other architectures.
v1->v2:
 * add clk_bulk_{get|put}_all() which only supports DT platform currently
 * remove _all variants and the wrapper struct clk_bulk
 * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
   proves they need it because they don't have a struct device pointer.

Dong Aisheng (4):
  clk: bulk: add of_clk_bulk_get()
  clk: add new APIs to operate on all available clocks
  clk: add managed version of clk_bulk_get_all
  video: simplefb: switch to use clk_bulk API to simplify clock
    operations

 drivers/clk/clk-bulk.c         | 80 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/clk-devres.c       | 24 +++++++++++++
 drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
 include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
 4 files changed, 180 insertions(+), 55 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-05-25 10:37 ` Dong Aisheng
  0 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series is a continue of discussion from here,
https://patchwork.kernel.org/patch/9986293/
that some users may want to handle all available clocks from device
tree without need to know the detailed clock information likes clock
numbers and names. This is useful in writing some generic drivers to
handle clock part.

Note:
This patch series is tested on MX6Q SDB cpufreq driver with a minor change
to switch to use clk_bulk_get_all.
But patch 4 only test compiling. Hopefully someone could help test
the function.

v2->v3:
 * address all comments from Stephen
 * fix build warnings on other architectures.
v1->v2:
 * add clk_bulk_{get|put}_all() which only supports DT platform currently
 * remove _all variants and the wrapper struct clk_bulk
 * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
   proves they need it because they don't have a struct device pointer.

Dong Aisheng (4):
  clk: bulk: add of_clk_bulk_get()
  clk: add new APIs to operate on all available clocks
  clk: add managed version of clk_bulk_get_all
  video: simplefb: switch to use clk_bulk API to simplify clock
    operations

 drivers/clk/clk-bulk.c         | 80 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/clk-devres.c       | 24 +++++++++++++
 drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
 include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
 4 files changed, 180 insertions(+), 55 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH V3 1/4] clk: bulk: add of_clk_bulk_get()
  2018-05-25 10:37 ` Dong Aisheng
@ 2018-05-25 10:37   ` Dong Aisheng
  -1 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, linux-arm-kernel, sboyd, mturquette, shawnguo,
	linux-imx, Dong Aisheng, Stephen Boyd, Russell King

'clock-names' property is optional in DT, so of_clk_bulk_get() is
introduced here to handle this for DT users without 'clock-names'
specified. Later clk_bulk_get_all() will be implemented on top of
it and this API will be kept private until someone proves they need
it because they don't have a struct device pointer.

Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Russell King <linux@arm.linux.org.uk>
Reported-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v2->v3:
 * remove #if define condition
 * remove EXPORT_SYMBOL
---
 drivers/clk/clk-bulk.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
index 6904ed6..4460ac5 100644
--- a/drivers/clk/clk-bulk.c
+++ b/drivers/clk/clk-bulk.c
@@ -19,6 +19,35 @@
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/export.h>
+#include <linux/of.h>
+
+static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
+					struct clk_bulk_data *clks)
+{
+	int ret;
+	int i;
+
+	for (i = 0; i < num_clks; i++)
+		clks[i].clk = NULL;
+
+	for (i = 0; i < num_clks; i++) {
+		clks[i].clk = of_clk_get(np, i);
+		if (IS_ERR(clks[i].clk)) {
+			ret = PTR_ERR(clks[i].clk);
+			pr_err("%pOF: Failed to get clk index: %d ret: %d\n",
+			       np, i, ret);
+			clks[i].clk = NULL;
+			goto err;
+		}
+	}
+
+	return 0;
+
+err:
+	clk_bulk_put(i, clks);
+
+	return ret;
+}
 
 void clk_bulk_put(int num_clks, struct clk_bulk_data *clks)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH V3 1/4] clk: bulk: add of_clk_bulk_get()
@ 2018-05-25 10:37   ` Dong Aisheng
  0 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

'clock-names' property is optional in DT, so of_clk_bulk_get() is
introduced here to handle this for DT users without 'clock-names'
specified. Later clk_bulk_get_all() will be implemented on top of
it and this API will be kept private until someone proves they need
it because they don't have a struct device pointer.

Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Russell King <linux@arm.linux.org.uk>
Reported-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v2->v3:
 * remove #if define condition
 * remove EXPORT_SYMBOL
---
 drivers/clk/clk-bulk.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
index 6904ed6..4460ac5 100644
--- a/drivers/clk/clk-bulk.c
+++ b/drivers/clk/clk-bulk.c
@@ -19,6 +19,35 @@
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/export.h>
+#include <linux/of.h>
+
+static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
+					struct clk_bulk_data *clks)
+{
+	int ret;
+	int i;
+
+	for (i = 0; i < num_clks; i++)
+		clks[i].clk = NULL;
+
+	for (i = 0; i < num_clks; i++) {
+		clks[i].clk = of_clk_get(np, i);
+		if (IS_ERR(clks[i].clk)) {
+			ret = PTR_ERR(clks[i].clk);
+			pr_err("%pOF: Failed to get clk index: %d ret: %d\n",
+			       np, i, ret);
+			clks[i].clk = NULL;
+			goto err;
+		}
+	}
+
+	return 0;
+
+err:
+	clk_bulk_put(i, clks);
+
+	return ret;
+}
 
 void clk_bulk_put(int num_clks, struct clk_bulk_data *clks)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH V3 2/4] clk: add new APIs to operate on all available clocks
  2018-05-25 10:37 ` Dong Aisheng
@ 2018-05-25 10:37   ` Dong Aisheng
  -1 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, linux-arm-kernel, sboyd, mturquette, shawnguo,
	linux-imx, Dong Aisheng, Stephen Boyd, Masahiro Yamada

This patch introduces of_clk_bulk_get_all and clk_bulk_x_all APIs
to users who just want to handle all available clocks from device tree
without need to know the detailed clock information likes clock numbers
and names. This is useful in writing some generic drivers to handle clock
part.

Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v2->v3:
 * remove #if define condition
 * use kmalloc_array
v1->v2:
 * make of_clk_bulk_get_all private
 * add clk_bulk_get/put_all
---
 drivers/clk/clk-bulk.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/clk.h    | 42 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 92 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
index 4460ac5..6a7118d 100644
--- a/drivers/clk/clk-bulk.c
+++ b/drivers/clk/clk-bulk.c
@@ -17,9 +17,11 @@
  */
 
 #include <linux/clk.h>
+#include <linux/clk-provider.h>
 #include <linux/device.h>
 #include <linux/export.h>
 #include <linux/of.h>
+#include <linux/slab.h>
 
 static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
 					struct clk_bulk_data *clks)
@@ -49,6 +51,32 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
 	return ret;
 }
 
+static int __must_check of_clk_bulk_get_all(struct device_node *np,
+					    struct clk_bulk_data **clks)
+{
+	struct clk_bulk_data *clk_bulk;
+	int num_clks;
+	int ret;
+
+	num_clks = of_clk_get_parent_count(np);
+	if (!num_clks)
+		return 0;
+
+	clk_bulk = kmalloc_array(num_clks, sizeof(*clk_bulk), GFP_KERNEL);
+	if (!clk_bulk)
+		return -ENOMEM;
+
+	ret = of_clk_bulk_get(np, num_clks, clk_bulk);
+	if (ret) {
+		kfree(clk_bulk);
+		return ret;
+	}
+
+	*clks = clk_bulk;
+
+	return num_clks;
+}
+
 void clk_bulk_put(int num_clks, struct clk_bulk_data *clks)
 {
 	while (--num_clks >= 0) {
@@ -88,6 +116,29 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks,
 }
 EXPORT_SYMBOL(clk_bulk_get);
 
+void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks)
+{
+	if (IS_ERR_OR_NULL(clks))
+		return;
+
+	clk_bulk_put(num_clks, clks);
+
+	kfree(clks);
+}
+EXPORT_SYMBOL(clk_bulk_put_all);
+
+int __must_check clk_bulk_get_all(struct device *dev,
+				  struct clk_bulk_data **clks)
+{
+	struct device_node *np = dev_of_node(dev);
+
+	if (!np)
+		return 0;
+
+	return of_clk_bulk_get_all(np, clks);
+}
+EXPORT_SYMBOL(clk_bulk_get_all);
+
 #ifdef CONFIG_HAVE_CLK_PREPARE
 
 /**
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 0dbd088..a76fdff 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -279,7 +279,26 @@ struct clk *clk_get(struct device *dev, const char *id);
  */
 int __must_check clk_bulk_get(struct device *dev, int num_clks,
 			      struct clk_bulk_data *clks);
-
+/**
+ * clk_bulk_get_all - lookup and obtain all available references to clock
+ *		      producer.
+ * @dev: device for clock "consumer"
+ * @clks: pointer to the clk_bulk_data table of consumer
+ *
+ * This helper function allows drivers to get all clk consumers in one
+ * operation. If any of the clk cannot be acquired then any clks
+ * that were obtained will be freed before returning to the caller.
+ *
+ * Returns a positive value for the number of clocks obtained while the
+ * clock references are stored in the clk_bulk_data table in @clks field.
+ * Returns 0 if there're none and a negative value if something failed.
+ *
+ * Drivers must assume that the clock source is not enabled.
+ *
+ * clk_bulk_get should not be called from within interrupt context.
+ */
+int __must_check clk_bulk_get_all(struct device *dev,
+				  struct clk_bulk_data **clks);
 /**
  * devm_clk_bulk_get - managed get multiple clk consumers
  * @dev: device for clock "consumer"
@@ -455,6 +474,19 @@ void clk_put(struct clk *clk);
 void clk_bulk_put(int num_clks, struct clk_bulk_data *clks);
 
 /**
+ * clk_bulk_put_all - "free" all the clock source
+ * @num_clks: the number of clk_bulk_data
+ * @clks: the clk_bulk_data table of consumer
+ *
+ * Note: drivers must ensure that all clk_bulk_enable calls made on this
+ * clock source are balanced by clk_bulk_disable calls prior to calling
+ * this function.
+ *
+ * clk_bulk_put_all should not be called from within interrupt context.
+ */
+void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks);
+
+/**
  * devm_clk_put	- "free" a managed clock source
  * @dev: device used to acquire the clock
  * @clk: clock source acquired with devm_clk_get()
@@ -609,6 +641,12 @@ static inline int __must_check clk_bulk_get(struct device *dev, int num_clks,
 	return 0;
 }
 
+static inline int __must_check clk_bulk_get_all(struct device *dev,
+					 struct clk_bulk_data **clks)
+{
+	return 0;
+}
+
 static inline struct clk *devm_clk_get(struct device *dev, const char *id)
 {
 	return NULL;
@@ -630,6 +668,8 @@ static inline void clk_put(struct clk *clk) {}
 
 static inline void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) {}
 
+static inline void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks) {}
+
 static inline void devm_clk_put(struct device *dev, struct clk *clk) {}
 
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH V3 2/4] clk: add new APIs to operate on all available clocks
@ 2018-05-25 10:37   ` Dong Aisheng
  0 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

This patch introduces of_clk_bulk_get_all and clk_bulk_x_all APIs
to users who just want to handle all available clocks from device tree
without need to know the detailed clock information likes clock numbers
and names. This is useful in writing some generic drivers to handle clock
part.

Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v2->v3:
 * remove #if define condition
 * use kmalloc_array
v1->v2:
 * make of_clk_bulk_get_all private
 * add clk_bulk_get/put_all
---
 drivers/clk/clk-bulk.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/clk.h    | 42 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 92 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
index 4460ac5..6a7118d 100644
--- a/drivers/clk/clk-bulk.c
+++ b/drivers/clk/clk-bulk.c
@@ -17,9 +17,11 @@
  */
 
 #include <linux/clk.h>
+#include <linux/clk-provider.h>
 #include <linux/device.h>
 #include <linux/export.h>
 #include <linux/of.h>
+#include <linux/slab.h>
 
 static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
 					struct clk_bulk_data *clks)
@@ -49,6 +51,32 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
 	return ret;
 }
 
+static int __must_check of_clk_bulk_get_all(struct device_node *np,
+					    struct clk_bulk_data **clks)
+{
+	struct clk_bulk_data *clk_bulk;
+	int num_clks;
+	int ret;
+
+	num_clks = of_clk_get_parent_count(np);
+	if (!num_clks)
+		return 0;
+
+	clk_bulk = kmalloc_array(num_clks, sizeof(*clk_bulk), GFP_KERNEL);
+	if (!clk_bulk)
+		return -ENOMEM;
+
+	ret = of_clk_bulk_get(np, num_clks, clk_bulk);
+	if (ret) {
+		kfree(clk_bulk);
+		return ret;
+	}
+
+	*clks = clk_bulk;
+
+	return num_clks;
+}
+
 void clk_bulk_put(int num_clks, struct clk_bulk_data *clks)
 {
 	while (--num_clks >= 0) {
@@ -88,6 +116,29 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks,
 }
 EXPORT_SYMBOL(clk_bulk_get);
 
+void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks)
+{
+	if (IS_ERR_OR_NULL(clks))
+		return;
+
+	clk_bulk_put(num_clks, clks);
+
+	kfree(clks);
+}
+EXPORT_SYMBOL(clk_bulk_put_all);
+
+int __must_check clk_bulk_get_all(struct device *dev,
+				  struct clk_bulk_data **clks)
+{
+	struct device_node *np = dev_of_node(dev);
+
+	if (!np)
+		return 0;
+
+	return of_clk_bulk_get_all(np, clks);
+}
+EXPORT_SYMBOL(clk_bulk_get_all);
+
 #ifdef CONFIG_HAVE_CLK_PREPARE
 
 /**
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 0dbd088..a76fdff 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -279,7 +279,26 @@ struct clk *clk_get(struct device *dev, const char *id);
  */
 int __must_check clk_bulk_get(struct device *dev, int num_clks,
 			      struct clk_bulk_data *clks);
-
+/**
+ * clk_bulk_get_all - lookup and obtain all available references to clock
+ *		      producer.
+ * @dev: device for clock "consumer"
+ * @clks: pointer to the clk_bulk_data table of consumer
+ *
+ * This helper function allows drivers to get all clk consumers in one
+ * operation. If any of the clk cannot be acquired then any clks
+ * that were obtained will be freed before returning to the caller.
+ *
+ * Returns a positive value for the number of clocks obtained while the
+ * clock references are stored in the clk_bulk_data table in @clks field.
+ * Returns 0 if there're none and a negative value if something failed.
+ *
+ * Drivers must assume that the clock source is not enabled.
+ *
+ * clk_bulk_get should not be called from within interrupt context.
+ */
+int __must_check clk_bulk_get_all(struct device *dev,
+				  struct clk_bulk_data **clks);
 /**
  * devm_clk_bulk_get - managed get multiple clk consumers
  * @dev: device for clock "consumer"
@@ -455,6 +474,19 @@ void clk_put(struct clk *clk);
 void clk_bulk_put(int num_clks, struct clk_bulk_data *clks);
 
 /**
+ * clk_bulk_put_all - "free" all the clock source
+ * @num_clks: the number of clk_bulk_data
+ * @clks: the clk_bulk_data table of consumer
+ *
+ * Note: drivers must ensure that all clk_bulk_enable calls made on this
+ * clock source are balanced by clk_bulk_disable calls prior to calling
+ * this function.
+ *
+ * clk_bulk_put_all should not be called from within interrupt context.
+ */
+void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks);
+
+/**
  * devm_clk_put	- "free" a managed clock source
  * @dev: device used to acquire the clock
  * @clk: clock source acquired with devm_clk_get()
@@ -609,6 +641,12 @@ static inline int __must_check clk_bulk_get(struct device *dev, int num_clks,
 	return 0;
 }
 
+static inline int __must_check clk_bulk_get_all(struct device *dev,
+					 struct clk_bulk_data **clks)
+{
+	return 0;
+}
+
 static inline struct clk *devm_clk_get(struct device *dev, const char *id)
 {
 	return NULL;
@@ -630,6 +668,8 @@ static inline void clk_put(struct clk *clk) {}
 
 static inline void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) {}
 
+static inline void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks) {}
+
 static inline void devm_clk_put(struct device *dev, struct clk *clk) {}
 
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH V3 3/4] clk: add managed version of clk_bulk_get_all
  2018-05-25 10:37 ` Dong Aisheng
@ 2018-05-25 10:37   ` Dong Aisheng
  -1 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, linux-arm-kernel, sboyd, mturquette, shawnguo,
	linux-imx, Dong Aisheng, Stephen Boyd

This patch introduces the managed version of clk_bulk_get_all.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v2->v3:
 * a minor fix of build warning on PowerPC platform.
v1->v2:
 * new patch
---
 drivers/clk/clk-devres.c | 24 ++++++++++++++++++++++++
 include/linux/clk.h      | 23 +++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
index d854e26..6d3ca5e 100644
--- a/drivers/clk/clk-devres.c
+++ b/drivers/clk/clk-devres.c
@@ -70,6 +70,30 @@ int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
 }
 EXPORT_SYMBOL_GPL(devm_clk_bulk_get);
 
+int __must_check devm_clk_bulk_get_all(struct device *dev,
+				       struct clk_bulk_data **clks)
+{
+	struct clk_bulk_devres *devres;
+	int ret;
+
+	devres = devres_alloc(devm_clk_bulk_release,
+			      sizeof(*devres), GFP_KERNEL);
+	if (!devres)
+		return -ENOMEM;
+
+	ret = clk_bulk_get_all(dev, clks);
+	if (ret > 0) {
+		devres->clks = *clks;
+		devres->num_clks = ret;
+		devres_add(dev, devres);
+	} else {
+		devres_free(devres);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all);
+
 static int devm_clk_match(struct device *dev, void *res, void *data)
 {
 	struct clk **c = res;
diff --git a/include/linux/clk.h b/include/linux/clk.h
index a76fdff..ef20217 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -313,6 +313,22 @@ int __must_check clk_bulk_get_all(struct device *dev,
  */
 int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
 				   struct clk_bulk_data *clks);
+/**
+ * devm_clk_bulk_get_all - managed get multiple clk consumers
+ * @dev: device for clock "consumer"
+ * @clks: pointer to the clk_bulk_data table of consumer
+ *
+ * Returns a positive value for the number of clocks obtained while the
+ * clock references are stored in the clk_bulk_data table in @clks field.
+ * Returns 0 if there're none and a negative value if something failed.
+ *
+ * This helper function allows drivers to get several clk
+ * consumers in one operation with management, the clks will
+ * automatically be freed when the device is unbound.
+ */
+
+int __must_check devm_clk_bulk_get_all(struct device *dev,
+				       struct clk_bulk_data **clks);
 
 /**
  * devm_clk_get - lookup and obtain a managed reference to a clock producer.
@@ -658,6 +674,13 @@ static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clk
 	return 0;
 }
 
+static inline int __must_check devm_clk_bulk_get_all(struct device *dev,
+						     struct clk_bulk_data **clks)
+{
+
+	return 0;
+}
+
 static inline struct clk *devm_get_clk_from_child(struct device *dev,
 				struct device_node *np, const char *con_id)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH V3 3/4] clk: add managed version of clk_bulk_get_all
@ 2018-05-25 10:37   ` Dong Aisheng
  0 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

This patch introduces the managed version of clk_bulk_get_all.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v2->v3:
 * a minor fix of build warning on PowerPC platform.
v1->v2:
 * new patch
---
 drivers/clk/clk-devres.c | 24 ++++++++++++++++++++++++
 include/linux/clk.h      | 23 +++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
index d854e26..6d3ca5e 100644
--- a/drivers/clk/clk-devres.c
+++ b/drivers/clk/clk-devres.c
@@ -70,6 +70,30 @@ int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
 }
 EXPORT_SYMBOL_GPL(devm_clk_bulk_get);
 
+int __must_check devm_clk_bulk_get_all(struct device *dev,
+				       struct clk_bulk_data **clks)
+{
+	struct clk_bulk_devres *devres;
+	int ret;
+
+	devres = devres_alloc(devm_clk_bulk_release,
+			      sizeof(*devres), GFP_KERNEL);
+	if (!devres)
+		return -ENOMEM;
+
+	ret = clk_bulk_get_all(dev, clks);
+	if (ret > 0) {
+		devres->clks = *clks;
+		devres->num_clks = ret;
+		devres_add(dev, devres);
+	} else {
+		devres_free(devres);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all);
+
 static int devm_clk_match(struct device *dev, void *res, void *data)
 {
 	struct clk **c = res;
diff --git a/include/linux/clk.h b/include/linux/clk.h
index a76fdff..ef20217 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -313,6 +313,22 @@ int __must_check clk_bulk_get_all(struct device *dev,
  */
 int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
 				   struct clk_bulk_data *clks);
+/**
+ * devm_clk_bulk_get_all - managed get multiple clk consumers
+ * @dev: device for clock "consumer"
+ * @clks: pointer to the clk_bulk_data table of consumer
+ *
+ * Returns a positive value for the number of clocks obtained while the
+ * clock references are stored in the clk_bulk_data table in @clks field.
+ * Returns 0 if there're none and a negative value if something failed.
+ *
+ * This helper function allows drivers to get several clk
+ * consumers in one operation with management, the clks will
+ * automatically be freed when the device is unbound.
+ */
+
+int __must_check devm_clk_bulk_get_all(struct device *dev,
+				       struct clk_bulk_data **clks);
 
 /**
  * devm_clk_get - lookup and obtain a managed reference to a clock producer.
@@ -658,6 +674,13 @@ static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clk
 	return 0;
 }
 
+static inline int __must_check devm_clk_bulk_get_all(struct device *dev,
+						     struct clk_bulk_data **clks)
+{
+
+	return 0;
+}
+
 static inline struct clk *devm_get_clk_from_child(struct device *dev,
 				struct device_node *np, const char *con_id)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH V3 4/4] video: simplefb: switch to use clk_bulk API to simplify clock operations
  2018-05-25 10:37 ` Dong Aisheng
  (?)
@ 2018-05-25 10:37   ` Dong Aisheng
  -1 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, linux-arm-kernel, sboyd, mturquette, shawnguo,
	linux-imx, Dong Aisheng, Hans de Goede,
	Bartlomiej Zolnierkiewicz, linux-fbdev, Masahiro Yamada,
	Stephen Boyd

Switching to use clk_bulk API to simplify clock operations.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v2->v3:
 * fix a build warning on x86 platform due to a wrong
   of the prototype of simplefb_clocks_enable
v1->v2:
 * switch to clk_bulk_get_all from of_clk_bulk_get_all
---
 drivers/video/fbdev/simplefb.c | 66 ++++++++----------------------------------
 1 file changed, 12 insertions(+), 54 deletions(-)

diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
index a3c44ec..db74354 100644
--- a/drivers/video/fbdev/simplefb.c
+++ b/drivers/video/fbdev/simplefb.c
@@ -182,7 +182,7 @@ struct simplefb_par {
 #if defined CONFIG_OF && defined CONFIG_COMMON_CLK
 	bool clks_enabled;
 	unsigned int clk_count;
-	struct clk **clks;
+	struct clk_bulk_data *clks;
 #endif
 #if defined CONFIG_OF && defined CONFIG_REGULATOR
 	bool regulators_enabled;
@@ -214,37 +214,13 @@ static int simplefb_clocks_get(struct simplefb_par *par,
 			       struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	struct clk *clock;
-	int i;
 
 	if (dev_get_platdata(&pdev->dev) || !np)
 		return 0;
 
-	par->clk_count = of_clk_get_parent_count(np);
-	if (!par->clk_count)
-		return 0;
-
-	par->clks = kcalloc(par->clk_count, sizeof(struct clk *), GFP_KERNEL);
-	if (!par->clks)
-		return -ENOMEM;
-
-	for (i = 0; i < par->clk_count; i++) {
-		clock = of_clk_get(np, i);
-		if (IS_ERR(clock)) {
-			if (PTR_ERR(clock) == -EPROBE_DEFER) {
-				while (--i >= 0) {
-					if (par->clks[i])
-						clk_put(par->clks[i]);
-				}
-				kfree(par->clks);
-				return -EPROBE_DEFER;
-			}
-			dev_err(&pdev->dev, "%s: clock %d not found: %ld\n",
-				__func__, i, PTR_ERR(clock));
-			continue;
-		}
-		par->clks[i] = clock;
-	}
+	par->clk_count = clk_bulk_get_all(&pdev->dev, &par->clks);
+	if ((par->clk_count < 0) && (par->clk_count == -EPROBE_DEFER))
+		return -EPROBE_DEFER;
 
 	return 0;
 }
@@ -252,39 +228,21 @@ static int simplefb_clocks_get(struct simplefb_par *par,
 static void simplefb_clocks_enable(struct simplefb_par *par,
 				   struct platform_device *pdev)
 {
-	int i, ret;
+	int ret;
+
+	ret = clk_bulk_prepare_enable(par->clk_count, par->clks);
+	if (ret)
+		dev_warn(&pdev->dev, "failed to enable clocks\n");
 
-	for (i = 0; i < par->clk_count; i++) {
-		if (par->clks[i]) {
-			ret = clk_prepare_enable(par->clks[i]);
-			if (ret) {
-				dev_err(&pdev->dev,
-					"%s: failed to enable clock %d: %d\n",
-					__func__, i, ret);
-				clk_put(par->clks[i]);
-				par->clks[i] = NULL;
-			}
-		}
-	}
 	par->clks_enabled = true;
 }
 
 static void simplefb_clocks_destroy(struct simplefb_par *par)
 {
-	int i;
-
-	if (!par->clks)
-		return;
-
-	for (i = 0; i < par->clk_count; i++) {
-		if (par->clks[i]) {
-			if (par->clks_enabled)
-				clk_disable_unprepare(par->clks[i]);
-			clk_put(par->clks[i]);
-		}
-	}
+	if (par->clks_enabled)
+		clk_bulk_disable_unprepare(par->clk_count, par->clks);
 
-	kfree(par->clks);
+	clk_bulk_put_all(par->clk_count, par->clks);
 }
 #else
 static int simplefb_clocks_get(struct simplefb_par *par,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH V3 4/4] video: simplefb: switch to use clk_bulk API to simplify clock operations
@ 2018-05-25 10:37   ` Dong Aisheng
  0 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

Switching to use clk_bulk API to simplify clock operations.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v2->v3:
 * fix a build warning on x86 platform due to a wrong
   of the prototype of simplefb_clocks_enable
v1->v2:
 * switch to clk_bulk_get_all from of_clk_bulk_get_all
---
 drivers/video/fbdev/simplefb.c | 66 ++++++++----------------------------------
 1 file changed, 12 insertions(+), 54 deletions(-)

diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
index a3c44ec..db74354 100644
--- a/drivers/video/fbdev/simplefb.c
+++ b/drivers/video/fbdev/simplefb.c
@@ -182,7 +182,7 @@ struct simplefb_par {
 #if defined CONFIG_OF && defined CONFIG_COMMON_CLK
 	bool clks_enabled;
 	unsigned int clk_count;
-	struct clk **clks;
+	struct clk_bulk_data *clks;
 #endif
 #if defined CONFIG_OF && defined CONFIG_REGULATOR
 	bool regulators_enabled;
@@ -214,37 +214,13 @@ static int simplefb_clocks_get(struct simplefb_par *par,
 			       struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	struct clk *clock;
-	int i;
 
 	if (dev_get_platdata(&pdev->dev) || !np)
 		return 0;
 
-	par->clk_count = of_clk_get_parent_count(np);
-	if (!par->clk_count)
-		return 0;
-
-	par->clks = kcalloc(par->clk_count, sizeof(struct clk *), GFP_KERNEL);
-	if (!par->clks)
-		return -ENOMEM;
-
-	for (i = 0; i < par->clk_count; i++) {
-		clock = of_clk_get(np, i);
-		if (IS_ERR(clock)) {
-			if (PTR_ERR(clock) = -EPROBE_DEFER) {
-				while (--i >= 0) {
-					if (par->clks[i])
-						clk_put(par->clks[i]);
-				}
-				kfree(par->clks);
-				return -EPROBE_DEFER;
-			}
-			dev_err(&pdev->dev, "%s: clock %d not found: %ld\n",
-				__func__, i, PTR_ERR(clock));
-			continue;
-		}
-		par->clks[i] = clock;
-	}
+	par->clk_count = clk_bulk_get_all(&pdev->dev, &par->clks);
+	if ((par->clk_count < 0) && (par->clk_count = -EPROBE_DEFER))
+		return -EPROBE_DEFER;
 
 	return 0;
 }
@@ -252,39 +228,21 @@ static int simplefb_clocks_get(struct simplefb_par *par,
 static void simplefb_clocks_enable(struct simplefb_par *par,
 				   struct platform_device *pdev)
 {
-	int i, ret;
+	int ret;
+
+	ret = clk_bulk_prepare_enable(par->clk_count, par->clks);
+	if (ret)
+		dev_warn(&pdev->dev, "failed to enable clocks\n");
 
-	for (i = 0; i < par->clk_count; i++) {
-		if (par->clks[i]) {
-			ret = clk_prepare_enable(par->clks[i]);
-			if (ret) {
-				dev_err(&pdev->dev,
-					"%s: failed to enable clock %d: %d\n",
-					__func__, i, ret);
-				clk_put(par->clks[i]);
-				par->clks[i] = NULL;
-			}
-		}
-	}
 	par->clks_enabled = true;
 }
 
 static void simplefb_clocks_destroy(struct simplefb_par *par)
 {
-	int i;
-
-	if (!par->clks)
-		return;
-
-	for (i = 0; i < par->clk_count; i++) {
-		if (par->clks[i]) {
-			if (par->clks_enabled)
-				clk_disable_unprepare(par->clks[i]);
-			clk_put(par->clks[i]);
-		}
-	}
+	if (par->clks_enabled)
+		clk_bulk_disable_unprepare(par->clk_count, par->clks);
 
-	kfree(par->clks);
+	clk_bulk_put_all(par->clk_count, par->clks);
 }
 #else
 static int simplefb_clocks_get(struct simplefb_par *par,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH V3 4/4] video: simplefb: switch to use clk_bulk API to simplify clock operations
@ 2018-05-25 10:37   ` Dong Aisheng
  0 siblings, 0 replies; 26+ messages in thread
From: Dong Aisheng @ 2018-05-25 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

Switching to use clk_bulk API to simplify clock operations.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: linux-fbdev at vger.kernel.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
v2->v3:
 * fix a build warning on x86 platform due to a wrong
   of the prototype of simplefb_clocks_enable
v1->v2:
 * switch to clk_bulk_get_all from of_clk_bulk_get_all
---
 drivers/video/fbdev/simplefb.c | 66 ++++++++----------------------------------
 1 file changed, 12 insertions(+), 54 deletions(-)

diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
index a3c44ec..db74354 100644
--- a/drivers/video/fbdev/simplefb.c
+++ b/drivers/video/fbdev/simplefb.c
@@ -182,7 +182,7 @@ struct simplefb_par {
 #if defined CONFIG_OF && defined CONFIG_COMMON_CLK
 	bool clks_enabled;
 	unsigned int clk_count;
-	struct clk **clks;
+	struct clk_bulk_data *clks;
 #endif
 #if defined CONFIG_OF && defined CONFIG_REGULATOR
 	bool regulators_enabled;
@@ -214,37 +214,13 @@ static int simplefb_clocks_get(struct simplefb_par *par,
 			       struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	struct clk *clock;
-	int i;
 
 	if (dev_get_platdata(&pdev->dev) || !np)
 		return 0;
 
-	par->clk_count = of_clk_get_parent_count(np);
-	if (!par->clk_count)
-		return 0;
-
-	par->clks = kcalloc(par->clk_count, sizeof(struct clk *), GFP_KERNEL);
-	if (!par->clks)
-		return -ENOMEM;
-
-	for (i = 0; i < par->clk_count; i++) {
-		clock = of_clk_get(np, i);
-		if (IS_ERR(clock)) {
-			if (PTR_ERR(clock) == -EPROBE_DEFER) {
-				while (--i >= 0) {
-					if (par->clks[i])
-						clk_put(par->clks[i]);
-				}
-				kfree(par->clks);
-				return -EPROBE_DEFER;
-			}
-			dev_err(&pdev->dev, "%s: clock %d not found: %ld\n",
-				__func__, i, PTR_ERR(clock));
-			continue;
-		}
-		par->clks[i] = clock;
-	}
+	par->clk_count = clk_bulk_get_all(&pdev->dev, &par->clks);
+	if ((par->clk_count < 0) && (par->clk_count == -EPROBE_DEFER))
+		return -EPROBE_DEFER;
 
 	return 0;
 }
@@ -252,39 +228,21 @@ static int simplefb_clocks_get(struct simplefb_par *par,
 static void simplefb_clocks_enable(struct simplefb_par *par,
 				   struct platform_device *pdev)
 {
-	int i, ret;
+	int ret;
+
+	ret = clk_bulk_prepare_enable(par->clk_count, par->clks);
+	if (ret)
+		dev_warn(&pdev->dev, "failed to enable clocks\n");
 
-	for (i = 0; i < par->clk_count; i++) {
-		if (par->clks[i]) {
-			ret = clk_prepare_enable(par->clks[i]);
-			if (ret) {
-				dev_err(&pdev->dev,
-					"%s: failed to enable clock %d: %d\n",
-					__func__, i, ret);
-				clk_put(par->clks[i]);
-				par->clks[i] = NULL;
-			}
-		}
-	}
 	par->clks_enabled = true;
 }
 
 static void simplefb_clocks_destroy(struct simplefb_par *par)
 {
-	int i;
-
-	if (!par->clks)
-		return;
-
-	for (i = 0; i < par->clk_count; i++) {
-		if (par->clks[i]) {
-			if (par->clks_enabled)
-				clk_disable_unprepare(par->clks[i]);
-			clk_put(par->clks[i]);
-		}
-	}
+	if (par->clks_enabled)
+		clk_bulk_disable_unprepare(par->clk_count, par->clks);
 
-	kfree(par->clks);
+	clk_bulk_put_all(par->clk_count, par->clks);
 }
 #else
 static int simplefb_clocks_get(struct simplefb_par *par,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
  2018-05-25 10:37 ` Dong Aisheng
  (?)
@ 2018-06-20  2:53   ` A.s. Dong
  -1 siblings, 0 replies; 26+ messages in thread
From: A.s. Dong @ 2018-06-20  2:53 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, linux-arm-kernel, sboyd, mturquette, shawnguo,
	dl-linux-imx

Ping....

> -----Original Message-----
> From: A.s. Dong
> Sent: Friday, May 25, 2018 6:37 PM
> To: linux-clk@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
> linux-imx <linux-imx@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>
> Subject: [PATCH V3 0/4] clk: new APIs to handle all available clocks
> 
> This patch series is a continue of discussion from here,
> https://patchwork.kernel.org/patch/9986293/
> that some users may want to handle all available clocks from device tree
> without need to know the detailed clock information likes clock numbers and
> names. This is useful in writing some generic drivers to handle clock part.
> 
> Note:
> This patch series is tested on MX6Q SDB cpufreq driver with a minor change
> to switch to use clk_bulk_get_all.
> But patch 4 only test compiling. Hopefully someone could help test the
> function.
> 
> v2->v3:
>  * address all comments from Stephen
>  * fix build warnings on other architectures.
> v1->v2:
>  * add clk_bulk_{get|put}_all() which only supports DT platform currently
>  * remove _all variants and the wrapper struct clk_bulk
>  * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
>    proves they need it because they don't have a struct device pointer.
> 
> Dong Aisheng (4):
>   clk: bulk: add of_clk_bulk_get()
>   clk: add new APIs to operate on all available clocks
>   clk: add managed version of clk_bulk_get_all
>   video: simplefb: switch to use clk_bulk API to simplify clock
>     operations
> 
>  drivers/clk/clk-bulk.c         | 80
> ++++++++++++++++++++++++++++++++++++++++++
>  drivers/clk/clk-devres.c       | 24 +++++++++++++
>  drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
>  include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
>  4 files changed, 180 insertions(+), 55 deletions(-)
> 
> --
> 2.7.4


^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-06-20  2:53   ` A.s. Dong
  0 siblings, 0 replies; 26+ messages in thread
From: A.s. Dong @ 2018-06-20  2:53 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, linux-arm-kernel, sboyd, mturquette, shawnguo,
	dl-linux-imx

Ping....

> -----Original Message-----
> From: A.s. Dong
> Sent: Friday, May 25, 2018 6:37 PM
> To: linux-clk@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
> linux-imx <linux-imx@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>
> Subject: [PATCH V3 0/4] clk: new APIs to handle all available clocks
>=20
> This patch series is a continue of discussion from here,
> https://patchwork.kernel.org/patch/9986293/
> that some users may want to handle all available clocks from device tree
> without need to know the detailed clock information likes clock numbers a=
nd
> names. This is useful in writing some generic drivers to handle clock par=
t.
>=20
> Note:
> This patch series is tested on MX6Q SDB cpufreq driver with a minor chang=
e
> to switch to use clk_bulk_get_all.
> But patch 4 only test compiling. Hopefully someone could help test the
> function.
>=20
> v2->v3:
>  * address all comments from Stephen
>  * fix build warnings on other architectures.
> v1->v2:
>  * add clk_bulk_{get|put}_all() which only supports DT platform currently
>  * remove _all variants and the wrapper struct clk_bulk
>  * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
>    proves they need it because they don't have a struct device pointer.
>=20
> Dong Aisheng (4):
>   clk: bulk: add of_clk_bulk_get()
>   clk: add new APIs to operate on all available clocks
>   clk: add managed version of clk_bulk_get_all
>   video: simplefb: switch to use clk_bulk API to simplify clock
>     operations
>=20
>  drivers/clk/clk-bulk.c         | 80
> ++++++++++++++++++++++++++++++++++++++++++
>  drivers/clk/clk-devres.c       | 24 +++++++++++++
>  drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
>  include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
>  4 files changed, 180 insertions(+), 55 deletions(-)
>=20
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-06-20  2:53   ` A.s. Dong
  0 siblings, 0 replies; 26+ messages in thread
From: A.s. Dong @ 2018-06-20  2:53 UTC (permalink / raw)
  To: linux-arm-kernel

Ping....

> -----Original Message-----
> From: A.s. Dong
> Sent: Friday, May 25, 2018 6:37 PM
> To: linux-clk at vger.kernel.org
> Cc: linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org;
> sboyd at kernel.org; mturquette at baylibre.com; shawnguo at kernel.org; dl-
> linux-imx <linux-imx@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>
> Subject: [PATCH V3 0/4] clk: new APIs to handle all available clocks
> 
> This patch series is a continue of discussion from here,
> https://patchwork.kernel.org/patch/9986293/
> that some users may want to handle all available clocks from device tree
> without need to know the detailed clock information likes clock numbers and
> names. This is useful in writing some generic drivers to handle clock part.
> 
> Note:
> This patch series is tested on MX6Q SDB cpufreq driver with a minor change
> to switch to use clk_bulk_get_all.
> But patch 4 only test compiling. Hopefully someone could help test the
> function.
> 
> v2->v3:
>  * address all comments from Stephen
>  * fix build warnings on other architectures.
> v1->v2:
>  * add clk_bulk_{get|put}_all() which only supports DT platform currently
>  * remove _all variants and the wrapper struct clk_bulk
>  * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
>    proves they need it because they don't have a struct device pointer.
> 
> Dong Aisheng (4):
>   clk: bulk: add of_clk_bulk_get()
>   clk: add new APIs to operate on all available clocks
>   clk: add managed version of clk_bulk_get_all
>   video: simplefb: switch to use clk_bulk API to simplify clock
>     operations
> 
>  drivers/clk/clk-bulk.c         | 80
> ++++++++++++++++++++++++++++++++++++++++++
>  drivers/clk/clk-devres.c       | 24 +++++++++++++
>  drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
>  include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
>  4 files changed, 180 insertions(+), 55 deletions(-)
> 
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
  2018-06-20  2:53   ` A.s. Dong
  (?)
@ 2018-08-17  2:33     ` A.s. Dong
  -1 siblings, 0 replies; 26+ messages in thread
From: A.s. Dong @ 2018-08-17  2:33 UTC (permalink / raw)
  To: sboyd
  Cc: linux-kernel, linux-arm-kernel, mturquette, shawnguo,
	dl-linux-imx, thor.thayer, linux-clk

Hi Stephen,

Do you want me to resend this series for review?
It seems have been pending for quite a long time.

Thor just pinged me for its status as he wants to use it.

Regards
Dong Aisheng

> -----Original Message-----
> From: A.s. Dong
> Sent: Wednesday, June 20, 2018 10:54 AM
> To: linux-clk@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
> linux-imx <linux-imx@nxp.com>
> Subject: RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
> 
> Ping....
> 
> > -----Original Message-----
> > From: A.s. Dong
> > Sent: Friday, May 25, 2018 6:37 PM
> > To: linux-clk@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org;
> > linux-arm-kernel@lists.infradead.org;
> > sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
> > linux-imx <linux-imx@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>
> > Subject: [PATCH V3 0/4] clk: new APIs to handle all available clocks
> >
> > This patch series is a continue of discussion from here,
> > https://patchwork.kernel.org/patch/9986293/
> > that some users may want to handle all available clocks from device
> > tree without need to know the detailed clock information likes clock
> > numbers and names. This is useful in writing some generic drivers to handle
> clock part.
> >
> > Note:
> > This patch series is tested on MX6Q SDB cpufreq driver with a minor
> > change to switch to use clk_bulk_get_all.
> > But patch 4 only test compiling. Hopefully someone could help test the
> > function.
> >
> > v2->v3:
> >  * address all comments from Stephen
> >  * fix build warnings on other architectures.
> > v1->v2:
> >  * add clk_bulk_{get|put}_all() which only supports DT platform
> > currently
> >  * remove _all variants and the wrapper struct clk_bulk
> >  * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
> >    proves they need it because they don't have a struct device pointer.
> >
> > Dong Aisheng (4):
> >   clk: bulk: add of_clk_bulk_get()
> >   clk: add new APIs to operate on all available clocks
> >   clk: add managed version of clk_bulk_get_all
> >   video: simplefb: switch to use clk_bulk API to simplify clock
> >     operations
> >
> >  drivers/clk/clk-bulk.c         | 80
> > ++++++++++++++++++++++++++++++++++++++++++
> >  drivers/clk/clk-devres.c       | 24 +++++++++++++
> >  drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
> >  include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
> >  4 files changed, 180 insertions(+), 55 deletions(-)
> >
> > --
> > 2.7.4


^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-08-17  2:33     ` A.s. Dong
  0 siblings, 0 replies; 26+ messages in thread
From: A.s. Dong @ 2018-08-17  2:33 UTC (permalink / raw)
  To: sboyd
  Cc: linux-kernel, linux-arm-kernel, mturquette, shawnguo,
	dl-linux-imx, thor.thayer, linux-clk

Hi Stephen,

Do you want me to resend this series for review?
It seems have been pending for quite a long time.

Thor just pinged me for its status as he wants to use it.

Regards
Dong Aisheng

> -----Original Message-----
> From: A.s. Dong
> Sent: Wednesday, June 20, 2018 10:54 AM
> To: linux-clk@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
> linux-imx <linux-imx@nxp.com>
> Subject: RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
>=20
> Ping....
>=20
> > -----Original Message-----
> > From: A.s. Dong
> > Sent: Friday, May 25, 2018 6:37 PM
> > To: linux-clk@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org;
> > linux-arm-kernel@lists.infradead.org;
> > sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
> > linux-imx <linux-imx@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>
> > Subject: [PATCH V3 0/4] clk: new APIs to handle all available clocks
> >
> > This patch series is a continue of discussion from here,
> > https://patchwork.kernel.org/patch/9986293/
> > that some users may want to handle all available clocks from device
> > tree without need to know the detailed clock information likes clock
> > numbers and names. This is useful in writing some generic drivers to ha=
ndle
> clock part.
> >
> > Note:
> > This patch series is tested on MX6Q SDB cpufreq driver with a minor
> > change to switch to use clk_bulk_get_all.
> > But patch 4 only test compiling. Hopefully someone could help test the
> > function.
> >
> > v2->v3:
> >  * address all comments from Stephen
> >  * fix build warnings on other architectures.
> > v1->v2:
> >  * add clk_bulk_{get|put}_all() which only supports DT platform
> > currently
> >  * remove _all variants and the wrapper struct clk_bulk
> >  * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
> >    proves they need it because they don't have a struct device pointer.
> >
> > Dong Aisheng (4):
> >   clk: bulk: add of_clk_bulk_get()
> >   clk: add new APIs to operate on all available clocks
> >   clk: add managed version of clk_bulk_get_all
> >   video: simplefb: switch to use clk_bulk API to simplify clock
> >     operations
> >
> >  drivers/clk/clk-bulk.c         | 80
> > ++++++++++++++++++++++++++++++++++++++++++
> >  drivers/clk/clk-devres.c       | 24 +++++++++++++
> >  drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
> >  include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
> >  4 files changed, 180 insertions(+), 55 deletions(-)
> >
> > --
> > 2.7.4

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-08-17  2:33     ` A.s. Dong
  0 siblings, 0 replies; 26+ messages in thread
From: A.s. Dong @ 2018-08-17  2:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stephen,

Do you want me to resend this series for review?
It seems have been pending for quite a long time.

Thor just pinged me for its status as he wants to use it.

Regards
Dong Aisheng

> -----Original Message-----
> From: A.s. Dong
> Sent: Wednesday, June 20, 2018 10:54 AM
> To: linux-clk at vger.kernel.org
> Cc: linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org;
> sboyd at kernel.org; mturquette at baylibre.com; shawnguo at kernel.org; dl-
> linux-imx <linux-imx@nxp.com>
> Subject: RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
> 
> Ping....
> 
> > -----Original Message-----
> > From: A.s. Dong
> > Sent: Friday, May 25, 2018 6:37 PM
> > To: linux-clk at vger.kernel.org
> > Cc: linux-kernel at vger.kernel.org;
> > linux-arm-kernel at lists.infradead.org;
> > sboyd at kernel.org; mturquette at baylibre.com; shawnguo at kernel.org; dl-
> > linux-imx <linux-imx@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>
> > Subject: [PATCH V3 0/4] clk: new APIs to handle all available clocks
> >
> > This patch series is a continue of discussion from here,
> > https://patchwork.kernel.org/patch/9986293/
> > that some users may want to handle all available clocks from device
> > tree without need to know the detailed clock information likes clock
> > numbers and names. This is useful in writing some generic drivers to handle
> clock part.
> >
> > Note:
> > This patch series is tested on MX6Q SDB cpufreq driver with a minor
> > change to switch to use clk_bulk_get_all.
> > But patch 4 only test compiling. Hopefully someone could help test the
> > function.
> >
> > v2->v3:
> >  * address all comments from Stephen
> >  * fix build warnings on other architectures.
> > v1->v2:
> >  * add clk_bulk_{get|put}_all() which only supports DT platform
> > currently
> >  * remove _all variants and the wrapper struct clk_bulk
> >  * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
> >    proves they need it because they don't have a struct device pointer.
> >
> > Dong Aisheng (4):
> >   clk: bulk: add of_clk_bulk_get()
> >   clk: add new APIs to operate on all available clocks
> >   clk: add managed version of clk_bulk_get_all
> >   video: simplefb: switch to use clk_bulk API to simplify clock
> >     operations
> >
> >  drivers/clk/clk-bulk.c         | 80
> > ++++++++++++++++++++++++++++++++++++++++++
> >  drivers/clk/clk-devres.c       | 24 +++++++++++++
> >  drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
> >  include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
> >  4 files changed, 180 insertions(+), 55 deletions(-)
> >
> > --
> > 2.7.4

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH V3 0/4] clk: new APIs to handle all available clocks
  2018-08-17  2:33     ` A.s. Dong
  (?)
@ 2018-08-20 16:32       ` Thor Thayer
  -1 siblings, 0 replies; 26+ messages in thread
From: Thor Thayer @ 2018-08-20 16:32 UTC (permalink / raw)
  To: A.s. Dong, sboyd, mturquette
  Cc: linux-kernel, linux-arm-kernel, shawnguo, dl-linux-imx, linux-clk

Hi,

On 08/16/2018 09:33 PM, A.s. Dong wrote:
> Hi Stephen,
> 
> Do you want me to resend this series for review?
> It seems have been pending for quite a long time.
> 
> Thor just pinged me for its status as he wants to use it.
> 
> Regards
> Dong Aisheng
> 
>> -----Original Message-----
>> From: A.s. Dong
>> Sent: Wednesday, June 20, 2018 10:54 AM
>> To: linux-clk@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
>> sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
>> linux-imx <linux-imx@nxp.com>
>> Subject: RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
>>
>> Ping....
>>
>>> -----Original Message-----
>>> From: A.s. Dong
>>> Sent: Friday, May 25, 2018 6:37 PM
>>> To: linux-clk@vger.kernel.org
>>> Cc: linux-kernel@vger.kernel.org;
>>> linux-arm-kernel@lists.infradead.org;
>>> sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
>>> linux-imx <linux-imx@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>
>>> Subject: [PATCH V3 0/4] clk: new APIs to handle all available clocks
>>>
>>> This patch series is a continue of discussion from here,
>>> https://patchwork.kernel.org/patch/9986293/
>>> that some users may want to handle all available clocks from device
>>> tree without need to know the detailed clock information likes clock
>>> numbers and names. This is useful in writing some generic drivers to handle
>> clock part.
>>>
>>> Note:
>>> This patch series is tested on MX6Q SDB cpufreq driver with a minor
>>> change to switch to use clk_bulk_get_all.
>>> But patch 4 only test compiling. Hopefully someone could help test the
>>> function.
>>>
>>> v2->v3:
>>>   * address all comments from Stephen
>>>   * fix build warnings on other architectures.
>>> v1->v2:
>>>   * add clk_bulk_{get|put}_all() which only supports DT platform
>>> currently
>>>   * remove _all variants and the wrapper struct clk_bulk
>>>   * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
>>>     proves they need it because they don't have a struct device pointer.
>>>
>>> Dong Aisheng (4):
>>>    clk: bulk: add of_clk_bulk_get()
>>>    clk: add new APIs to operate on all available clocks
>>>    clk: add managed version of clk_bulk_get_all
>>>    video: simplefb: switch to use clk_bulk API to simplify clock
>>>      operations
>>>
>>>   drivers/clk/clk-bulk.c         | 80
>>> ++++++++++++++++++++++++++++++++++++++++++
>>>   drivers/clk/clk-devres.c       | 24 +++++++++++++
>>>   drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
>>>   include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
>>>   4 files changed, 180 insertions(+), 55 deletions(-)
>>>
>>> --
>>> 2.7.4
> 
> 

Nice patchset!

FWIW, I've tested patches 1-3 on Stratix10 SOCFPGA for a SMMU driver I'm 
working on.

Tested-by: Thor Thayer <thor.thayer@linux.intel.com>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-08-20 16:32       ` Thor Thayer
  0 siblings, 0 replies; 26+ messages in thread
From: Thor Thayer @ 2018-08-20 16:32 UTC (permalink / raw)
  To: A.s. Dong, sboyd, mturquette
  Cc: linux-kernel, linux-arm-kernel, shawnguo, dl-linux-imx, linux-clk

Hi,

On 08/16/2018 09:33 PM, A.s. Dong wrote:
> Hi Stephen,
> 
> Do you want me to resend this series for review?
> It seems have been pending for quite a long time.
> 
> Thor just pinged me for its status as he wants to use it.
> 
> Regards
> Dong Aisheng
> 
>> -----Original Message-----
>> From: A.s. Dong
>> Sent: Wednesday, June 20, 2018 10:54 AM
>> To: linux-clk@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
>> sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
>> linux-imx <linux-imx@nxp.com>
>> Subject: RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
>>
>> Ping....
>>
>>> -----Original Message-----
>>> From: A.s. Dong
>>> Sent: Friday, May 25, 2018 6:37 PM
>>> To: linux-clk@vger.kernel.org
>>> Cc: linux-kernel@vger.kernel.org;
>>> linux-arm-kernel@lists.infradead.org;
>>> sboyd@kernel.org; mturquette@baylibre.com; shawnguo@kernel.org; dl-
>>> linux-imx <linux-imx@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>
>>> Subject: [PATCH V3 0/4] clk: new APIs to handle all available clocks
>>>
>>> This patch series is a continue of discussion from here,
>>> https://patchwork.kernel.org/patch/9986293/
>>> that some users may want to handle all available clocks from device
>>> tree without need to know the detailed clock information likes clock
>>> numbers and names. This is useful in writing some generic drivers to handle
>> clock part.
>>>
>>> Note:
>>> This patch series is tested on MX6Q SDB cpufreq driver with a minor
>>> change to switch to use clk_bulk_get_all.
>>> But patch 4 only test compiling. Hopefully someone could help test the
>>> function.
>>>
>>> v2->v3:
>>>   * address all comments from Stephen
>>>   * fix build warnings on other architectures.
>>> v1->v2:
>>>   * add clk_bulk_{get|put}_all() which only supports DT platform
>>> currently
>>>   * remove _all variants and the wrapper struct clk_bulk
>>>   * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
>>>     proves they need it because they don't have a struct device pointer.
>>>
>>> Dong Aisheng (4):
>>>    clk: bulk: add of_clk_bulk_get()
>>>    clk: add new APIs to operate on all available clocks
>>>    clk: add managed version of clk_bulk_get_all
>>>    video: simplefb: switch to use clk_bulk API to simplify clock
>>>      operations
>>>
>>>   drivers/clk/clk-bulk.c         | 80
>>> ++++++++++++++++++++++++++++++++++++++++++
>>>   drivers/clk/clk-devres.c       | 24 +++++++++++++
>>>   drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
>>>   include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
>>>   4 files changed, 180 insertions(+), 55 deletions(-)
>>>
>>> --
>>> 2.7.4
> 
> 

Nice patchset!

FWIW, I've tested patches 1-3 on Stratix10 SOCFPGA for a SMMU driver I'm 
working on.

Tested-by: Thor Thayer <thor.thayer@linux.intel.com>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-08-20 16:32       ` Thor Thayer
  0 siblings, 0 replies; 26+ messages in thread
From: Thor Thayer @ 2018-08-20 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 08/16/2018 09:33 PM, A.s. Dong wrote:
> Hi Stephen,
> 
> Do you want me to resend this series for review?
> It seems have been pending for quite a long time.
> 
> Thor just pinged me for its status as he wants to use it.
> 
> Regards
> Dong Aisheng
> 
>> -----Original Message-----
>> From: A.s. Dong
>> Sent: Wednesday, June 20, 2018 10:54 AM
>> To: linux-clk at vger.kernel.org
>> Cc: linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org;
>> sboyd at kernel.org; mturquette at baylibre.com; shawnguo at kernel.org; dl-
>> linux-imx <linux-imx@nxp.com>
>> Subject: RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
>>
>> Ping....
>>
>>> -----Original Message-----
>>> From: A.s. Dong
>>> Sent: Friday, May 25, 2018 6:37 PM
>>> To: linux-clk at vger.kernel.org
>>> Cc: linux-kernel at vger.kernel.org;
>>> linux-arm-kernel at lists.infradead.org;
>>> sboyd at kernel.org; mturquette at baylibre.com; shawnguo at kernel.org; dl-
>>> linux-imx <linux-imx@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>
>>> Subject: [PATCH V3 0/4] clk: new APIs to handle all available clocks
>>>
>>> This patch series is a continue of discussion from here,
>>> https://patchwork.kernel.org/patch/9986293/
>>> that some users may want to handle all available clocks from device
>>> tree without need to know the detailed clock information likes clock
>>> numbers and names. This is useful in writing some generic drivers to handle
>> clock part.
>>>
>>> Note:
>>> This patch series is tested on MX6Q SDB cpufreq driver with a minor
>>> change to switch to use clk_bulk_get_all.
>>> But patch 4 only test compiling. Hopefully someone could help test the
>>> function.
>>>
>>> v2->v3:
>>>   * address all comments from Stephen
>>>   * fix build warnings on other architectures.
>>> v1->v2:
>>>   * add clk_bulk_{get|put}_all() which only supports DT platform
>>> currently
>>>   * remove _all variants and the wrapper struct clk_bulk
>>>   * make of_clk_bulk_get and of_clk_bulk_get_all private until someone
>>>     proves they need it because they don't have a struct device pointer.
>>>
>>> Dong Aisheng (4):
>>>    clk: bulk: add of_clk_bulk_get()
>>>    clk: add new APIs to operate on all available clocks
>>>    clk: add managed version of clk_bulk_get_all
>>>    video: simplefb: switch to use clk_bulk API to simplify clock
>>>      operations
>>>
>>>   drivers/clk/clk-bulk.c         | 80
>>> ++++++++++++++++++++++++++++++++++++++++++
>>>   drivers/clk/clk-devres.c       | 24 +++++++++++++
>>>   drivers/video/fbdev/simplefb.c | 66 +++++++---------------------------
>>>   include/linux/clk.h            | 65 +++++++++++++++++++++++++++++++++-
>>>   4 files changed, 180 insertions(+), 55 deletions(-)
>>>
>>> --
>>> 2.7.4
> 
> 

Nice patchset!

FWIW, I've tested patches 1-3 on Stratix10 SOCFPGA for a SMMU driver I'm 
working on.

Tested-by: Thor Thayer <thor.thayer@linux.intel.com>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
  2018-08-17  2:33     ` A.s. Dong
  (?)
@ 2018-08-29  3:08       ` Stephen Boyd
  -1 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2018-08-29  3:08 UTC (permalink / raw)
  To: A.s. Dong
  Cc: linux-kernel, linux-arm-kernel, mturquette, shawnguo,
	dl-linux-imx, thor.thayer, linux-clk

Quoting A.s. Dong (2018-08-16 19:33:52)
> Hi Stephen,
> 
> Do you want me to resend this series for review?
> It seems have been pending for quite a long time.
> 
> Thor just pinged me for its status as he wants to use it.
> 

I was waiting for someone to try them out or review them. Good that it
happened!

I've taken a look at the patches and I'm slightly annoyed with the API
that passes in a double pointer to clk_bulk_data and returns a count of
the number of clks found. I guess it's ok though. It's really just this
line:

	devres->clks = *clks;

which makes my brain all confused and go think about what's being
assigned and if it's a struct copy or not.

Maybe this on top would make it easier to take? I'll think about it
tonight.

---8<---
diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
index 6d3ca5ec5de8..12c87457eca1 100644
--- a/drivers/clk/clk-devres.c
+++ b/drivers/clk/clk-devres.c
@@ -81,9 +81,9 @@ int __must_check devm_clk_bulk_get_all(struct device *dev,
 	if (!devres)
 		return -ENOMEM;
 
-	ret = clk_bulk_get_all(dev, clks);
+	ret = clk_bulk_get_all(dev, &devres->clks);
 	if (ret > 0) {
-		devres->clks = *clks;
+		*clks = devres->clks;
 		devres->num_clks = ret;
 		devres_add(dev, devres);
 	} else {

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-08-29  3:08       ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2018-08-29  3:08 UTC (permalink / raw)
  To: A.s. Dong
  Cc: linux-kernel, linux-arm-kernel, mturquette, shawnguo,
	dl-linux-imx, thor.thayer, linux-clk

Quoting A.s. Dong (2018-08-16 19:33:52)
> Hi Stephen,
> =

> Do you want me to resend this series for review?
> It seems have been pending for quite a long time.
> =

> Thor just pinged me for its status as he wants to use it.
> =


I was waiting for someone to try them out or review them. Good that it
happened!

I've taken a look at the patches and I'm slightly annoyed with the API
that passes in a double pointer to clk_bulk_data and returns a count of
the number of clks found. I guess it's ok though. It's really just this
line:

	devres->clks =3D *clks;

which makes my brain all confused and go think about what's being
assigned and if it's a struct copy or not.

Maybe this on top would make it easier to take? I'll think about it
tonight.

---8<---
diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
index 6d3ca5ec5de8..12c87457eca1 100644
--- a/drivers/clk/clk-devres.c
+++ b/drivers/clk/clk-devres.c
@@ -81,9 +81,9 @@ int __must_check devm_clk_bulk_get_all(struct device *dev,
 	if (!devres)
 		return -ENOMEM;
 =

-	ret =3D clk_bulk_get_all(dev, clks);
+	ret =3D clk_bulk_get_all(dev, &devres->clks);
 	if (ret > 0) {
-		devres->clks =3D *clks;
+		*clks =3D devres->clks;
 		devres->num_clks =3D ret;
 		devres_add(dev, devres);
 	} else {

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-08-29  3:08       ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2018-08-29  3:08 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting A.s. Dong (2018-08-16 19:33:52)
> Hi Stephen,
> 
> Do you want me to resend this series for review?
> It seems have been pending for quite a long time.
> 
> Thor just pinged me for its status as he wants to use it.
> 

I was waiting for someone to try them out or review them. Good that it
happened!

I've taken a look at the patches and I'm slightly annoyed with the API
that passes in a double pointer to clk_bulk_data and returns a count of
the number of clks found. I guess it's ok though. It's really just this
line:

	devres->clks = *clks;

which makes my brain all confused and go think about what's being
assigned and if it's a struct copy or not.

Maybe this on top would make it easier to take? I'll think about it
tonight.

---8<---
diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
index 6d3ca5ec5de8..12c87457eca1 100644
--- a/drivers/clk/clk-devres.c
+++ b/drivers/clk/clk-devres.c
@@ -81,9 +81,9 @@ int __must_check devm_clk_bulk_get_all(struct device *dev,
 	if (!devres)
 		return -ENOMEM;
 
-	ret = clk_bulk_get_all(dev, clks);
+	ret = clk_bulk_get_all(dev, &devres->clks);
 	if (ret > 0) {
-		devres->clks = *clks;
+		*clks = devres->clks;
 		devres->num_clks = ret;
 		devres_add(dev, devres);
 	} else {

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
  2018-08-29  3:08       ` Stephen Boyd
  (?)
@ 2018-08-29 12:26         ` A.s. Dong
  -1 siblings, 0 replies; 26+ messages in thread
From: A.s. Dong @ 2018-08-29 12:26 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: linux-kernel, linux-arm-kernel, mturquette, shawnguo,
	dl-linux-imx, thor.thayer, linux-clk

> -----Original Message-----
> From: Stephen Boyd [mailto:sboyd@kernel.org]
> Sent: Wednesday, August 29, 2018 11:09 AM
> To: A.s. Dong <aisheng.dong@nxp.com>
> Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> mturquette@baylibre.com; shawnguo@kernel.org; dl-linux-imx
> <linux-imx@nxp.com>; thor.thayer@linux.intel.com; linux-clk@vger.kernel.org
> Subject: RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
> 
> Quoting A.s. Dong (2018-08-16 19:33:52)
> > Hi Stephen,
> >
> > Do you want me to resend this series for review?
> > It seems have been pending for quite a long time.
> >
> > Thor just pinged me for its status as he wants to use it.
> >
> 
> I was waiting for someone to try them out or review them. Good that it
> happened!
> 
> I've taken a look at the patches and I'm slightly annoyed with the API that
> passes in a double pointer to clk_bulk_data and returns a count of the number
> of clks found. I guess it's ok though. It's really just this
> line:
> 
> 	devres->clks = *clks;
> 
> which makes my brain all confused and go think about what's being assigned
> and if it's a struct copy or not.
> 
> Maybe this on top would make it easier to take? I'll think about it tonight.
> 

Looks like a good idea to me.
Will update and resend.
Thanks for the suggestion.

Regards
Dong Aisheng

> ---8<---
> diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c index
> 6d3ca5ec5de8..12c87457eca1 100644
> --- a/drivers/clk/clk-devres.c
> +++ b/drivers/clk/clk-devres.c
> @@ -81,9 +81,9 @@ int __must_check devm_clk_bulk_get_all(struct device
> *dev,
>  	if (!devres)
>  		return -ENOMEM;
> 
> -	ret = clk_bulk_get_all(dev, clks);
> +	ret = clk_bulk_get_all(dev, &devres->clks);
>  	if (ret > 0) {
> -		devres->clks = *clks;
> +		*clks = devres->clks;
>  		devres->num_clks = ret;
>  		devres_add(dev, devres);
>  	} else {

^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-08-29 12:26         ` A.s. Dong
  0 siblings, 0 replies; 26+ messages in thread
From: A.s. Dong @ 2018-08-29 12:26 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: linux-kernel, linux-arm-kernel, mturquette, shawnguo,
	dl-linux-imx, thor.thayer, linux-clk

PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBTdGVwaGVuIEJveWQgW21haWx0
bzpzYm95ZEBrZXJuZWwub3JnXQ0KPiBTZW50OiBXZWRuZXNkYXksIEF1Z3VzdCAyOSwgMjAxOCAx
MTowOSBBTQ0KPiBUbzogQS5zLiBEb25nIDxhaXNoZW5nLmRvbmdAbnhwLmNvbT4NCj4gQ2M6IGxp
bnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc7IGxpbnV4LWFybS1rZXJuZWxAbGlzdHMuaW5mcmFk
ZWFkLm9yZzsNCj4gbXR1cnF1ZXR0ZUBiYXlsaWJyZS5jb207IHNoYXduZ3VvQGtlcm5lbC5vcmc7
IGRsLWxpbnV4LWlteA0KPiA8bGludXgtaW14QG54cC5jb20+OyB0aG9yLnRoYXllckBsaW51eC5p
bnRlbC5jb207IGxpbnV4LWNsa0B2Z2VyLmtlcm5lbC5vcmcNCj4gU3ViamVjdDogUkU6IFtQQVRD
SCBWMyAwLzRdIGNsazogbmV3IEFQSXMgdG8gaGFuZGxlIGFsbCBhdmFpbGFibGUgY2xvY2tzDQo+
IA0KPiBRdW90aW5nIEEucy4gRG9uZyAoMjAxOC0wOC0xNiAxOTozMzo1MikNCj4gPiBIaSBTdGVw
aGVuLA0KPiA+DQo+ID4gRG8geW91IHdhbnQgbWUgdG8gcmVzZW5kIHRoaXMgc2VyaWVzIGZvciBy
ZXZpZXc/DQo+ID4gSXQgc2VlbXMgaGF2ZSBiZWVuIHBlbmRpbmcgZm9yIHF1aXRlIGEgbG9uZyB0
aW1lLg0KPiA+DQo+ID4gVGhvciBqdXN0IHBpbmdlZCBtZSBmb3IgaXRzIHN0YXR1cyBhcyBoZSB3
YW50cyB0byB1c2UgaXQuDQo+ID4NCj4gDQo+IEkgd2FzIHdhaXRpbmcgZm9yIHNvbWVvbmUgdG8g
dHJ5IHRoZW0gb3V0IG9yIHJldmlldyB0aGVtLiBHb29kIHRoYXQgaXQNCj4gaGFwcGVuZWQhDQo+
IA0KPiBJJ3ZlIHRha2VuIGEgbG9vayBhdCB0aGUgcGF0Y2hlcyBhbmQgSSdtIHNsaWdodGx5IGFu
bm95ZWQgd2l0aCB0aGUgQVBJIHRoYXQNCj4gcGFzc2VzIGluIGEgZG91YmxlIHBvaW50ZXIgdG8g
Y2xrX2J1bGtfZGF0YSBhbmQgcmV0dXJucyBhIGNvdW50IG9mIHRoZSBudW1iZXINCj4gb2YgY2xr
cyBmb3VuZC4gSSBndWVzcyBpdCdzIG9rIHRob3VnaC4gSXQncyByZWFsbHkganVzdCB0aGlzDQo+
IGxpbmU6DQo+IA0KPiAJZGV2cmVzLT5jbGtzID0gKmNsa3M7DQo+IA0KPiB3aGljaCBtYWtlcyBt
eSBicmFpbiBhbGwgY29uZnVzZWQgYW5kIGdvIHRoaW5rIGFib3V0IHdoYXQncyBiZWluZyBhc3Np
Z25lZA0KPiBhbmQgaWYgaXQncyBhIHN0cnVjdCBjb3B5IG9yIG5vdC4NCj4gDQo+IE1heWJlIHRo
aXMgb24gdG9wIHdvdWxkIG1ha2UgaXQgZWFzaWVyIHRvIHRha2U/IEknbGwgdGhpbmsgYWJvdXQg
aXQgdG9uaWdodC4NCj4gDQoNCkxvb2tzIGxpa2UgYSBnb29kIGlkZWEgdG8gbWUuDQpXaWxsIHVw
ZGF0ZSBhbmQgcmVzZW5kLg0KVGhhbmtzIGZvciB0aGUgc3VnZ2VzdGlvbi4NCg0KUmVnYXJkcw0K
RG9uZyBBaXNoZW5nDQoNCj4gLS0tODwtLS0NCj4gZGlmZiAtLWdpdCBhL2RyaXZlcnMvY2xrL2Ns
ay1kZXZyZXMuYyBiL2RyaXZlcnMvY2xrL2Nsay1kZXZyZXMuYyBpbmRleA0KPiA2ZDNjYTVlYzVk
ZTguLjEyYzg3NDU3ZWNhMSAxMDA2NDQNCj4gLS0tIGEvZHJpdmVycy9jbGsvY2xrLWRldnJlcy5j
DQo+ICsrKyBiL2RyaXZlcnMvY2xrL2Nsay1kZXZyZXMuYw0KPiBAQCAtODEsOSArODEsOSBAQCBp
bnQgX19tdXN0X2NoZWNrIGRldm1fY2xrX2J1bGtfZ2V0X2FsbChzdHJ1Y3QgZGV2aWNlDQo+ICpk
ZXYsDQo+ICAJaWYgKCFkZXZyZXMpDQo+ICAJCXJldHVybiAtRU5PTUVNOw0KPiANCj4gLQlyZXQg
PSBjbGtfYnVsa19nZXRfYWxsKGRldiwgY2xrcyk7DQo+ICsJcmV0ID0gY2xrX2J1bGtfZ2V0X2Fs
bChkZXYsICZkZXZyZXMtPmNsa3MpOw0KPiAgCWlmIChyZXQgPiAwKSB7DQo+IC0JCWRldnJlcy0+
Y2xrcyA9ICpjbGtzOw0KPiArCQkqY2xrcyA9IGRldnJlcy0+Y2xrczsNCj4gIAkJZGV2cmVzLT5u
dW1fY2xrcyA9IHJldDsNCj4gIAkJZGV2cmVzX2FkZChkZXYsIGRldnJlcyk7DQo+ICAJfSBlbHNl
IHsNCg==

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH V3 0/4] clk: new APIs to handle all available clocks
@ 2018-08-29 12:26         ` A.s. Dong
  0 siblings, 0 replies; 26+ messages in thread
From: A.s. Dong @ 2018-08-29 12:26 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Stephen Boyd [mailto:sboyd at kernel.org]
> Sent: Wednesday, August 29, 2018 11:09 AM
> To: A.s. Dong <aisheng.dong@nxp.com>
> Cc: linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org;
> mturquette at baylibre.com; shawnguo at kernel.org; dl-linux-imx
> <linux-imx@nxp.com>; thor.thayer at linux.intel.com; linux-clk at vger.kernel.org
> Subject: RE: [PATCH V3 0/4] clk: new APIs to handle all available clocks
> 
> Quoting A.s. Dong (2018-08-16 19:33:52)
> > Hi Stephen,
> >
> > Do you want me to resend this series for review?
> > It seems have been pending for quite a long time.
> >
> > Thor just pinged me for its status as he wants to use it.
> >
> 
> I was waiting for someone to try them out or review them. Good that it
> happened!
> 
> I've taken a look at the patches and I'm slightly annoyed with the API that
> passes in a double pointer to clk_bulk_data and returns a count of the number
> of clks found. I guess it's ok though. It's really just this
> line:
> 
> 	devres->clks = *clks;
> 
> which makes my brain all confused and go think about what's being assigned
> and if it's a struct copy or not.
> 
> Maybe this on top would make it easier to take? I'll think about it tonight.
> 

Looks like a good idea to me.
Will update and resend.
Thanks for the suggestion.

Regards
Dong Aisheng

> ---8<---
> diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c index
> 6d3ca5ec5de8..12c87457eca1 100644
> --- a/drivers/clk/clk-devres.c
> +++ b/drivers/clk/clk-devres.c
> @@ -81,9 +81,9 @@ int __must_check devm_clk_bulk_get_all(struct device
> *dev,
>  	if (!devres)
>  		return -ENOMEM;
> 
> -	ret = clk_bulk_get_all(dev, clks);
> +	ret = clk_bulk_get_all(dev, &devres->clks);
>  	if (ret > 0) {
> -		devres->clks = *clks;
> +		*clks = devres->clks;
>  		devres->num_clks = ret;
>  		devres_add(dev, devres);
>  	} else {

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2018-08-29 12:26 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-25 10:37 [PATCH V3 0/4] clk: new APIs to handle all available clocks Dong Aisheng
2018-05-25 10:37 ` Dong Aisheng
2018-05-25 10:37 ` [PATCH V3 1/4] clk: bulk: add of_clk_bulk_get() Dong Aisheng
2018-05-25 10:37   ` Dong Aisheng
2018-05-25 10:37 ` [PATCH V3 2/4] clk: add new APIs to operate on all available clocks Dong Aisheng
2018-05-25 10:37   ` Dong Aisheng
2018-05-25 10:37 ` [PATCH V3 3/4] clk: add managed version of clk_bulk_get_all Dong Aisheng
2018-05-25 10:37   ` Dong Aisheng
2018-05-25 10:37 ` [PATCH V3 4/4] video: simplefb: switch to use clk_bulk API to simplify clock operations Dong Aisheng
2018-05-25 10:37   ` Dong Aisheng
2018-05-25 10:37   ` Dong Aisheng
2018-06-20  2:53 ` [PATCH V3 0/4] clk: new APIs to handle all available clocks A.s. Dong
2018-06-20  2:53   ` A.s. Dong
2018-06-20  2:53   ` A.s. Dong
2018-08-17  2:33   ` A.s. Dong
2018-08-17  2:33     ` A.s. Dong
2018-08-17  2:33     ` A.s. Dong
2018-08-20 16:32     ` Thor Thayer
2018-08-20 16:32       ` Thor Thayer
2018-08-20 16:32       ` Thor Thayer
2018-08-29  3:08     ` Stephen Boyd
2018-08-29  3:08       ` Stephen Boyd
2018-08-29  3:08       ` Stephen Boyd
2018-08-29 12:26       ` A.s. Dong
2018-08-29 12:26         ` A.s. Dong
2018-08-29 12:26         ` A.s. Dong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.