From nobody Thu Dec 18 09:57:46 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EC6A2343B6 for ; Tue, 14 Jan 2025 05:05:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736831151; cv=none; b=rfZayQ2C/o3Rabo0TMFCkRGCNP4QOSucq9iXZMjHykRjHcrCWTrWiGeSRJfSC3HANGcfK3vjb6aHyOq7za5li1kpg/+tco52efGiieTLx1DWl4eyb1gWRFaNWorHw0d4TNlGmqDOHDF6inMEH4qiCTlnHgrRPPNmNZ5rLWx8xKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736831151; c=relaxed/simple; bh=cEWULSiGoWIr4uAoz57xnHYom3cCE6za+4sS6e97+6E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DExUgknCeYZwJZpspmcJGmJcyn7h9dnZ9tUFV4Pq/zrB4QbU738jMZoKnouNRMudiCZB4DZmaunYHr7koPBlmwiedft/nY1SEw+Wd7GkcirWjSHCV3fwnotHbMUOTP752SUlXFoWToiyew/dp0uiSbG1chA4G5BXpOAa/v9su+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=J1kTa67A; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="J1kTa67A" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50DKsOmA026165 for ; Tue, 14 Jan 2025 05:05:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= +VkUXrOLcLDpSxofU5hRKw+Y1fiuNviLtTxMsES8ipI=; b=J1kTa67A9rOEL9kr o+gjpSXV4RpgrN23L6Gs52iqfVyQ11AR/JyWCmMg/xawhLDOsulFRL2LdLjITnqq 0RgIcuwOLYth9Q9yWRTrGJIp1ikXoHOkLY98F+SrN9MXZhRD3FtCOmvvIRtbmtC/ h+a85Orzjm+1ETpHZr82/NDR14DSz7pquJqldnGbEwjJEUoAy2IaYfbg3f+FB44z ZUlfX7fLZVKbnZtGpV8Rt162tDgv3DHpA3GR+ZVe8kepjfFjb7Pju5mU8Bn6WDWK DcJzRr+5jtftOy/pZ92Klj+hlnlhGjNsELW77HGmgj3u3kbvVpgVOC2obR/WrsJt tp7eUQ== Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 445a928v6f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 14 Jan 2025 05:05:48 +0000 (GMT) Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-5f4d603fa7aso3683096eaf.2 for ; Mon, 13 Jan 2025 21:05:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736831147; x=1737435947; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+VkUXrOLcLDpSxofU5hRKw+Y1fiuNviLtTxMsES8ipI=; b=Og17DUkAGxBY+Ym6oxTKEKhSuRkL1pEdErcaFLqKUNQQfG/YQ8nb3in/nHT0/cFkRE wVKK93tcE8RGm2HkUZb6YO29+TVihb05WCnVPbQXPjIzIbl8LvsOPUJuJGjuWI+iTxtT s/8gbEKH9xDfkbqFKb40j3pamx+mrJD8ki+p7d0G/1fKJn/5Q4V4Lr9+xYxDhEbVC2iw 0YjDi7lvw44SaDc0TZ6w6D41q9iDmZQhTffh2lRzr3/Y+7/lpUt84Od21Ahpjf4g4u31 9zQxwAnHuOc+Tv2mHTr3w4pQLMSb0862kQ52Ioft/bCTpQa9LXEd/E7s6qsg+Kv9xD2E AXfg== X-Forwarded-Encrypted: i=1; AJvYcCWuEqgPobLh2vtDGxWxdC+T1kuoGT//TcnuAv6yI6oDTZ4MPD/QvYRFs8mk3Wa2Uu09uR6J7JGHN4+7p5g=@vger.kernel.org X-Gm-Message-State: AOJu0YyfZnKTIJBUVBSJH8wkYW2tvFROrid2l0VtrtBoDXegBs0U/oEw hDZby4dsqQFl6nkZg1oalYI6ZcZBms74vqq0LXW/MLQ/vkdSL4L/ut1bROIVpaEyZ529fuDZIxY kqDZ17VCcvjYQdh55E5vpFWiTcl3rPxcftzxhP6BcKsppM5YAQjNYGbhGQcq0uSw= X-Gm-Gg: ASbGncvvTaqwjaXY2V8ykNu9w3XnoDmKpUGoR34Tfo6cZPn8ET7ryEACTO09nErP2Fy eERbBp/8J65hzbFwyjWX3yJr5YClDgQRrU6xni6txA0bpz45nFzT9h2rGfd/KVIsSVGzJj6OaWy oGyPvNtvRzRvP+u6pwgwnbuhLml3z9m3AA64i86IJTxwIgp814nEE9taVRVyIEGO11VnDuXwUBG GynveGLUIeJrWAiI2f4sxLrpilbcymyRqwJ+EX0bYT7Rhz9FztIKlu3V04g067dAvidCndwUcDS phv5zAnaS5pRq9mplfuY7+A0zeYyGNx4CDLKW/tGmLPxCfpboL0FnJDl X-Received: by 2002:a05:6808:6396:b0:3f0:e42:4dab with SMTP id 5614622812f47-3f00e425c3bmr9849867b6e.33.1736831147410; Mon, 13 Jan 2025 21:05:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IF48gmKNJ7kvN2MsPkkY4TVIyrGT0lQ2sF5JyRVS+J4uOenMZH+1AAMJf2LdNd32YErsixZcw== X-Received: by 2002:a05:6808:6396:b0:3f0:e42:4dab with SMTP id 5614622812f47-3f00e425c3bmr9849852b6e.33.1736831147117; Mon, 13 Jan 2025 21:05:47 -0800 (PST) Received: from [192.168.86.65] (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f882756603sm4001750eaf.29.2025.01.13.21.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 21:05:46 -0800 (PST) From: Bjorn Andersson Date: Mon, 13 Jan 2025 21:11:36 -0800 Subject: [PATCH v3 03/12] of: dynamic: Add of_changeset_add_prop_copy() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250113-dwc3-refactor-v3-3-d1722075df7b@oss.qualcomm.com> References: <20250113-dwc3-refactor-v3-0-d1722075df7b@oss.qualcomm.com> In-Reply-To: <20250113-dwc3-refactor-v3-0-d1722075df7b@oss.qualcomm.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Felipe Balbi , Wesley Cheng , Saravana Kannan , Thinh Nguyen , Philipp Zabel , Bjorn Andersson , Konrad Dybcio , Frank Li Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2203; i=bjorn.andersson@oss.qualcomm.com; h=from:subject:message-id; bh=cEWULSiGoWIr4uAoz57xnHYom3cCE6za+4sS6e97+6E=; b=owEBgwJ8/ZANAwAIAQsfOT8Nma3FAcsmYgBnhfIVESRHXDU5xGo0wLQM+Yn/AExNqBNW8EdSt NuzfG1DIU2JAkkEAAEIADMWIQQF3gPMXzXqTwlm1SULHzk/DZmtxQUCZ4XyFRUcYW5kZXJzc29u QGtlcm5lbC5vcmcACgkQCx85Pw2ZrcVWhw//WKnIBpDCTavyrPXwLpmezKe+u3AEL2Ncbr4RQMx bCAeTAdvL/tJh9aYXQTsQb2W9HEpjgAzLYdg6XYd6T5TlZoMLH13WQyKlpruTtQ7DweN8YH451D 3BYwQbPqOVOBKSgg3xU/jNUgY44U0eidfat/m4bXm/c8kC+HUdygPSj20S3BSrmFfIW9peE0u/t Z2E1plVpFMuOkYHvIYRBN1T5n0h72UiwReUPETMbHhIk4LJGy7okp57usO1sSQ5KEXyRj2LUEjU s/jebX1avnVzryHlXKTMLPjA9n7BBN8uMq1bJskRW0lJKlUkiBZqlJVShhboUmv4FFJSsBuDtGG 1u5SkgfK6O3mpWbEbAyD1aFsfudmwaGbYonENWUM3MjIg5GOMpbJv10nQUcn95V9z80xuTQ3T5U cw5JouNJWrhGVnt4i80hse4+AFWdhXzj3hGSypc3tGFm73Slug421961CXYE6HDmFYe/CjR53Ny i52SqwtxKfBw1p+tgNacPTUq3n3R/Uq1qxSOrXDz0jTlNecpdw1GmlxYYtbCjG95ivcPNED7t0n nDGw5t6B3RGZu1FpTv16I8aKIrNHfgtqOVDtojh30yyiJCadyUkv4567wkaquHtX2LwzMacJbF8 tGf07oz+iMfexBd4Y87FK6JjetCVdN+TxK3O6Mhz4EWY= X-Developer-Key: i=bjorn.andersson@oss.qualcomm.com; a=openpgp; fpr=05DE03CC5F35EA4F0966D5250B1F393F0D99ADC5 X-Proofpoint-GUID: ZrbRhNnyndnmrrQk_sjZOE905j_g3wVm X-Proofpoint-ORIG-GUID: ZrbRhNnyndnmrrQk_sjZOE905j_g3wVm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 suspectscore=0 impostorscore=0 adultscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501140039 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 --- 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); =20 +/** + * 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 proper= ty, + * 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_nod= e *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_changes= et *ocs, int of_changeset_add_prop_bool(struct of_changeset *ocs, struct device_nod= e *np, const char *prop_name); =20 +int of_changeset_add_prop_copy(struct of_changeset *ocs, struct device_nod= e *np, + const struct property *prop); + #else /* CONFIG_OF_DYNAMIC */ static inline int of_reconfig_notifier_register(struct notifier_block *nb) { --=20 2.45.2