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-next>] [day] [month] [year] [list]
Date:   Tue, 21 Dec 2021 11:16:38 +0800
From:   "Peng Fan (OSS)" <peng.fan@....nxp.com>
To:     sboyd@...nel.org, bjorn.andersson@...aro.org,
        s.nawrocki@...sung.com, jbrunet@...libre.com, aisheng.dong@....com,
        ulf.hansson@...aro.org, shawn.lin@...k-chips.com,
        linux-clk@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, van.freenix@...il.com,
        Peng Fan <peng.fan@....com>
Subject: [PATCH] clk: bulk: export of_clk_bulk_get_all

From: Peng Fan <peng.fan@....com>

There are cases that need to get the bulk clks of a device_node which not
has device created, so export of_clk_bulk_get_all to let consumers could
use it.

Signed-off-by: Peng Fan <peng.fan@....com>
---

V1:
     An example here, mediamix node has clocks property, but it will not
     have device of it, so we need of_X api to get the clks.
     src: src@...0390000 {
          compatible = "fsl,imx[X]-src";
          reg = <0x30390000 0x10000>;

          slice {
                #address-cells = <1>;
                #size-cells = <0>;

                mediamix: slice@...0 {
                   reg = <IMX93_POWER_DOMAIN_MEDIAMIX>;
                   #power-domain-cells = <0>;
		   clocks = <&clk IMX_MEDIAMIX_ROOT>, <&clk IMX_MEDIAMIX_AHB>;
          };
      };

 drivers/clk/clk-bulk.c |  5 +++--
 include/linux/clk.h    | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
index e9e16425c739..6dd7aac0b84c 100644
--- a/drivers/clk/clk-bulk.c
+++ b/drivers/clk/clk-bulk.c
@@ -43,8 +43,8 @@ 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)
+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;
@@ -68,6 +68,7 @@ static int __must_check of_clk_bulk_get_all(struct device_node *np,
 
 	return num_clks;
 }
+EXPORT_SYMBOL_GPL(of_clk_bulk_get_all);
 
 void clk_bulk_put(int num_clks, struct clk_bulk_data *clks)
 {
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 266e8de3cb51..c49c7918d6ef 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -372,6 +372,18 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks,
 int __must_check clk_bulk_get_all(struct device *dev,
 				  struct clk_bulk_data **clks);
 
+/**
+ * of_clk_bulk_get_all - lookup and obtain all available references to clock
+ *			 producer.
+ * @np: device node for clock "consumer"
+ * @clks: pointer to the clk_bulk_data table of consumer
+ *
+ * Same with clk_bulk_get_all except the first parameter use device node
+ * pointer.
+ */
+int __must_check of_clk_bulk_get_all(struct device_node *np,
+				     struct clk_bulk_data **clks);
+
 /**
  * clk_bulk_get_optional - lookup and obtain a number of references to clock producer
  * @dev: device for clock "consumer"
@@ -808,6 +820,12 @@ static inline int __must_check clk_bulk_get_all(struct device *dev,
 	return 0;
 }
 
+static inline int __must_check of_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;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ