mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Felipe Balbi <balbi@kernel.org>,
	Wesley Cheng <quic_wcheng@quicinc.com>,
	Saravana Kannan <saravanak@google.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Frank Li <Frank.li@nxp.com>
Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Subject: [PATCH v3 03/12] of: dynamic: Add of_changeset_add_prop_copy()
Date: Mon, 13 Jan 2025 21:11:36 -0800	[thread overview]
Message-ID: <20250113-dwc3-refactor-v3-3-d1722075df7b@oss.qualcomm.com> (raw)
In-Reply-To: <20250113-dwc3-refactor-v3-0-d1722075df7b@oss.qualcomm.com>

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@oss.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


  parent reply	other threads:[~2025-01-14  5:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14  5:11 [PATCH v3 00/12] usb: dwc3: qcom: Flatten dwc3 structure Bjorn Andersson
2025-01-14  5:11 ` [PATCH v3 01/12] dt-bindings: usb: snps,dwc3: Split core description Bjorn Andersson
2025-01-14  5:11 ` [PATCH v3 02/12] dt-bindings: usb: Introduce qcom,snps-dwc3 Bjorn Andersson
2025-01-14  5:11 ` Bjorn Andersson [this message]
2025-01-14  5:11 ` [PATCH v3 04/12] of: overlays: Introduce dwc3 flattening overlay Bjorn Andersson
2025-01-14  5:11 ` [PATCH v3 05/12] of: overlays: dwc3-flattening: Add Qualcomm Arm32 overlays Bjorn Andersson
2025-01-14  5:11 ` [PATCH v3 06/12] of: overlays: dwc3-flattening: Add Qualcomm Arm64 board overlays Bjorn Andersson
2025-01-14 17:42   ` Rob Herring
2025-01-14 22:46     ` Bjorn Andersson
2025-01-14  5:11 ` [PATCH v3 07/12] of: overlays: dwc3-flattening: Provide overlay symbols Bjorn Andersson
2025-01-14  5:11 ` [PATCH v3 08/12] usb: dwc3: core: Expose core driver as library Bjorn Andersson
2025-01-14 19:43   ` Frank Li
2025-01-14 22:55     ` Bjorn Andersson
2025-01-15  1:56       ` Thinh Nguyen
2025-01-15  2:59         ` Thinh Nguyen
2025-01-14  5:11 ` [PATCH v3 09/12] usb: dwc3: core: Don't touch resets and clocks Bjorn Andersson
2025-01-14  5:11 ` [PATCH v3 10/12] usb: dwc3: qcom: Don't rely on drvdata during probe Bjorn Andersson
2025-01-14  5:11 ` [PATCH v3 11/12] usb: dwc3: qcom: Transition to flattened model Bjorn Andersson
2025-01-14  5:11 ` [PATCH v3 12/12] arm64: dts: qcom: sc8280x: Flatten the USB nodes Bjorn Andersson
2025-01-14 17:44 ` [PATCH v3 00/12] usb: dwc3: qcom: Flatten dwc3 structure Rob Herring
2025-01-14 23:04   ` Bjorn Andersson
2025-01-15 18:51     ` Rob Herring
2025-01-23  3:07       ` Bjorn Andersson
2025-01-23 21:22         ` Rob Herring
2025-01-27 17:57 ` Stephan Gerhold
2025-01-27 22:40   ` Bjorn Andersson
2025-01-28 10:42     ` Konrad Dybcio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250113-dwc3-refactor-v3-3-d1722075df7b@oss.qualcomm.com \
    --to=bjorn.andersson@oss.qualcomm.com \
    --cc=Frank.li@nxp.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=andersson@kernel.org \
    --cc=balbi@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=quic_wcheng@quicinc.com \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®