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: <20250113-dwc3-refactor-v3-3-d1722075df7b@oss.qualcomm.com>
Date: Mon, 13 Jan 2025 21:11:36 -0800
From: Bjorn Andersson <bjorn.andersson@....qualcomm.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Rob Herring <robh@...nel.org>,
        Krzysztof Kozlowski <krzk+dt@...nel.org>,
        Conor Dooley <conor+dt@...nel.org>, Felipe Balbi <balbi@...nel.org>,
        Wesley Cheng <quic_wcheng@...cinc.com>,
        Saravana Kannan <saravanak@...gle.com>,
        Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Bjorn Andersson <andersson@...nel.org>,
        Konrad Dybcio <konradybcio@...nel.org>, Frank Li <Frank.li@....com>
Cc: linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bjorn Andersson <bjorn.andersson@....qualcomm.com>
Subject: [PATCH v3 03/12] of: dynamic: Add of_changeset_add_prop_copy()

When implementing migration between bindings with different structure,
properties might move from one node to another.

Introduce a helper function to do this, releaving the caller from having
to care about the datatype of the property and/or peek into the struct
property.

Signed-off-by: Bjorn Andersson <bjorn.andersson@....qualcomm.com>
---
 drivers/of/dynamic.c | 20 ++++++++++++++++++++
 include/linux/of.h   |  3 +++
 2 files changed, 23 insertions(+)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 0aba760f7577..e4d7ff53a892 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -1073,6 +1073,26 @@ int of_changeset_add_prop_bool(struct of_changeset *ocs, struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(of_changeset_add_prop_bool);
 
+/**
+ * of_changeset_add_prop_copy() - Add a property with name and value copied
+ * from an existing property, to a changeset.
+ *
+ * @ocs:	changeset pointer
+ * @np:		device node pointer
+ * @prop:	existing property to copy
+ *
+ * Create a new property with name and value copied from a provided property,
+ * to a changeset.
+ *
+ * Return: 0 on success, a negative error value in case of an error.
+ */
+int of_changeset_add_prop_copy(struct of_changeset *ocs, struct device_node *np,
+			       const struct property *prop)
+{
+	return of_changeset_add_prop_helper(ocs, np, prop);
+}
+EXPORT_SYMBOL_GPL(of_changeset_add_prop_copy);
+
 static int of_changeset_update_prop_helper(struct of_changeset *ocs,
 					   struct device_node *np,
 					   const struct property *pp)
diff --git a/include/linux/of.h b/include/linux/of.h
index f921786cb8ac..6a9bcdf9d629 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1667,6 +1667,9 @@ int of_changeset_update_prop_string(struct of_changeset *ocs,
 int of_changeset_add_prop_bool(struct of_changeset *ocs, struct device_node *np,
 			       const char *prop_name);
 
+int of_changeset_add_prop_copy(struct of_changeset *ocs, struct device_node *np,
+			       const struct property *prop);
+
 #else /* CONFIG_OF_DYNAMIC */
 static inline int of_reconfig_notifier_register(struct notifier_block *nb)
 {

-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ