From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 85CB935B62A for ; Mon, 23 Feb 2026 10:06:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841201; cv=none; b=Tj7PLOG10CR9Yt/6S68KTusCVMWOG65FAuqKaefKq+ZJd0ZQf4Vi7eQ71owxrZcWWF/3/r5CSu1ihWjOgHuZVZ1mOA0XqmDO172z2Naw3JYIZoo+Hpu1JVuIKWGVtEh1uu4dq7MOAMWuwVM5kBZ7O749MIbMKVx6ZYl+b8iuq9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841201; c=relaxed/simple; bh=+mk4ppL9XWF9OnQIKVkGYEAnsfhU9QaSc9cxpk6TKTM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pndSu/9leQ27G5yUvjCQnsYnd5ltDRefjnTtJdVyvAwAVxkN9AHo0dIXu7j0tiuLwn2KtdDlhrvltmMdzWZrQfmq57EO0zSPIT8Ein78BXiVdm2jqVMaV/SgQ/Q0zO26/e+apL0EDjPPB/hqu6BBW1Gw4Ut2RgkP3EOvvgUDd9o= 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=FgSQIZUm; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Il4fmBno; arc=none smtp.client-ip=205.220.180.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="FgSQIZUm"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Il4fmBno" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61MMsBii2238684 for ; Mon, 23 Feb 2026 10:06:39 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= Q3cNLjTDzr/nLnZnG7PjL1WTHdf61SjrQzPwxu8BAtc=; b=FgSQIZUmAXVQdO0l FiafRLC+CD8xYZlsCQnsNkD2wWuGGkAI81lQx9egC0lfXOqHJIskZDJVNNWeHpyb Z9kMA85jYNGe9U4z4wSo91NH091npLdZ07YhvldF9nKgTwx8FA713k/M4oJf670g pjPkEMM4fu1vFItH/BTEy92Z+sC0roEqPyalVBNU0NcKs7InfXdVo/mVGTfXFxko mMqqIAxkV1okBUn0H+EevKcmI+gzS9TUnF/lmKl1y+KrqtA7nkwR+X9+Q80JeGpj B+t9BlwgCAz/wNf75+6rW9NWguesIjctATrjfUvet2WoXGzzxX/6I1SWm/eLtzct VHFzsg== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5vum766-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:39 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8cb3ff05c73so4157524485a.0 for ; Mon, 23 Feb 2026 02:06:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841199; x=1772445999; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Q3cNLjTDzr/nLnZnG7PjL1WTHdf61SjrQzPwxu8BAtc=; b=Il4fmBnogw1MFlWsMUUiVZAFCw+6PEl0Z8wE+eSvtQIKFPWAJe2XgwMW2rqzLp2pk4 GW/rgLjU6UL75iPC4tvdR+93ZX/U63OaRk5TrJ4GtN4h3ZxKPJ5O9hN1JjPCWyCofcWy jX9gw8oiIBIQ8qWNX0rlrzf75vfikdT6L6dfnrZ+dP5fVqe6U1X+J5Hq6TxjLRZT6q0w gr4PcOkYSnnKgq591HTkOdG6M+Nzw6j6nd+roZA5OckWw82/rfcJfQ+tYmizLVxdHVPD JtbyNt00InAfbeYEeWcRZeZ6XW80KjsSlJJK27D7VWhi27wJS7jJs7iVPmsVlG4Mec9p vXeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841199; x=1772445999; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Q3cNLjTDzr/nLnZnG7PjL1WTHdf61SjrQzPwxu8BAtc=; b=ArrIwt/2+8xzlc3Jv9/n273b+cEYdDvwQ3Nd+rVjXSZM/mjm16/0MjMaGiP8LGx+4r LlxL7En+sUmCvwVqUACb4EM7IH79TpUCworivDvIqFZDVKGiiDL9U7izUHO8gIQ2dHrz RgD++70mmEAiZnaP86D3vd4zWZuUyWBZxbwRewn7qm4rtvbQoXTL97QfHYTgFa46wC3U Q2HP5x2EXOhHBQo2QjjRc0ReeXNMYLoPlgw1jMPVEmrQRntOhlj8o2pdKMaf/0tVduvp owAjLDmaXgA2WGk9eYhL1Rv1PjjkIe0DmYK9Ni6jp37EGr/IILfRpS4+i8TbaHkb7FnB Fm5g== X-Gm-Message-State: AOJu0Yx5uIK70Mqk+NzjBY6UuaHEX9tw9kwN14ckO3abhpBmdwcSfR1Q ZX0jFg2xHWZG38ZoT/90uBG1fAsu8+rmtPSTxqn3zMDYpSh72xR0o/n0DNzco1TbPd6F16F+bUw cRLIQQmXjlnfiVHbUEZRhU8nWHAHYLDdAXgA3yuHjIDf3Y8GOE6bvpSg3kJ7UVFxvrQeGFkWqpk M= X-Gm-Gg: AZuq6aI3q8diNtwapSij52Rq+jJWE3vjJSUPUh0149dgGdRGqFVKqpWsXQ1HCLpYYkz vyG1LczVO7epCLykHT8jN/GsrrJ3Vq1hYxazKV6UqJ4IKKW0F1ETsko9+LkYGb/rtMJiJ5EGZYR McuYKl0jfcpUlfl/bERWdrZqQurRPkCMLDfnsalCoHNKsvGyE+fg4tolUxh9HRmUnPlm3h8OWz0 KPUkQx6rUERIEUweJOGtEe4ht/V0FVGvQnexeq5DQ+UqzmnkwnFSxDJ/iFxNmZWC77b9wLsH63J zrBnNr9OQrQCHYdnPKI0VwERSm1PRLbFJ9e0sh50Fn8/n0CrVsv7+LQtvw3B26nDmyksrEQg/cX XS6f2w1AAlBjli/EIV8yfm42ip5/FGDtFtD63/nnp7w7OFR/TH6S7 X-Received: by 2002:a05:620a:2844:b0:8cb:3e7c:a4a4 with SMTP id af79cd13be357-8cb8ca67610mr976070885a.46.1771841198772; Mon, 23 Feb 2026 02:06:38 -0800 (PST) X-Received: by 2002:a05:620a:2844:b0:8cb:3e7c:a4a4 with SMTP id af79cd13be357-8cb8ca67610mr976068785a.46.1771841198374; Mon, 23 Feb 2026 02:06:38 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:37 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:14 +0100 Subject: [PATCH v2 01/14] reset: gpio: remove unneeded OF-node put 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: <20260223-reset-core-refactor-v2-1-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1749; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=+mk4ppL9XWF9OnQIKVkGYEAnsfhU9QaSc9cxpk6TKTM=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCaf0o9gtJciiwopTJ9dKc040oEmNOb7+sWuX jwVo/sks9qJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmnwAKCRAFnS7L/zaE w8mHD/4ynadNLRzzd4URmipE73UC35+Vy8cFrhfWyjeWj4QJXg3NIWtCkr89Jv4NKp7d6xSVgRb fYGA8YyWHDGNfjPYtFEz88H5232kmP1insAcvG/NMonGSUYvWtrZNnJdxd9LNHt++gUL4JuPx11 v6Yo/2V4cQqNYEEqRmUc0aa3C/yEsi3dFm0pVKssx+hsiWrQfoeAFvBYzZ82uu2DUW3DLpomt2X JKp1cOIfGkBj9tK0MMAkmOpc9BciMGJt8jm6xS+iS3RxHTXa8SYwaG/B9dG3f8S+RAqUKDXcBOy wTpZrEXESLHZOMVR8YggxWYkwVA1FARMZ1wIKH3RSQqQnPa7Tmhrwf+JQ462zPNaz8U2PnYmslu oNO/hp5t+FTZkh6GXH70gCUe3ypAmePX15Uh+TwHh1kOadlxDZQFCFuxfpLpbqOXXa7+eE3HZDi /W8XSGXw9pNhfMZ0kEvklCi1VacPtP+Jq8VrkFZaypIXrvTYFRiyWl1qt6rdqv8xE0KHttBeArP rDwl+nnBalf967UqcKDEc36EcwgBcdA0hJs+GQuBz5qKP+lUtbKqqoWiIUjnhjFBp2ei/QqKnZD auUu7U2F3UO/CsIn2b6cCwv9T6T41E8Cn0R0lm/e+1cL4lzQYzNQZsKNk8lLJ1YSZHz/3sv9hrS GZtqUffCx/Lalyg== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Authority-Analysis: v=2.4 cv=AL4GpdX7 c=1 sm=1 tr=0 ts=699c26af cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=ygpbbqW4ee5_35vKHe4A:9 a=QEXdDO2ut3YA:10 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-GUID: YUpgM23JLmQISekPJtZCygG3nDrxai1e X-Proofpoint-ORIG-GUID: YUpgM23JLmQISekPJtZCygG3nDrxai1e X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfX2CMuI6iNbQjD tnQ2omrQlUad60GhD1xgawg2lS+txDDCESlModBuqF45ZOpVoYUc1mvuTXYotYBF1SZFkvD29Td 59PzeyixVJqTbLpNYnRJ9hsDPgFnywmQn6D81q2eL/Wm7M7zsQECLmrhobs0NdrozdH8wKjQ4/t nx3noRaew/X2FbmzBQVE/Xn7rzw5and0WwBdsVDwXfMw92ooWUNhOhwWTvAmYs7zW9Ah/zWJLYs ZGdyIRQ6kUoVVlkv75UM5CM+8XYZrY4cSfJ6PZYim12190G3wHLTzb6vQBaLOCJu7IAfeuy0Xr/ dweZGDfjrELMOWo7ui0RKexuU1RWHZeilFSxi0VAbJEcOceRIh4tOqmN1l7Cgqrw4KzzRMlyPLY Obw81MIfWiusHIV3WUyY05NBnbH5tUNneEK2jB6X6PNNSmNdLC9zWwvphXUjYIoDudEXzdgUs5H zWfPIEAeiIKmg1LIKEQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 clxscore=1015 suspectscore=0 priorityscore=1501 adultscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 priv->rc.of_node is never set in reset core. Even if it were: tasking the reset-gpio driver with controlling the reference count of an OF node set up in reset core is a weird inversion of responsability. But it's also wrong in that the underlying device never actually gets removed so the node should not be put at all and especially not at driver detach. Remove the devres action. Reviewed-by: Philipp Zabel Signed-off-by: Bartosz Golaszewski --- drivers/reset/reset-gpio.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/reset/reset-gpio.c b/drivers/reset/reset-gpio.c index 0a1610d9e78a3f1db8f523654a548fbba6087106..ad5bfe27aaef7de57f956633025= 3333aa2b1253f 100644 --- a/drivers/reset/reset-gpio.c +++ b/drivers/reset/reset-gpio.c @@ -52,18 +52,12 @@ static int reset_gpio_of_xlate(struct reset_controller_= dev *rcdev, return reset_spec->args[0]; } =20 -static void reset_gpio_of_node_put(void *data) -{ - of_node_put(data); -} - static int reset_gpio_probe(struct auxiliary_device *adev, const struct auxiliary_device_id *id) { struct device *dev =3D &adev->dev; struct of_phandle_args *platdata =3D dev_get_platdata(dev); struct reset_gpio_priv *priv; - int ret; =20 if (!platdata) return -EINVAL; @@ -83,10 +77,6 @@ static int reset_gpio_probe(struct auxiliary_device *ade= v, priv->rc.owner =3D THIS_MODULE; priv->rc.dev =3D dev; priv->rc.of_args =3D platdata; - ret =3D devm_add_action_or_reset(dev, reset_gpio_of_node_put, - priv->rc.of_node); - if (ret) - return ret; =20 /* Cells to match GPIO specifier, but it's not really used */ priv->rc.of_reset_n_cells =3D 2; --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 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 9C93B35D604 for ; Mon, 23 Feb 2026 10:06:41 +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=1771841203; cv=none; b=ZCdNYsYtpv9YXI+KqaT7Uccnvo5AY5DXzsxRgwvbCT+vz4kiplBmyvkRxeHmoSAG68N/7Sg25ARSEGxsC2KVMlV2LoZthA0wVwNYF3L4r2IKfAVA66xExGEMTknN1Zh3yDEF44VzXOjwmWB2Ve/7zjtOCSijmENNoy7XoZce/D4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841203; c=relaxed/simple; bh=JZWuny8/TcvSZjzaVdqaESeV6oNV6YTL1+iT2y0pExo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eEU9UT2/1/aZnGsc2j7docHijlBqWoL1XiPApBkaW4iOsy5W9B6A0qRV240CDIn1GTw/5+pV88znMOwA5JP6jnqqD6lX/PsS6R6ZtLbdaY2tjKX8IabyCNvPTgzELLpIR/mGXjJDkotpCWMzRW4TakjLNQG3qaFm4PAUe1YhB8w= 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=nk46jamK; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=csluF7hU; 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="nk46jamK"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="csluF7hU" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N17nML2203676 for ; Mon, 23 Feb 2026 10:06:41 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= R3rlwUodHa1xBLQFp92Dedtm+Zhls9xlJ8VVyipx7aA=; b=nk46jamKMyJuWz3Y Hy5L1s3SDaDgWfyQ6ODqtJUgDRRPjxdS/Zr/td99NhNMe8SUlDEd+Z6zskiqpvOV gcadDLr3Q03XwfHNFwtr+yX+8MRVH5ikT7qURvue1oZupKHqvkfzWPOg3F7S4HZv 4F9zwT3Qx7VYvx3/dojQIwmQfshqkXs4sBtdCInbhDxPoZNb00BxQAbBYDv+a1uA DblgE0Na4EsKP77J1Dr7S3i75yFSPdu27iqsJ+HggZkfe5Wlz2Rp6e/QkZOY39EQ 1cSJll3P/8kJ2YaHy2OMsY4VSgkCV0VmvCjHUgYwWVpoPRfd54vlliTCAPDmw9zM 2CYbKA== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5wbca6e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:40 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8cb706313beso580451385a.3 for ; Mon, 23 Feb 2026 02:06:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841200; x=1772446000; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=R3rlwUodHa1xBLQFp92Dedtm+Zhls9xlJ8VVyipx7aA=; b=csluF7hU/VIebD1HFzOZOphMmLgeqwW/4MHRhvYbqlf0HOwBdRBp0w5L9slcVtnQOc Q7FFOlv/8fzkZomYZRxVbqMTzY6mp3ojyr9wVARIs2z4welwLeUu65d/p/7koa50zUXf qjlBiBDati44Oyv/PCY74DyGGt9eBJVCxTIJs+dDh0OOr6rkTps30dbeBGowW+hUJIi/ RSwJgrDKi0M+S0ux4rcHL9dNWwlNAATAexe7VFPClQnE7x75ruKeXRlaWWbdMvL6IWP4 0Aaw3bPlfxlZx3hOj8Q2PlY/nJQxxSmlND1s2GObR0cApsQJTXJIj5PR5RbG8MzPD59L UI4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841200; x=1772446000; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=R3rlwUodHa1xBLQFp92Dedtm+Zhls9xlJ8VVyipx7aA=; b=pKz6Umm0hQgud9cvuzOEyT2/fsm3Hi5orbSrzIykY3Cfx37Wdgs26bwiMQZ9E/cH4X me8DjSgB/hlXUHDpGhjG7D0CUit0nHn32tJKE4cypPhqv1edG8RA3DLAVykHoyEx8rnK yBxa7axjJBzQFZPFWK2LuUvHeN9O/KR050bSwdJVJDPjBVxXOsRNV9oRhLsSNhwbD8PR 5fagnlmJWRRKh3aa8ZVkUKkLaFupihZqxdpXybaGgMfPTOdTd0Q0MidcClVEtWcA+Vjp VgkBCzpvsxrnUPxgMu8GJ5R2bcnrlHjqDhAfElWnuP1lFRf0FYItDwk5IXsZdtBazHMB Xvgw== X-Gm-Message-State: AOJu0YyJNZi4kXjZX3xakexS1rN+a+I57QXXG47kncv71kesREGVMvL4 O9XLygEG4vaTiksIJuYiPslJwwIXl5iTK+3jZUbh7/hpbrVYUnNGHGCRy3JrlkR+nX5/jmmtCCr 1MbJSak6sw/s98deq1VAHUz7SjI88GjVifJ+XXqVSdEcagyS1uqJ54q1rLLSaY2ruIXrskdgk3R Y= X-Gm-Gg: AZuq6aJPf5f4ieOYzPR12L5BYo7KOkEpliP3ys73/geUinNlop25UhyqAp2GrowfQch OaNRl8t58O0jjt3U9F9jmoMSdu8Je+8x96gLcuF8/hsY326yrG07PMBOlSgKQxAbuKwSYP4t3Tj z5AkLkdKObIfJBqwHz7CihHw0H/8vYukey8OB7Fc/RWtlTDCN1rhrGyDy2XGp4ZX1ygzMUL/+Af 5172W3c+Q6EVj1rhg7LqX3/4jHuIJsk2iAL6bnSj2Y8fhCbKFMeAn90+cV4ttjgBlEZAeSTWe2y u33o9RCO/mh0TYye+KXU8vvdKXw7wsqSPOd2hiQEvqQS1gZqR1P0oSdsyErjczkPMxrj3K8Z24e /Wy9N7S5g/N56GGBhDtrq/U7ku/UG1B5aunqAmQ2CeUxbQT16LvWD X-Received: by 2002:a05:620a:3706:b0:8be:dd2c:a0fd with SMTP id af79cd13be357-8cb8ca66084mr958516885a.44.1771841199810; Mon, 23 Feb 2026 02:06:39 -0800 (PST) X-Received: by 2002:a05:620a:3706:b0:8be:dd2c:a0fd with SMTP id af79cd13be357-8cb8ca66084mr958513385a.44.1771841199236; Mon, 23 Feb 2026 02:06:39 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:38 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:15 +0100 Subject: [PATCH v2 02/14] reset: gpio: add a devlink between reset-gpio and its consumer 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: <20260223-reset-core-refactor-v2-2-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5824; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=JZWuny8/TcvSZjzaVdqaESeV6oNV6YTL1+iT2y0pExo=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCagCkVOuhGU6iU+OCIIx96hU0Nj4o0r+Pofp nJ5EUefInqJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmoAAKCRAFnS7L/zaE w3sFD/9on0QjCLLAndgkc0/WOLQTch+SEQp74Q/QrIZMiJVSIK35f3fLSlvFUsDU2TEFFw7k5nA CyFlC370exYea9CCKhCCu79PyNXfK44hdcswmFPnU4jsWNokiCrt9FysuhQWQ8IwSOkLnlf6Jv1 cvp+0jnFqUOyviwoKUKC0vjxjGUoi0BFp1GIaqpiKYxtgKKAe0QFTzl2WaZvvPtChtHvkAu/Xji B9+qprNy9fpy0liPC1v3h72t3W5uuQ4tkIHAXoaVFm4P/oDVBbmbtzxnOWGUH3oFVKVOqtf4RLo 6B4yRgou/MEzAyjwlF0UOstwDemAgoIZ9t9OqnoFiB8HankYM0pzZpM5Cg9GtJWmEaVZWmsuD7Y PzZHlOfz1EScFy5ONnlgV6FOCkIcZK1DSmeFpnUqoxvTtLhaD29iPjuvAba8ukzMxzZWR8ztEPL Dtw3Nn9QRnFDqRZ5zNgcVyyk+gbHg7NVcoos+1GueDT7zWxoDqqqBQkMUW8Ayq0K30xztBVU5qs /RZLsTcf6t7msvML/5xhJWUsEXYxoCVsRizde4xTGf/sHYpUrq3wMk+Sah5/5XrjI1t4CxVdcj6 GsRKm+UipoYw9I3Gk79O7ROaE4AU7LDLiLjK+Zt+wjg/6wSZ9Vu5vYVZdFLzIpYqCy2m21N7lTV 2g5jnehox3TX0OQ== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-ORIG-GUID: D3Uhtj5SO8anj1oC0RC0mEQ8VhKxEhfa X-Authority-Analysis: v=2.4 cv=UZlciaSN c=1 sm=1 tr=0 ts=699c26b0 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=gl4R_IGdbvU1KyCt79YA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-GUID: D3Uhtj5SO8anj1oC0RC0mEQ8VhKxEhfa X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfXz23ZXFpZsLnL eQHJ96vtiVSDUyKoG15Xbi7Yod5wiHcveZFFCiTgi12Y1sNsYPhLqe8DMq/5QU6lpPS8nak7/6h N5Gfri3Th8uuipH2XoAAGlusB0NHSgUcHvoT0/tUUGC/LVRyqGPj49hpkBGmbWPzzWS+Ox7sNWp AgVxltSCxXJhOWLPulRPKuSfIkgZoTzoDyHdrzEgjIYF/kumEyMtDyQLbQyXD/LTWum1XHREThp oZHNal4UyUeWaPMnlNzsZAyNg0jaLMKSS7ZMrYwydAoiNIkF39musjlKwsnNtSYQrD/QT4BxQsi 9TfWJ24vDuCWMp+ix8o3yav57LuCLrZNLxUk7hcHJv4AGqyDOcsJIqvUxWsDM922CDLZFA8KIco E0Yni+S4UV6lHZ1TCbPiGiMSD1139Ns4QSUVuoP6vdMOGALGtRjvC1oc+48A+wd+RnfmyI52AHZ xNByfL3OWmJpsy3rsCA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 The device that requests the reset control managed by the reset-gpio device is effectively its consumer but the devlink is only established between it and the GPIO controller exposing the reset pin. Add a devlink between the consumer of the reset control and its supplier. This will allow us to simplify the GPIOLIB code managing shared GPIOs when handling the corner case of reset-gpio and gpiolib-shared interacting. While at it and since we need to store the address of the auxiliary device: don't allocate memory for the device separately but fold it into struct reset_gpio_lookup instead. Reviewed-by: Philipp Zabel Signed-off-by: Bartosz Golaszewski --- drivers/reset/core.c | 79 ++++++++++++++++++++++++++++++++++++------------= ---- 1 file changed, 55 insertions(+), 24 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index fceec45c8afc1e74fe46311bdc023ff257e8d770..3845e77a8d32bf615c9d430847b= 497af0ba374ad 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -77,11 +77,13 @@ struct reset_control_array { * @of_args: phandle to the reset controller with all the args like GPIO n= umber * @swnode: Software node containing the reference to the GPIO provider * @list: list entry for the reset_gpio_lookup_list + * @adev: Auxiliary device representing the reset controller */ struct reset_gpio_lookup { struct of_phandle_args of_args; struct fwnode_handle *swnode; struct list_head list; + struct auxiliary_device adev; }; =20 static const char *rcdev_name(struct reset_controller_dev *rcdev) @@ -824,49 +826,72 @@ static void __reset_control_put_internal(struct reset= _control *rstc) =20 static void reset_gpio_aux_device_release(struct device *dev) { - struct auxiliary_device *adev =3D to_auxiliary_dev(dev); =20 - kfree(adev); } =20 -static int reset_add_gpio_aux_device(struct device *parent, - struct fwnode_handle *swnode, - int id, void *pdata) +static int reset_create_gpio_aux_device(struct reset_gpio_lookup *rgpio_de= v, + struct device *parent, int id) { - struct auxiliary_device *adev; + struct auxiliary_device *adev =3D &rgpio_dev->adev; int ret; =20 - adev =3D kzalloc_obj(*adev); - if (!adev) - return -ENOMEM; - adev->id =3D id; adev->name =3D "gpio"; adev->dev.parent =3D parent; - adev->dev.platform_data =3D pdata; + adev->dev.platform_data =3D &rgpio_dev->of_args; adev->dev.release =3D reset_gpio_aux_device_release; - device_set_node(&adev->dev, swnode); + device_set_node(&adev->dev, rgpio_dev->swnode); =20 ret =3D auxiliary_device_init(adev); - if (ret) { - kfree(adev); + if (ret) return ret; - } =20 ret =3D __auxiliary_device_add(adev, "reset"); if (ret) { auxiliary_device_uninit(adev); - kfree(adev); return ret; } =20 - return ret; + return 0; +} + +static void reset_gpio_add_devlink(struct device_node *np, + struct reset_gpio_lookup *rgpio_dev) +{ + struct device *consumer; + + /* + * We must use get_dev_from_fwnode() and not of_find_device_by_node() + * because the latter only considers the platform bus while we want to + * get consumers of any kind that can be associated with firmware + * nodes: auxiliary, soundwire, etc. + */ + consumer =3D get_dev_from_fwnode(of_fwnode_handle(np)); + if (consumer) { + if (!device_link_add(consumer, &rgpio_dev->adev.dev, + DL_FLAG_AUTOREMOVE_CONSUMER)) + pr_warn("Failed to create a device link between reset-gpio and its cons= umer"); + + put_device(consumer); + } + /* + * else { } + * + * TODO: If ever there's a case where we need to support shared + * reset-gpios retrieved from a device node for which there's no + * device present yet, this is where we'd set up a notifier waiting + * for the device to appear in the system. This would be a lot of code + * that would go unused for now so let's cross that bridge when and if + * we get there. + */ } =20 /* - * @args: phandle to the GPIO provider with all the args like GPIO number + * @np: OF-node associated with the consumer + * @args: phandle to the GPIO provider with all the args like GPIO number */ -static int __reset_add_reset_gpio_device(const struct of_phandle_args *arg= s) +static int __reset_add_reset_gpio_device(struct device_node *np, + const struct of_phandle_args *args) { struct property_entry properties[3] =3D { }; unsigned int offset, of_flags, lflags; @@ -916,8 +941,14 @@ static int __reset_add_reset_gpio_device(const struct = of_phandle_args *args) =20 list_for_each_entry(rgpio_dev, &reset_gpio_lookup_list, list) { if (args->np =3D=3D rgpio_dev->of_args.np) { - if (of_phandle_args_equal(args, &rgpio_dev->of_args)) - return 0; /* Already on the list, done */ + if (of_phandle_args_equal(args, &rgpio_dev->of_args)) { + /* + * Already on the list, create the device link + * and stop here. + */ + reset_gpio_add_devlink(np, rgpio_dev); + return 0; + } } } =20 @@ -951,11 +982,11 @@ static int __reset_add_reset_gpio_device(const struct= of_phandle_args *args) goto err_put_of_node; } =20 - ret =3D reset_add_gpio_aux_device(parent, rgpio_dev->swnode, id, - &rgpio_dev->of_args); + ret =3D reset_create_gpio_aux_device(rgpio_dev, parent, id); if (ret) goto err_del_swnode; =20 + reset_gpio_add_devlink(np, rgpio_dev); list_add(&rgpio_dev->list, &reset_gpio_lookup_list); =20 return 0; @@ -1035,7 +1066,7 @@ __of_reset_control_get(struct device_node *node, cons= t char *id, int index, =20 gpio_fallback =3D true; =20 - ret =3D __reset_add_reset_gpio_device(&args); + ret =3D __reset_add_reset_gpio_device(node, &args); if (ret) { rstc =3D ERR_PTR(ret); goto out_put; --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 C8D8D35B636 for ; Mon, 23 Feb 2026 10:06:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841204; cv=none; b=VqGIwXXolXNG69bpFsDf30lpwrpz1ZHN2VTyhgGNemeYM8HTe8vXGzA73HGV9O3LD1WkSDjxLOI6LApRrNUtDOkJtGQ6f7dsB0OSnt2pHZ3jkzTPxSS2FiiMlEqAtY5D+MLZ32msx7eErn82lUK/O1DFwnZnQX6hqcucCf6uHbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841204; c=relaxed/simple; bh=Ls9/mxstBPiUscJXanhNIGaakaOL37aOeasQtK3uihk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FoVVaTdDon+j+7eIFrJ8ev/twFOik9neZt10MkHQuTzpnD2w+h4my8ngvOTkaN+4WInpGEQL2q3ajk6oYLHEjpTn3sTnN/iXhCqXPL8tk3pWrwdqo4p1d0d2tjgi5sMX0ICsnGmtRQipiQjV5fc4KIJSgBYZHrMsToXjTp8kSKA= 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=Ms6y54JB; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=a/+hjpE+; arc=none smtp.client-ip=205.220.180.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="Ms6y54JB"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="a/+hjpE+" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61MMQdFo3552830 for ; Mon, 23 Feb 2026 10:06:42 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= Hf+hf6kFRl7RMaYp5pixwnMILTepD9GtbgC8b6qoZjc=; b=Ms6y54JB2MTLD9Cm eir0fCQ9yueOxyrse+72M0zfjF6++PdoIqX+h5GkDukxJiLSg9qc4xiQKpmgZ9ka cN5L0V3/eE2bvibkQENpCxrO8+ZGRvuyUfsu39wgc7A2md6+JBwIFsA+WUYk0QX/ nqNU6qKYoGkUr/jadfCls0PbUDk3H8fSfS714e0//W35dBJo2EoW8KIkBnEmCm7m Bi3xNMLfltrdaKQQwKt5uWxTkHzNyZJqSG4XFsLOMEGjVDt1TrvJNpVLqdI1ds7w BMk+upHMg2nINzK2iz95aB/3m+PZRsQ/ZQ7C7Q0DapPre8rqOFS5lHAaG5u/qUsd L5qpPA== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5u8m8m1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:41 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8ca3ef536ddso5137037485a.0 for ; Mon, 23 Feb 2026 02:06:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841201; x=1772446001; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Hf+hf6kFRl7RMaYp5pixwnMILTepD9GtbgC8b6qoZjc=; b=a/+hjpE+U5v5HWLmZAq9u1GnPMbbLH45nZ1RYaULaceMWYRR7b5GGt1wJDXfJkOEAb KeKaGIKK536lCzsneMkY3Zb4MTrxlPKvon+KRV2L+kyxGv7uxc1se1y93awrGahpjnvP thYQssKyyYqmBFhZd2sCnQLGqJLmoF8K3hk4mwx4ECOI5nStKG91Av9FfpxXKBZNm9AP KY9kR/NQPj+b6LYXKhUUTG4CQAWNJ74H61Uigm8kTp99UySFaCm0i+fdeRpfOX5H6gkz 72Uk091JhaTUWOFXne3yFoKw3ZpvJIphsUlqNXCfll11OWRV/7/N6jyNcv1pmV6wmj/M x2vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841201; x=1772446001; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Hf+hf6kFRl7RMaYp5pixwnMILTepD9GtbgC8b6qoZjc=; b=SUXh+JB+ma4Ji4V0kzpfYN8v2WVS/C5CL9eg8+8ry/4DgFMoKPtQL7w0buGXZayP0y TPr+ruqQTcHKMJdqOpldPH/aXhNaHpBDkuk4hDbYKxIuDjygL11On4TqMhX/0+IHU6uY Kx9Dj9/moNM7E7LUwmgfw3iFp5XlKu47TsvgKOZoNYWBixn3eZcLkScmy9RQfjgv08JP fg3oOvgsvfjWM07jqo1U776EApF8cNqzyHiYi5cHNH26WFY1/GGh3bChgJqcvhxtsxz7 mexf28GDYoSqIgilW6bDx7OrYBvW/fdhF7MZOs6AQg2677jTGVw9ZSVGqK1UxP++r/5W q7vg== X-Gm-Message-State: AOJu0Yy4/ryjfJrcl/DEArsbHCQkDnkSuAMIyVdiSiKGQSe4WaJFKbeY V5KuLCKmbJNGN7GDGTOTrDSd6tka0/fKH2THIewl55Mvb1t1cz8JEUSzllpGyvi/Bm5C2NKVZkU 1mDpw/7X0oghjkDtXxAc43eHNEwHiYKB5gVanc46CYFuqR0EVYNGaBtyx6k5inIViCdbG7oz/QD I= X-Gm-Gg: AZuq6aLdYYc1T53B0IYUvulViHqfwqzWFx6scwYSFVhP/6ea7BBsWRpaLFC7IYoCAaY 4yOh0fgMWxWT4j8do09Ulf5y2fmlxBV1iHvTOZGGO0+YudEccwQE/ikxfzMgI5i4Hk05yB8PxdO 5vKddDSNaSqNv9lj3sgUJMfN+SwzAg7uSOw3j0bg3050mHDMY7PiAaTSOQAjh0Q+7hQLkXon61X vCMah5PPqatAEEkax5xqtUJQgdIkVPiLsdnhhb/ueR1ryj5ldIt6oaZcK0wKyibaTqs4eqvSO5z 3ViI0Z3vQco15F0STBATooXuRrXuygQTajAHMUh0HXKz9UEctUht7/ksSgHH1D7OM+P9UHuQYvB 5W90jVYNXkX7ssBLslKp0UJ9jKMM17cEycJraV9GJdd1yxGJtzKR9 X-Received: by 2002:a05:620a:1a9a:b0:8ca:4545:aedc with SMTP id af79cd13be357-8cb8ca0e852mr899480785a.36.1771841201082; Mon, 23 Feb 2026 02:06:41 -0800 (PST) X-Received: by 2002:a05:620a:1a9a:b0:8ca:4545:aedc with SMTP id af79cd13be357-8cb8ca0e852mr899478585a.36.1771841200586; Mon, 23 Feb 2026 02:06:40 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:40 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:16 +0100 Subject: [PATCH v2 03/14] reset: gpio: simplify fallback device matching 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: <20260223-reset-core-refactor-v2-3-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4468; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=Ls9/mxstBPiUscJXanhNIGaakaOL37aOeasQtK3uihk=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCaiq9ZC02q3p+YbMjgfrcFfr0wvskISl6p5e br91EGgHc+JAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmogAKCRAFnS7L/zaE w3C7D/0UUTnRgbjqj/QmyW0khlqmdgrbSgH4s8+lp7UJR89BvA1vUOCXJ3IO+9Szs0vHkqWsac3 fM22+7U2LWujPrlan8BcAFcuYj7+voeMdurQhWSLSFf3jTVYgFxb4800Z7maV7rVD/kSSvcrshz 53QUrbYR+fTumER1laEQt8AGswbgjbe0WUdreCut2S9DNEiTVhWVnmcT5Iy3bECpgBAr063deW4 a/KZcGUbXgARSWkrEs3KCImEL/5qvhpoEOnZhdXsEDbri/15hLgtURipBkRQYetfXLm4DzmWuag gDu1VHK8MWhAcM4VOZL2CBp348CfDr3RxstyGubVNQmNinEnjf11yZC83iW2E5RwOsattSRZoF/ c6xUAJGLRThjX5LcFc1AgCWbR/L4+VnV+k157QjUFB9ooLQdt/kA3e8FmkoZSysSj50XxTts851 dTxY+3EL0d5JTG8yaycIku6QRn8o2usLB3FBK9WXaZqqJOagnfKWuErNzrQ89v1ios8TUJEs0ZF 2VZsriB+U+qdY8sTp/MQY8BacuYl5aHjq2hijAlf/DuDzuegwfcqeIfxL89mpmN7fKTf7m2xSIm /Csed5kAb1+151Up/RYzCa75OdmRB5L/E5pJ1hfdKCTY2eQqo6ZtUnp9cOQByjBmgmVeX6eRY/v 81+eDcszw6BLDZA== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-GUID: jhDpAC-kalqyppsdhiXv0n4qyde8z_bN X-Authority-Analysis: v=2.4 cv=cJftc1eN c=1 sm=1 tr=0 ts=699c26b1 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=C-6xm7Ge3zJZVfUZFQkA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-ORIG-GUID: jhDpAC-kalqyppsdhiXv0n4qyde8z_bN X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfXzJAIeTWURwot FVhMSL6xQWINuyrBdLtQCeV2dCvT1feduo0WWjOZFAdUiE3CoXW8nb4Vaj5u8wBGzTigby9d8B4 j5oyv8dnk9n+ejMf8aijXLiVscVpkQ6u3rXksMhTOHq+bEzJCpT3ZS7QgU2a3gcHl2HuGN4US8K qjEcoSK/hPFPuFAwb6V29hByVGRYD4ZMMteJOoN/KPmuOnoTsGu4P0cuzHHpOvK0kVteKyXO7IW WI+2lXrIxO9yqL9E0MHU4SQvqaxje+tKu6jPzTa8/e8F/yp8Mrz8G+Ckz74440m4HPtgnV/QB+d YXIVM+sMRkXtcGOXIVUmuFhjzC80aGAtRiHcz0WIoXi4WLgWTZnjl9f3rNh4DmmuKcyiY6UcaWm G9b6kcsxhgP66pItgw95nT8p612WPSU41GGY4M84hjTSRl+W6N7JGG4GGLFqhA+hE+yTj5TbqDP I1uke+QZTsJmULSKRfQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 clxscore=1015 malwarescore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 The of_args field of struct reset_controller_dev was introduced to allow the reset-gpio driver to pass the phandle arguments back to reset core. The thing is: it doesn't even have to do it. The core sets the platform data of the auxiliary device *AND* has access to it later on during the lookup. This means the field is unneeded and all can happen entirely in reset core. Remove the field from the public header and don't set it in reset-gpio.c. Retrieve the platform data in reset core when needed instead. Signed-off-by: Bartosz Golaszewski Reviewed-by: Philipp Zabel --- drivers/reset/core.c | 15 ++++++--------- drivers/reset/reset-gpio.c | 5 ----- include/linux/reset-controller.h | 4 ---- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 3845e77a8d32bf615c9d430847b497af0ba374ad..954df36a242e804b63902738470= 0b8d988be0e90 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -94,9 +94,6 @@ static const char *rcdev_name(struct reset_controller_dev= *rcdev) if (rcdev->of_node) return rcdev->of_node->full_name; =20 - if (rcdev->of_args) - return rcdev->of_args->np->full_name; - return NULL; } =20 @@ -125,9 +122,6 @@ static int of_reset_simple_xlate(struct reset_controlle= r_dev *rcdev, */ int reset_controller_register(struct reset_controller_dev *rcdev) { - if (rcdev->of_node && rcdev->of_args) - return -EINVAL; - if (!rcdev->of_xlate) { rcdev->of_reset_n_cells =3D 1; rcdev->of_xlate =3D of_reset_simple_xlate; @@ -1006,13 +1000,16 @@ static struct reset_controller_dev *__reset_find_rc= dev(const struct of_phandle_a bool gpio_fallback) { struct reset_controller_dev *rcdev; + struct of_phandle_args *rc_args; =20 lockdep_assert_held(&reset_list_mutex); =20 list_for_each_entry(rcdev, &reset_controller_list, list) { - if (gpio_fallback) { - if (rcdev->of_args && of_phandle_args_equal(args, - rcdev->of_args)) + if (gpio_fallback && rcdev->dev && + device_is_compatible(rcdev->dev, "reset-gpio")) { + rc_args =3D dev_get_platdata(rcdev->dev); + + if (of_phandle_args_equal(args, rc_args)) return rcdev; } else { if (args->np =3D=3D rcdev->of_node) diff --git a/drivers/reset/reset-gpio.c b/drivers/reset/reset-gpio.c index ad5bfe27aaef7de57f9566330253333aa2b1253f..6e1c4f990bc0e54f4a47186340c= ef03b1a2ee29b 100644 --- a/drivers/reset/reset-gpio.c +++ b/drivers/reset/reset-gpio.c @@ -56,12 +56,8 @@ static int reset_gpio_probe(struct auxiliary_device *ade= v, const struct auxiliary_device_id *id) { struct device *dev =3D &adev->dev; - struct of_phandle_args *platdata =3D dev_get_platdata(dev); struct reset_gpio_priv *priv; =20 - if (!platdata) - return -EINVAL; - priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -76,7 +72,6 @@ static int reset_gpio_probe(struct auxiliary_device *adev, priv->rc.ops =3D &reset_gpio_ops; priv->rc.owner =3D THIS_MODULE; priv->rc.dev =3D dev; - priv->rc.of_args =3D platdata; =20 /* Cells to match GPIO specifier, but it's not really used */ priv->rc.of_reset_n_cells =3D 2; diff --git a/include/linux/reset-controller.h b/include/linux/reset-control= ler.h index 46514cb1b9e0626872fe71357b24d54ff0e81a8b..aa95b460fdf86f10002a465e285= cd0119da6eeaf 100644 --- a/include/linux/reset-controller.h +++ b/include/linux/reset-controller.h @@ -35,9 +35,6 @@ struct of_phandle_args; * @reset_control_head: head of internal list of requested reset controls * @dev: corresponding driver model device struct * @of_node: corresponding device tree node as phandle target - * @of_args: for reset-gpios controllers: corresponding phandle args with - * of_node and GPIO number complementing of_node; either this or - * of_node should be present * @of_reset_n_cells: number of cells in reset line specifiers * @of_xlate: translation function to translate from specifier as found in= the * device tree to id as given to the reset control ops, defaults @@ -51,7 +48,6 @@ struct reset_controller_dev { struct list_head reset_control_head; struct device *dev; struct device_node *of_node; - const struct of_phandle_args *of_args; int of_reset_n_cells; int (*of_xlate)(struct reset_controller_dev *rcdev, const struct of_phandle_args *reset_spec); --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 8AEDF35B642 for ; Mon, 23 Feb 2026 10:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841206; cv=none; b=KPf+sY/DdFHM9Ceq0l6zKieHdNpABzqxmcFtBVMyrKpRDoYFHjPfMGXMc2xQ2seHNQt22jtD7WrIIaGNICMuT/Zs6CdSpvRr+IHXPA++SVwxpgOmNES8O/1SZsQpT8FfW/nb90ox0uQb6HQYfk1mNmGKpZPOuqy+MzvccLuEiuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841206; c=relaxed/simple; bh=8F2/35WvpX/TqMubbBTsFRZjI4ctiUcgIyYIkq9cGII=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nEemCYkewpachM7aPYBppHdAHHlWJYEmm14rpWNUThk/QBh2ZyY+dUXaDXNzO3hoYqocQJtXj2FtPZkka0YdLLeNzkgCbrPZ0/5bdZoyVcmBgvKuqAfkU2EERSO62K4fHMngLQXmfN5mmWO0Qrm4YHGpruawtJaMpPF2sNtxJCs= 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=OBrgw+l0; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=bbkz9EHO; arc=none smtp.client-ip=205.220.180.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="OBrgw+l0"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="bbkz9EHO" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N8AVO51036553 for ; Mon, 23 Feb 2026 10:06:42 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= ajd8fwlcy0ukV9JCrBK3xVJx+7J/zUO5UQPSfgWVqOA=; b=OBrgw+l0Jm7+b6uW FGvK/uHGU+tfhwR0k29vSHpSs8lk3wZP0K+jFzbP4qLi5QcZs8Sf7V+U7nhegfi5 7VIjfQDIEuYFmvG/MW50TiCjwf7rI4mCY7tMD51wa69nkL7Ltuzxw8Ofw0AQQRGo jcVev9L5SiHZQhck4ks/fDCqTL3IaOqQuwFmj4lhs7HFc9wGSizuAu5s4n3otgWI XsKFVXUOmHt1upu74nVNoQ6j9k/mcYVYEhwKWsCcLuOh89iloPcAG32bgMQ9unE1 +GMsjljxWA7sIfbASoeMY9GoRp6SRhx6rKy7xTGj3SG8SNOLRwjVxlcpzr6zgEGl IksKtQ== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5u9v9ru-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:42 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8cb3ff05c73so4157555085a.0 for ; Mon, 23 Feb 2026 02:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841202; x=1772446002; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ajd8fwlcy0ukV9JCrBK3xVJx+7J/zUO5UQPSfgWVqOA=; b=bbkz9EHOSZn3JMMJXmgfv4FMhqjcxa+ncQy9oCEdA2A6WgizwVJa/Q0m8le/AnOshR bX5QVeFvJeG/knh2TOjVrZUngEQntdeDPmvq29BBPyTTBD3SjWyWkpRKVqG4cTQq/Wnt yYdAZwcszwzq0ti9WF5k+pEbcCtVIkLOmCXUfj0mUIdtZf332R+HN3xECiIUA0jGAXi0 ZHjKJnKKmJiNNfnOmtTi8vHVQTiS1CJRIq4Tm5ApVpCyT6q30R+Dpn/rQckuSRpUTKtV A4yA9B5t9boH2dZ93WnifQWmRICNjaPc+r9HzGf3TgUmDI/2TbHJCs7YCsAacssaKwPI 6m7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841202; x=1772446002; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ajd8fwlcy0ukV9JCrBK3xVJx+7J/zUO5UQPSfgWVqOA=; b=N8fsWY2JTMO77e5yKTO74rbmxfgq6cF+Ifw2pikGbjCATXIpDpdshy1jxnW7JDf4qN eHwWZiklFkCp0ae7hCJ4OTYu29D4FqRG0gmvkB1Cg8uV+VfUo3TGvG3xhdp5aQGjciH7 Mhd924fgf0fsZbuFR6IVs1P/AQwMYHxBoDzHJS/2h3ZcrQeMDn5S8Ol4rAYhEKUS8WXj feK9Drj2Otb1BvjTv/JVqSDVXIhkxAX4qHQIH5aHl4RMeFC9MX9uU6JA/WJDdSZ+4W3d sYnh22RRpC3uI/j98EgBqJ7Pckh1eUuP10W7xgbQlASWh9477IfIqfZOrOuJqwVmMcfd uCEg== X-Gm-Message-State: AOJu0YycPXFTgCH0imsCiqgNeBLuumiYAdu8Wwk3vEXSrm9rE7232O5q a+++6T4Nr/2t+UP26fwFHyY3957am+aHnAa9007oMSXXNBwXy+aOsa++OxMMdvEw3yiEWH1/haN Bing278Conlb3L6scIOd+GdHdoGk3qYaXG1bDqMqArrRZti3diiDhlljy2jbrxAJ6gMXgePjQsE o= X-Gm-Gg: AZuq6aLNd3QLNa+g8eWzbvXShL3A83lbjRdJAFCfuNiCgNl/1q2acooRWsIg5hK4u3o OxOJVpWpFKnUdqbN2vhNgLaBCW4Cs88tO+7YJpwahGauBZctVWDsquaaoJO8JokgWJltaT20bt6 TreD6k1+zMGNxlhQA581Yi0o/JnO3ip41nSM8WRxxbqU5+FQUW8aJgi/vrD8YyrM5QdC4WQ2EGt /aNkKUXYgJnWjplu7pcaEtGlxtxh8jK60g1u/WogTfEGx4lzdP9479Qe+Fyc3h3hHvv6ct+06GG IhxB6QGlKwbbsny0SMAbKaq57He3x7mBKNS5ErAI+R8j7W8mhRUywUD9y/mvB0Ugw3S69SkpHLw jYGUBKL2THYTH9U86NUmEj8UrWUUetyqs2pycirYouhmjKB6ftozK X-Received: by 2002:a05:620a:2844:b0:8be:88f2:5b15 with SMTP id af79cd13be357-8cb8ca675eemr985083085a.38.1771841201844; Mon, 23 Feb 2026 02:06:41 -0800 (PST) X-Received: by 2002:a05:620a:2844:b0:8be:88f2:5b15 with SMTP id af79cd13be357-8cb8ca675eemr985080885a.38.1771841201465; Mon, 23 Feb 2026 02:06:41 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:41 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:17 +0100 Subject: [PATCH v2 04/14] reset: gpio: remove unneeded auxiliary_set_drvdata() 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: <20260223-reset-core-refactor-v2-4-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=827; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=8F2/35WvpX/TqMubbBTsFRZjI4ctiUcgIyYIkq9cGII=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCajgHo55KI1E11gHlKAjuK31YHJGxQ4ayV9d tC3CK7JibOJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmowAKCRAFnS7L/zaE w+z6EACzLxy/Oe2yAfg+XiG+NSDnhAM8xlTnv19cpj50YAScoD0wGeSzvDDyaodglJVVc49Ho0l Z8IRhuzvZMBws3ytQAmpRmKJPFeSo6+2Es7Wx9NH4t7qKrLSyvtPjRvBeQofOSnZF9WEydm3jtz MckMp5gPp6gNiU7zCW4sniVgfnS7vGFe8Qls1qeVpoB0U3zRdyWWn8dMRhKTmHWE7uulW91xVRE 9HXyxvESONGpebAoRQpPDgLi/90so4GYKyjxTy2wV3EYqaMJJeNIbtzORGKQrdOXX2Zu6JZPUUe QITqVeI7Hxk7mVlkDM1ufWl3mXFOiRxIU68HSK43yzZrIQuUWKzGTw5ZB+qvyDu3yttgZUL0Zhn C6zPRmf3tFp4EeMXraIqUWdfa7LbuTLQE82ZOLueM6ezrSKc6OrF81eOk06o1giE6SCTsp2J8Ui Yzlp+B5yC+9twPZ+q/6sCLl9Ze3ICWN0P1S2OYbIOky8GH1zaHmZ/NiTbL4GxmpWifYgUnqbDyM 9nGi/HwLcRjFbaOrQJew1oMS9D94UMTsIuRh7ACiajUd07nFvcNoyNzqyOlq8Kewkw0cqrrQmmJ IUlWJdCgvHrVZa4kAmyvvX0BcXVHNaXzh0JorQFZfUk/jXBSGgTEQjnSYqxJRUTSRe/UFONDbqp O5d2cLWMYauqJDA== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfXxQf6CUTWEyin wK1mfWfhhqvMnh3XuL7DmA9kitPdanm4OO52MNFpJERxDRA0sEU89ySpwCnuii2O1oIWRdpS74m cySsWqitA5NwHZMY/RrFgvuaeBAnh21V3tfB0s1OYybionpSr5VA0jmPq6Q4ouJGuHJSkKjQ5VI Vf5ymX7MHowcJb6gfwMrCXiewSQhuGjgoXO33e9f7k6uvPdXb3IaqOOdLmLIwgSmV0KmHs4l5do fhTGble0pcd4PTdx9ThpiGhvKPHdmTCVgwe5RhJcwaNLU85qO2GdXr92F/Y1YdkyqpIjU5zaO25 28Ws2m87NP8EdCYb114qiYKOJmMnyUmwZL/DvwjhA+M8JyHv4XhHe1QZVbM+Cpjqai00AHc3+IH duP76FoNJ65qKgkULLMKWv+lCIXR2KYU06a9Sq+knWOXV0fWCRX8hqRoOL3FkLFRQ1IzufPYYPP tyI1ikUVHyeomjDMkDQ== X-Proofpoint-GUID: pxvaH74TyPbA393ZblJJ6PEEt6RAdng_ X-Proofpoint-ORIG-GUID: pxvaH74TyPbA393ZblJJ6PEEt6RAdng_ X-Authority-Analysis: v=2.4 cv=RpDI7SmK c=1 sm=1 tr=0 ts=699c26b2 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=X4VvQV0HAJngfktaq0kA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 adultscore=0 suspectscore=0 clxscore=1015 spamscore=0 bulkscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 There's no user of the driver data so don't needlessly assign it. Reviewed-by: Philipp Zabel Signed-off-by: Bartosz Golaszewski --- drivers/reset/reset-gpio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/reset/reset-gpio.c b/drivers/reset/reset-gpio.c index 6e1c4f990bc0e54f4a47186340cef03b1a2ee29b..5044f809d0e59a08861597f4aeb= 685e95328c2af 100644 --- a/drivers/reset/reset-gpio.c +++ b/drivers/reset/reset-gpio.c @@ -62,8 +62,6 @@ static int reset_gpio_probe(struct auxiliary_device *adev, if (!priv) return -ENOMEM; =20 - auxiliary_set_drvdata(adev, &priv->rc); - priv->reset =3D devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(priv->reset)) return dev_err_probe(dev, PTR_ERR(priv->reset), --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 5C25B361645 for ; Mon, 23 Feb 2026 10:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841206; cv=none; b=pIWb0FhZ7jF0beYq/HBKBR8rRETWc2/8N+9ktTBJk2ztfGWAC3eBM+t//VY202hHLF6kWBpPJWRDHUj00n1ChajH50gnz/R5IiimSnU3n7Q5Mc7IyElmdTDYIDbv20FLgcdnly1qMBGZnV0UCy37YSuuwg4uU9/aoFFQMmsPBlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841206; c=relaxed/simple; bh=cWpfqX93SvKzM3z2d3OuDKDlUpdlj9+kKcBHteEGi4g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QlR7o3KnSJTQQUtIFo8pXGnDST5U4ddrXEQn1bGJe9ptCDg/gVLa0nlnm5Jx628BXh8fQBoE6IdamwV9zk9suXpMtD/ufDxfWVhprsQxLJLjy480Mk21OHOHg/cf6V9+uVhxrmaqomFUwnqDyucxGVUPj682q+nt2Quo/RnxroE= 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=d+lH4TNC; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Bhel4NHe; arc=none smtp.client-ip=205.220.180.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="d+lH4TNC"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Bhel4NHe" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N9WINd2816475 for ; Mon, 23 Feb 2026 10:06:43 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= ObOclJsmqEBKfwKYqBvxR++so0GEyVdseAewMu5bD5k=; b=d+lH4TNC8mbp2KsZ nbr04xykgM1ygV6txu3E519FybqyU80oj0SO5FAo8hbljGGR26okNN7VT5kdzMk+ aA2ov2XSEH0sEPVGuSbuiQ8maOAg7+ma9fz5A+Pj/ZPN4V0FbDdfL2KUoZPfUb5Q aYT8NuZey9/mwuFGKwmci5eF8BdcTZ3Ago1vljVL8QlXX4vv27wJr68aoiH7sKG/ Qc8Kj6ww19rnh+O8cWLVIljqxcLoy7O+0H6Drnf5H3Nezj8+qlPfJGKvtQUavOJX /uE51/NoPU8w6zGX7TkC2mj2koFeWs+WWXBVdvxovjOB7WCKhWQkCAxEJxRtTed2 38a0cQ== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5vj47ne-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:43 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cb390a0c4eso1162180285a.1 for ; Mon, 23 Feb 2026 02:06:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841203; x=1772446003; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ObOclJsmqEBKfwKYqBvxR++so0GEyVdseAewMu5bD5k=; b=Bhel4NHeKo6ZkoiFo/HsR8uE+BbVL+1h0FgArUgo5DL0AFHJh0O6cbs1bJIKTY2bT/ my5h/Cs9LkJbCyYQd+ZfwVlIQTEyzk/YZsHCCh2lVUvX3E2i91dnRbq4EWumwMxl3l3B Z7SDcy1/YqXL4jMZ2DZG811YN5wQoCmWmKUvg2H+9/pJiWj+uEOlfpmHwEDBn1hOe1wo WwMJQ9He7PUYdK4zvVC5Mj0H0NaDOyseI+9ujdrdc4tuId1ATNbb6x9wlu9BH06OYzC6 m99bvs20odrCBqCOuOFq1KASaHNU5moo22MAl/diaSMLTsr7Kv4yvMFM3nFWSv4Bf/yz ah2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841203; x=1772446003; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ObOclJsmqEBKfwKYqBvxR++so0GEyVdseAewMu5bD5k=; b=Jn9ln5hwlJqqxsXoKGlLEcWKoxGndtBXeAVUc9YrusCKzFtKD7Xx6GDV0kNIv+oqXm dxesBGa4iPYen9sHJG/ryaDUrhyTGOFIP1uWu+ZiIQoOJ7umehwt9C30Q4BoXLs1gQqg +v3Cio3eOrgub4wdAwzndmcmLdR9ccgqGPrw5Njllwz4kYDgXN2WYLrnGa7ZQL7hwK8Z r3MrRaXUjSx5N+kZEvbg7iC8qvI/CjGzm1/uV8/b1zmkzZm/OY0CFSwWm9/uQfTS096f R2WFhCDC5vniYnvd8anGzW/dWPkgHivbCg6cVC8c6IMJpascop63DZ/tuwgzElJlOIZJ 9DOw== X-Gm-Message-State: AOJu0YyOXBhoVnCBoW0+cP9SbTDibL4LDHIz+IKXd+Cu0BhdXWVMTWHd Dn+kUISTu4LvT9cPgghnaarUycetKIp5DF4NNhZEoBlSZSpUDx/ULH6cD6i8gk/T0wjAt5NgjZY 9Duye34caEFHCU5cgzJKzt9tNFJnbtWVC09pUQ1yO2ymbWPvLTLQxrQsfVf1vdFtbtSg= X-Gm-Gg: AZuq6aKx/g55xaCLW4+cYGmFQ15LEfpCt6zc9yHIsbByDuE6I7f4sYeJb5g7C+qeKjM 1OtyAd6Z5HwI2iuzdn+Qy2bH3YUY6i9Yo8PXJzGbkURb5LuVj7LkuZYpPygS5iUfiYXwrn0fhDj nVNOtXAS9uDXMsCDt27C4gOYWEqzu8JoF3mFul2X2B8hYQLOTMASSRtaOebm1Qp+wfIuKMI9iXh jEV8Db+vQSM1sjjWqzBiRWWOAk9bx+6hTucqoGWK18y8TOthqwM0gR3oLJtz1heScuWlAoGjMFS igbpbC4RiNzaKp3WC4RJwAICBVoLd8hywLOEPqd26nMlHg+cv5XWgOWGCiWdn1v7ScnFcWpQqzj E8tRjywJ+yvhe2TzNBVLHjkHpH1PLasBgGuESwNp0L2lmwwDWve8t X-Received: by 2002:a05:620a:8398:b0:8cb:39e0:1710 with SMTP id af79cd13be357-8cb8ca742f6mr951402185a.54.1771841202767; Mon, 23 Feb 2026 02:06:42 -0800 (PST) X-Received: by 2002:a05:620a:8398:b0:8cb:39e0:1710 with SMTP id af79cd13be357-8cb8ca742f6mr951400085a.54.1771841202314; Mon, 23 Feb 2026 02:06:42 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:41 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:18 +0100 Subject: [PATCH v2 05/14] reset: warn on reset-gpio release 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: <20260223-reset-core-refactor-v2-5-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1110; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=cWpfqX93SvKzM3z2d3OuDKDlUpdlj9+kKcBHteEGi4g=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCakHxvE8jG4+fHEp4PaaOi/ftdu3MwoB9KR1 RNM00++2AeJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmpAAKCRAFnS7L/zaE w4kyD/9dOtpzsPzdNYTh6SK71dtIlCzrPYYWGpZMpT1LrpNtcDJQt7gKaEjrQpdejsHracE2zb+ eTvxCazAgZRbQMOPltb9wuoL4NtBVcsrclV8t20DGa2i9EuHEhc9J6y3wgpGv7lQx6sy/IarKF4 9l1WQ5Klzir7CsjZZwFYGxn7e9+fe5cGdVK2Ffpup6Vx1vELxvhJp74ZCHVoF35agpaH1Y7/Sc1 +gicsuSORQuc43RJcbYLmPM4Zc7LLPkxHP21Ha73ANaRzswhcs0Nkrc0KkY9QQggTY58hm19cAd cDRGhujGKjwjwGKaZs6wpr6CebZZQUKKOLM6sx046GbtPIr4lQuK0mgtnkU6uc2jJBYfypZ8QW+ 8D4YNZPv6S9SepojAjDo9P501y7pW02xUu/X9xKByNQj7TIbFTSd5iBWKV9LXHx97FRt/34uacv Xm8wFRaqyLchDWckpur6v0toYfJjRnHzbOaMC3Ksz4QbKFVV4EER3f8wvreLZK27e4Cp3z+uKDl U1RdJ6wjz6EuHYraPUMDWFYFbsata1X4kYh++GUyOg6k1Qqf91RJE+gGkkWsURXgsYDQURkaatQ 3uM0sy/b5zRF92E3KSuVjhKi31H0Fkt+CBk2LkOsNAFkboyEObtpg/FVZDaoHy9716ysnM2yn9h +DK2x6uXH1QkJSw== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfX7CWGw9NSOsbD Ghn7yUQ+oxtztLeVz+OUijR71qvp78zqxqOhjjvBgSMxaT9uOaTAyv2cX+dbvMEQIH8B6UH5afp PqU+NKojgjxahYlnys0QxhvbvrLf4LbKWsjJxvKvrffTqCpDtppc7Xp9CwRB9RGahauKdwNWoZx eV+5ILaL+xNt2RxV4IebDacbXrFMp7gDfOSxJoOV1LorKgBXhYjR21KAt7PGN0UuUsJV44JNWoa anadMV5X6JIDGJGjyFWDBKwizuIAY2Gu45J+1rCk0AtsNKSfe8z/Ed84YjpO/RRtkky1WjBwQkL p8FV/e67+tz93PLXIL2n/Jl3WtNXqtKjQEdvH1Lebcvek/SUmURIGvRZJtpbE/afpMilqJx+Dam v9SsKK/Irmwn7EU1N9BpzSYxaOwUSovnWthsVaAJORSIZi9MV4Eo5/trBCtDmuoXeSh8u1h3Wbu mCEkPy1RBdw/yaE0KwA== X-Authority-Analysis: v=2.4 cv=T5KBjvKQ c=1 sm=1 tr=0 ts=699c26b3 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=ZUnkwru6gbkhQxgbgcoA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-GUID: L_0vZR64zzJl9uDcj-dpUstr4wFp7-_o X-Proofpoint-ORIG-GUID: L_0vZR64zzJl9uDcj-dpUstr4wFp7-_o X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 While we implement an empty .release() callback for reset-gpio (driver core requires it), this function will never actually be called as nobody ever removes the device and the last reference is not dropped anywhere. This is by design - once created, the reset-gpio device stays in memory. Make the .release() callback emit a warning, should it ever be called due to a programming bug. Signed-off-by: Bartosz Golaszewski Reviewed-by: Philipp Zabel --- drivers/reset/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 954df36a242e804b639027384700b8d988be0e90..3e55f794d539e4edc99104cb539= 6cac72ba30618 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -820,7 +820,7 @@ static void __reset_control_put_internal(struct reset_c= ontrol *rstc) =20 static void reset_gpio_aux_device_release(struct device *dev) { - + WARN("reset-gpio device %s should never have been removed", dev_name(dev)= ); } =20 static int reset_create_gpio_aux_device(struct reset_gpio_lookup *rgpio_de= v, --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 BC638361650 for ; Mon, 23 Feb 2026 10:06:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841207; cv=none; b=HddMBtqxsz0ivAwJXmN7rYlcfgw0HxtIuxnVRXq3dTryUct1Yokg2JcDDY5DR6k3RNYwDQZEhI9DQhDXEMz8DvbQtTmwiqdIxD1psC1GF7vQjdmvpd5dOr4hQ1WWMMm05mDCNW+Tqk9r9nlId0IRFEVrBrmccCasl7rge1UZ9A8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841207; c=relaxed/simple; bh=/jjMTVDR3mYie9Ncx8hCNOw7mqA4MQBimid9vXcyuh8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uZOqFzCp6kOrM0onjkifcFPM9NaND6jpaGL8xVlAkYv+zU0i31T/+pBG6Lups6sjF/BeT3Pe3+nmvdZQW89NcTnfiGDq+QhEHCvvehT6MSIJGuEDd1MAos0LQ0afUE4kxdRX0LwsQGTDFxeSzKiG65LJ2DoDe7dABSqhTL0Stdo= 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=N6gvq0ew; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=DTPOCGQO; arc=none smtp.client-ip=205.220.180.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="N6gvq0ew"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="DTPOCGQO" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61NA0PLR3003192 for ; Mon, 23 Feb 2026 10:06:44 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= pF0yH52MXQzce/UyYuQvs5aAI01bJoZ8xpfaV+SRcyQ=; b=N6gvq0ewRPcKsPi5 nCoepHa5hS6yPpe5ibMMOrody+aK+1TBc4l1AzXgmWllEX1XVlZrH2UPI3HcEA2W EWti5x0cs0ytvwFWVRZKMBlUb+Y1as0nrQDEDRmYfiH2nt2ajkLv/Tj91qUDTXtQ sygt8Jnv263KevQ4p6hQh55PKc8/ypTx3S+MS03iAc4IZAz59b5kV6bfffCBim6a f4J/Tm0plsL+a95AVIaL3TEn9+w0rCJhwvpQDAKcKo3nCbdpA0fo8Oio9FFYv5rD BWTl4MvV9GT4oPkdzvLnv1c+r59Mwf/IkTWPVeg1XLwc5Jb5MCuO3AUaeCrq5D+y 4J+z4A== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5vj47ng-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:44 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8c882774f0dso3961770985a.2 for ; Mon, 23 Feb 2026 02:06:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841204; x=1772446004; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pF0yH52MXQzce/UyYuQvs5aAI01bJoZ8xpfaV+SRcyQ=; b=DTPOCGQOTqAd3DcWAptEeI6aUK3VGtaSyfsCcs0mbmkV3Vydv6jHz3L5IDkkCfA6la Phc1495N0KX8Tknk6uPSND2Q8vdQamRZPC1SPNLwIW8RNl7sRAvoeg9sz3eH7eUBQiUP 7TaBB8Qu5OsQDII6JyH7E2WJaYf/z/FKyW49jMu15+cT9hojtXhE2gfsF3nt+ebAo5fO gKr3rLvSlYJYGh5eFtEd/G/K5BVtouMI0VyOYrncQ0CEmnbcjCNJGw9G+vIirObYP32j 97Y6eJ2aZAoHTuo3g0DLB/HSE0s4vuW0g70Wbb4FAWk3lWuKWj2M2wqBVPYnjkbp2Ths 4psw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841204; x=1772446004; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=pF0yH52MXQzce/UyYuQvs5aAI01bJoZ8xpfaV+SRcyQ=; b=RKWdVjGJZ1nbwSKwuE/QZLy64i04KdWOfxWeSl95IfCRxdwDgSS/+Am1tZSRUYre07 ucm1oHU4DpIyI2NOYY5zeP8pQELyi0kD0vcygUZbDZMLpM8gesG2KXYgICC/sV8rx6FO Hmt5zjoUjxd8mMsMaFHjMdON5+gSLk53K6T/onvukxiploMFna27WTUnWm4egCBMKOse NeYgjHuGeiWcNzt7FgCig5e9WCqRaqlgLVL/6g53/IIFd6BYKmbnotE4fOOnh4/ehMI/ T2p2RmWoiDoh9chaM1JVtmH2+Y1GXqL6UPLP+zff/LoCEinelaoWtN772BbCyQpZS/NM xuXQ== X-Gm-Message-State: AOJu0YxRRaAkHu3b9WXRHD3q5nPp4WfsZOxeKXiv7E328PRSSgEuAWAR nZEaYBRPc0kQasxM1fHXadvAqC3XFd8v+Szc37Cu79QEuwg5rs3Ph5v838HpiSmVBFqlg4YW6TW jyaiu3WghdsNEHWOKO+MT8QKxznPeuWwIg3MqNzBoi3ZnuD/p9c0LGuo6oiOWX6Egm3w= X-Gm-Gg: AZuq6aJJhSU/uYkd+8N9OoFPXaPLSyDrSoaFUwAZFD3yBVV2irdiL6pcpQ1mg66aRKQ WA641BwdR5YZ6FlDR4TYJkTyxfqPGFRzJajYUVPrMdJnzKmXp7g7ieeZ/1WO3Amy3dO6rJ/OfiC r+Hpgmu0QVLpo76coa9DAoXx0nODE0BuenRrMKZAK/LCp10WCYtkISDS18AcIt5+WCj1ZHrKSjd /CtXzxL0D3haADvvAeDpsnmX7/4hcI+I8Ymexr4wSEi5hjJEpoJPP++4EqxzAKPNDEktSV3/5bH 3zF8PaLSQe4K/H0mBx4gyjTLDLwE2LtRwWEYPzL3H4/IB+Wuqr36PTSl2qY/d95LNooiOxe2LP4 f00tBuj1k5hiJqvSsf8SvD/Dk6dqxddaaDGiXy8KZ6L6mrs5y8AYu X-Received: by 2002:a05:620a:191d:b0:8b2:e827:14bc with SMTP id af79cd13be357-8cb8ca809e2mr805304485a.56.1771841203903; Mon, 23 Feb 2026 02:06:43 -0800 (PST) X-Received: by 2002:a05:620a:191d:b0:8b2:e827:14bc with SMTP id af79cd13be357-8cb8ca809e2mr805302185a.56.1771841203451; Mon, 23 Feb 2026 02:06:43 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:42 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:19 +0100 Subject: [PATCH v2 06/14] reset: fold ida_alloc() into reset_create_gpio_aux_device() 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: <20260223-reset-core-refactor-v2-6-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2926; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=/jjMTVDR3mYie9Ncx8hCNOw7mqA4MQBimid9vXcyuh8=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCalcZosTfUXDoGA7GriMo92ZzsgUwOa70o1G T85cpBrZYaJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmpQAKCRAFnS7L/zaE wwDoD/9aURdvq1PeNE3Fdw2rj80UF+2TV9MRmJv+0rL7mvRMm1hj+blVcx63203hjIp6NZyh+xx W55kCFxv9WKSElAU/MTHVbTbooQ5uKZon/TfPKSCr9V5znicUXaSIGa31LX9JpYAo2NNKlCsM58 4E+Yg4TO7Uxr8MvlVDfW9aV+LTfdQZUjQ/8XZMB0/d6Z9ARdcTqSA4WmTlRQlyhGnTOklQ9z1eS C8HMZQWq1zswSpibALA3fakDh9nEhJJBBB3dlMVR/rd2clX1TLrN+ZHaoUMBw09fHUl5XeRm2ZA jCG+CGO1n5zwEst0bdKSGEcUJWZUZ7QYQpZYVrwHcC8wPQPQq4tuSOOhP8vOHXwV5zJdxsbcjkn hfZg/SXqD9y8WIgdH3YCCWlsj4rztw9WZSUd8u7+shmYqxV8xegP2kfEeIleQ3qkeuSW5eB1aAh ICcpRs46y3sL5moAEI8u5+ZlSBa75hPEO1x/PEYrB03nave/+sEqPWoFnvNvrL2jbo87kz5Kyk2 Ge/rNy3VbVMY2oO49on+x9oMe5BYY255UH0p2n47YH5ae0a2KXQDchCuEuWiLNNOSNE0sZuIerI I9OHrLMGa/ROJbM6wZAqMdM4L2HtdUC1AApcZHzOUQpg08PpDGWi2gG3pCXnvwZfl3xOMXDSz2Q N/nKCx/rYxCR+nw== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfX//F3rJmg9N05 bRZpJD/KFE15Qgoh39xt7vjALS0TklHRZ1CYMFjJZMs37h1eUxinVpBZ8TzdZssqnyOvAgrG8kn mpqe5v96W/QdlBWvS+CH07RNYBUz54f99TJ8WABYsA5JSqOJnsyFmRmk56ikqFPO+0bc+2xSU+r OxpjR1d+zMaBvVD2W4nr9JZ9ahWHRlqRiSZsoaFqF+OoUCR8tcDvOWex/YHo7OoIyVsHuAsSRtS vwp+VuPzRQxAPtUcnAxhgECSEBN740uxke1ywxQa4LljY2z8DsNh3kd/cCNKPsBxHvR85OMYQSJ UnrHanOiOe5n6L3WalfMsILZSqh8Ih/iXagFhLPzumNFCMLBU5TdVmHrcMz8YGx7Gg90/zjtnd5 DJTwJ9GYaLDbghXW9/c3HGHvJU7qvQDO6OVpWZknTMg+zaAwZT14GoDGJ2JVFMnRODuQA41KL8I 8lyVYX41ETxbpB6WILA== X-Authority-Analysis: v=2.4 cv=T5KBjvKQ c=1 sm=1 tr=0 ts=699c26b4 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=HM6bUx3eE857ULQHB2EA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-GUID: kg9T8czNKks9mCfqkxGTEj82siNzoNcW X-Proofpoint-ORIG-GUID: kg9T8czNKks9mCfqkxGTEj82siNzoNcW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 We don't need to know the IDA value outside of the function that creates the auxiliary reset-gpio device. Simplify error handling by folding it into reset_create_gpio_aux_device(). Signed-off-by: Bartosz Golaszewski --- drivers/reset/core.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 3e55f794d539e4edc99104cb5396cac72ba30618..025004989595ac60381804a7705= a1eb584b63326 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -824,10 +824,14 @@ static void reset_gpio_aux_device_release(struct devi= ce *dev) } =20 static int reset_create_gpio_aux_device(struct reset_gpio_lookup *rgpio_de= v, - struct device *parent, int id) + struct device *parent) { struct auxiliary_device *adev =3D &rgpio_dev->adev; - int ret; + int ret, id; + + id =3D ida_alloc(&reset_gpio_ida, GFP_KERNEL); + if (id < 0) + return -ENOMEM; =20 adev->id =3D id; adev->name =3D "gpio"; @@ -837,12 +841,15 @@ static int reset_create_gpio_aux_device(struct reset_= gpio_lookup *rgpio_dev, device_set_node(&adev->dev, rgpio_dev->swnode); =20 ret =3D auxiliary_device_init(adev); - if (ret) + if (ret) { + ida_free(&reset_gpio_ida, id); return ret; + } =20 ret =3D __auxiliary_device_add(adev, "reset"); if (ret) { auxiliary_device_uninit(adev); + ida_free(&reset_gpio_ida, id); return ret; } =20 @@ -891,7 +898,7 @@ static int __reset_add_reset_gpio_device(struct device_= node *np, unsigned int offset, of_flags, lflags; struct reset_gpio_lookup *rgpio_dev; struct device *parent; - int id, ret, prop =3D 0; + int ret, prop =3D 0; =20 /* * Currently only #gpio-cells=3D2 is supported with the meaning of: @@ -951,16 +958,10 @@ static int __reset_add_reset_gpio_device(struct devic= e_node *np, properties[prop++] =3D PROPERTY_ENTRY_STRING("compatible", "reset-gpio"); properties[prop++] =3D PROPERTY_ENTRY_GPIO("reset-gpios", parent->fwnode,= offset, lflags); =20 - id =3D ida_alloc(&reset_gpio_ida, GFP_KERNEL); - if (id < 0) - return id; - /* Not freed on success, because it is persisent subsystem data. */ rgpio_dev =3D kzalloc_obj(*rgpio_dev); - if (!rgpio_dev) { - ret =3D -ENOMEM; - goto err_ida_free; - } + if (!rgpio_dev) + return -ENOMEM; =20 rgpio_dev->of_args =3D *args; /* @@ -976,7 +977,7 @@ static int __reset_add_reset_gpio_device(struct device_= node *np, goto err_put_of_node; } =20 - ret =3D reset_create_gpio_aux_device(rgpio_dev, parent, id); + ret =3D reset_create_gpio_aux_device(rgpio_dev, parent); if (ret) goto err_del_swnode; =20 @@ -990,8 +991,6 @@ static int __reset_add_reset_gpio_device(struct device_= node *np, err_put_of_node: of_node_put(rgpio_dev->of_args.np); kfree(rgpio_dev); -err_ida_free: - ida_free(&reset_gpio_ida, id); =20 return ret; } --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 C08A936165C for ; Mon, 23 Feb 2026 10:06:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841208; cv=none; b=joPHzFCEAMHf+SLFfGrMsdSPAfXWkIggIpHDZDvkCDXBi9MM4I3uPP3XxlUXRT2Pa8kY2Y62p/24Xq1RMvDinHZTYWPUO1gLrInJjwHWpdOAzjzSZ5oBlfYUkISLbK0dH8zj2ziX4ysSo1wCT2xVUsMkGKVY3okH7fNr3O9YwU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841208; c=relaxed/simple; bh=rx1gjosQF3AWAucT75rdoaKtpxg6brNRCssFxpxiEzQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kVbpsD8zzzVQR5X3Z4RwYn5al6dAuoIfJ+IPqmtq4MpyhJrozYouTfPNaExVv2hLulR5VRyhkhZ4fsUAR1a/Gx4ImlZzNSuTuFnCViHKDvW8CIbL8WjrEYz3o3MIFifXHgLLJof1sSKYsmY/XkeQIbRLdpHejgcVV7TGuGdSwAc= 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=NyO7Qvpa; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=GCXK6I4B; arc=none smtp.client-ip=205.220.180.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="NyO7Qvpa"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="GCXK6I4B" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N8VaEF2887961 for ; Mon, 23 Feb 2026 10:06:45 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= JKNSNLs1nLw5vrqapKbsql7TyitUgYQa9wtkF8pESY0=; b=NyO7QvpaPcJay2bV BqL8bOP7flj5g6P3oC/Fcs737l/OBVMuJ1VGOr05lHgTt+dPVQfpBowS58f8TnXV +s0lvGNRxU3dPRtdH0DSEPfHnkprfWuiouKkEni2oCLQa48VG0yuhozYV8vHkfAg xuoqZWbZi99wwTx7Q1LBF5zrTR0ngfGi4guzipQbtGGr2tDqoSxRrn5uqQ3SYG1z OaohK030iloCb+22PDvYMB1ss8iUqneP2bM0d+VjXiwU5ltBKJD4S7QJwtPpu9X2 tO9iNL/Eti47XLgm4TrLg1PCSYlmy97ctolZMnwYQ7O7y92uM11/pmyj2nagqN0t sCnNDA== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5u8m8mb-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:45 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8c71156fe09so3786196885a.0 for ; Mon, 23 Feb 2026 02:06:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841205; x=1772446005; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JKNSNLs1nLw5vrqapKbsql7TyitUgYQa9wtkF8pESY0=; b=GCXK6I4BLwRSGgz/DOb4KezOYfWKne/iI0iVKMoHuRW8SGl5TXZb7gusR6PXOIqsBz OMtANnYI5MJpzwwH6QiRZxrgIiVhgPGYM15BQKrDnFIPKc7BkgwiLJtAa+fWeCp480p7 E/SkNHX9KdXPrgq9iLbWRppDcR4XoWhOq934YubOp+gK9mdcUWGKv5d7Ka+taYDDZEIp KYYAy6nnfScOk7ojtyUvg/CCSdoQhtYF7km7xnsWJCjLRx3vYDHtN8xKfAfdAJ98Oh52 7erxPdgB2Mqyo+ggQ1Woqb4K011TyTgtwBDpVEauZn3lDoUDJ71X0CNmDK29yCpih3TS Al/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841205; x=1772446005; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=JKNSNLs1nLw5vrqapKbsql7TyitUgYQa9wtkF8pESY0=; b=ZWbakC6gUATAppmJ+Yp1K+BxsTovQMoes0TfbV/+s05w8zKlIk4xbgQlf/avjM+duD gNCpfHefjrzqvTZMj54JXf5DEyMmhSiJBpE/ZCg7Kc54vGUoyxXWuqs4c9HKGNSg9Iao NHqVGSHsXLwcQnjDvZNfIV/kKTiajHG234g1TCmd66naCPvcYBaMr2uz9Ul6B/77SvER ZZNIXtFq8YzBOuVST4pStI2B/mprOuh4bWwaIueu0zIWSWygTJNJUYghaBvDRG4WB2U9 clh+DJht6kAatg5zfOAL8QnuG1Vd9rslBFPCVqeTOPUN0t7RvtYf2xh0Az3HE/Loek1E xjlg== X-Gm-Message-State: AOJu0YxJW9cH1Vaua8eakjFHfYR+ZTmL4YKhogz41BpLzx0MHpY3qa4E M2O3pv5zD4WaSGgEKweZbv8jCywlzStSe/4qBCHz0TNaN+75xGqHo0XOPGG+Q+UFpjoZRtRnMoc NrqRhhN4ouscEmpyc9I0gB1dU5cnZeYAH6QcFJGMfU9CalT5d8i5Pv53BDGm85cOuZBo0pjYAl6 o= X-Gm-Gg: AZuq6aLiwPKR2fE3kLytqA1MwMuYXyvgPOfLFwo6AL+ytjZRAuoSot946Iv1NEqCSYm qgVVwJgpvXhysyZZec5mEn76vpXxKVkAwtLSFKJjUfR2e1pbHhOJhBJewCiKWhi9KZs537jX4iH Ca2BiXNX3ZvngQ0TzMS5QxNmI9Jry79I8sYh4zVRSFHhiH151zQIhMrgGeMiyF7yv8XHiCENuXB F/Hd1Yo/5NsQhB8WeGhrV5QfUEEECN4FsE07tBmeWSzWwjoYtpNK7tc/YWxHx4DTlRlY/AYJmho B9yYAkJafCw3TbwgwKbmm20jxVU6+ZFZIigSjDQnoP1fuo8WeKhNEL29A2eLitO3UyaUVoZfFFZ OrjHUw6J8Uw432cn45jjRVH2/fg68GUc1ErWstQ1xRBnVf06guFW3 X-Received: by 2002:a05:620a:d93:b0:8c6:e224:926d with SMTP id af79cd13be357-8cb8c9d1e53mr1029339385a.16.1771841204853; Mon, 23 Feb 2026 02:06:44 -0800 (PST) X-Received: by 2002:a05:620a:d93:b0:8c6:e224:926d with SMTP id af79cd13be357-8cb8c9d1e53mr1029336685a.16.1771841204341; Mon, 23 Feb 2026 02:06:44 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:43 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:20 +0100 Subject: [PATCH v2 07/14] reset: use lock guards in reset core 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: <20260223-reset-core-refactor-v2-7-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4808; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=rx1gjosQF3AWAucT75rdoaKtpxg6brNRCssFxpxiEzQ=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCamPSjuFZM3+Kr5mFtfERPLPKE8o9ZA9v3d2 vycJSquuluJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmpgAKCRAFnS7L/zaE wy/5D/9TCrH17QnQAtSTezoV5Zwcnifsn82Hmo2IZyTyD2Zcu+uX9IZDwmTxd2F/KLUS+jJ5uC+ M9iweVSMQWlC0MdBImQ5nVd1/Bceh4TnLV5yUag+nkMWfabCKx4vXQzAHeId7tUXFaycMzafj0g TpPdtV7GNQbGtvDnWNCKoNz22QaoOomU+BK1kgapqfEkI8lIXE6mZ5vToSyAb1t73+02PwowwNo VbYVyJHRvlQyyIIuMslIMPGVG4tU7eum/STKGXcBm3FgzMpmoDUhT9dbrIXVLW/TTpmkdQiF/lA DpezLjz9i9MYAf0MUjOeRcvI8QfE1faSObu8Xpo5LVTKmtjlWfiSOvWYgVndUOnXrv9eju0KL/P sloZPo+h7fXsuYr1/oAFvHM8aM842kSAfS6i9BOhuskmp5gc2vn1B0IpVed4nxpIwYvyFUjumkH VcRQtboZcg9eBmP5Tohf6dAcCljX5sIHKNWgygLnvxsQZssTOofxL/nH78x38yG0CHDnRTNELoE Hk85Iqx03+XTN6U+qmskdMDGHr8k4Cynk6wbvs0mJeogC6MVyPaAf57g64ENkoSY6BqjQakr8es sRN1ReA/n5emSE/wq7i0Nva65Nk1TSW4TIkL21ltibsWqY96Nw/laG4jii4yOXxM5/JIwyo9xVU PF/dS3szhKILHEg== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-GUID: fpS6onTQgzUILiHYWEsyVDCumu_8gz1S X-Authority-Analysis: v=2.4 cv=cJftc1eN c=1 sm=1 tr=0 ts=699c26b5 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=ABYPN_TNRu3JwaOvJ3UA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-ORIG-GUID: fpS6onTQgzUILiHYWEsyVDCumu_8gz1S X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfXwbLea5IFQq7x VBNy0s2JpHTjUXLE/2q2oS5pZcpqXXEHkMwFj5fuXhtegh0XiStMunsLlAx07WqD+KBBxLFBRBp L+62QE3IUzjBOekcBH6auXFR9dN6yfnctK5vfdnL39oKbaYoNAuzI4RERG7abQeqOkDtO1qF2Wq JA3p+No3ErbznYTgorka1qFZL4bfN0ZZqE3PvEgbN6DKf8vFCI37xH9wgpEtchKek7y5zbXybzo SYkYCnhPa1USrshMu4GTRuC5I2vDsenVJ87mTIBTGX4trcu07mRc9lbGyo/AB3KUcFAMGGm9Wcz C4ka/qWGEIuj5aaudTE+sTvLdhWXnNwJFTKmUGywlEWtjzM7aquq53RxDfq8Ae3liuQRMxgSPNy nchmLJJbfVn66XROkq31k6xN1S84Sjw93lJXWEIbOM1HZcVgHQuOI+ZYNc8CZG+UHchpQQ8v+vs 48WQpzMjUGwWOAX3ReA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 clxscore=1015 malwarescore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 Simplify the locking code in reset core by using lock guard from linux/cleanup.h. Signed-off-by: Bartosz Golaszewski Reviewed-by: Philipp Zabel --- drivers/reset/core.c | 55 ++++++++++++++++++++++++------------------------= ---- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 025004989595ac60381804a7705a1eb584b63326..9fef9f972e93fb7388f27ac3bbd= f68c884b72ff5 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -129,9 +129,9 @@ int reset_controller_register(struct reset_controller_d= ev *rcdev) =20 INIT_LIST_HEAD(&rcdev->reset_control_head); =20 - mutex_lock(&reset_list_mutex); + guard(mutex)(&reset_list_mutex); + list_add(&rcdev->list, &reset_controller_list); - mutex_unlock(&reset_list_mutex); =20 return 0; } @@ -143,9 +143,9 @@ EXPORT_SYMBOL_GPL(reset_controller_register); */ void reset_controller_unregister(struct reset_controller_dev *rcdev) { - mutex_lock(&reset_list_mutex); + guard(mutex)(&reset_list_mutex); + list_del(&rcdev->list); - mutex_unlock(&reset_list_mutex); } EXPORT_SYMBOL_GPL(reset_controller_unregister); =20 @@ -646,25 +646,20 @@ int reset_control_acquire(struct reset_control *rstc) if (reset_control_is_array(rstc)) return reset_control_array_acquire(rstc_to_array(rstc)); =20 - mutex_lock(&reset_list_mutex); + guard(mutex)(&reset_list_mutex); =20 - if (rstc->acquired) { - mutex_unlock(&reset_list_mutex); + if (rstc->acquired) return 0; - } =20 list_for_each_entry(rc, &rstc->rcdev->reset_control_head, list) { if (rstc !=3D rc && rstc->id =3D=3D rc->id) { - if (rc->acquired) { - mutex_unlock(&reset_list_mutex); + if (rc->acquired) return -EBUSY; - } } } =20 rstc->acquired =3D true; =20 - mutex_unlock(&reset_list_mutex); return 0; } EXPORT_SYMBOL_GPL(reset_control_acquire); @@ -1064,27 +1059,28 @@ __of_reset_control_get(struct device_node *node, co= nst char *id, int index, =20 ret =3D __reset_add_reset_gpio_device(node, &args); if (ret) { - rstc =3D ERR_PTR(ret); - goto out_put; + of_node_put(args.np); + return ERR_PTR(ret); } } =20 - mutex_lock(&reset_list_mutex); + guard(mutex)(&reset_list_mutex); + rcdev =3D __reset_find_rcdev(&args, gpio_fallback); if (!rcdev) { rstc =3D ERR_PTR(-EPROBE_DEFER); - goto out_unlock; + goto out_put; } =20 if (WARN_ON(args.args_count !=3D rcdev->of_reset_n_cells)) { rstc =3D ERR_PTR(-EINVAL); - goto out_unlock; + goto out_put; } =20 rstc_id =3D rcdev->of_xlate(rcdev, &args); if (rstc_id < 0) { rstc =3D ERR_PTR(rstc_id); - goto out_unlock; + goto out_put; } =20 flags &=3D ~RESET_CONTROL_FLAGS_BIT_OPTIONAL; @@ -1092,8 +1088,6 @@ __of_reset_control_get(struct device_node *node, cons= t char *id, int index, /* reset_list_mutex also protects the rcdev's reset_control list */ rstc =3D __reset_control_get_internal(rcdev, rstc_id, flags); =20 -out_unlock: - mutex_unlock(&reset_list_mutex); out_put: of_node_put(args.np); =20 @@ -1135,10 +1129,11 @@ int __reset_control_bulk_get(struct device *dev, in= t num_rstcs, return 0; =20 err: - mutex_lock(&reset_list_mutex); + guard(mutex)(&reset_list_mutex); + while (i--) __reset_control_put_internal(rstcs[i].rstc); - mutex_unlock(&reset_list_mutex); + return ret; } EXPORT_SYMBOL_GPL(__reset_control_bulk_get); @@ -1147,10 +1142,10 @@ static void reset_control_array_put(struct reset_co= ntrol_array *resets) { int i; =20 - mutex_lock(&reset_list_mutex); + guard(mutex)(&reset_list_mutex); + for (i =3D 0; i < resets->num_rstcs; i++) __reset_control_put_internal(resets->rstc[i]); - mutex_unlock(&reset_list_mutex); kfree(resets); } =20 @@ -1168,9 +1163,9 @@ void reset_control_put(struct reset_control *rstc) return; } =20 - mutex_lock(&reset_list_mutex); + guard(mutex)(&reset_list_mutex); + __reset_control_put_internal(rstc); - mutex_unlock(&reset_list_mutex); } EXPORT_SYMBOL_GPL(reset_control_put); =20 @@ -1181,10 +1176,10 @@ EXPORT_SYMBOL_GPL(reset_control_put); */ void reset_control_bulk_put(int num_rstcs, struct reset_control_bulk_data = *rstcs) { - mutex_lock(&reset_list_mutex); + guard(mutex)(&reset_list_mutex); + while (num_rstcs--) __reset_control_put_internal(rstcs[num_rstcs].rstc); - mutex_unlock(&reset_list_mutex); } EXPORT_SYMBOL_GPL(reset_control_bulk_put); =20 @@ -1403,10 +1398,10 @@ of_reset_control_array_get(struct device_node *np, = enum reset_control_flags flag return &resets->base; =20 err_rst: - mutex_lock(&reset_list_mutex); + guard(mutex)(&reset_list_mutex); + while (--i >=3D 0) __reset_control_put_internal(resets->rstc[i]); - mutex_unlock(&reset_list_mutex); =20 kfree(resets); =20 --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 BE13A361673 for ; Mon, 23 Feb 2026 10:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841209; cv=none; b=U04yZKDPiqa/MTxNIiXYOpwxADuS0XknJmwDmc87VMsAAijKtIOs3kIng5wPXEJn268JEm2vUKoxyfGVo4ug26A88GtWYRuREXSm793I0PWohp0wnwSqNP90EzCpbLaPsbFE1Op8v0tv/MBY0+V/WjmGetPIfQWWE3ba6hUOVzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841209; c=relaxed/simple; bh=sL1q9wwhxHZZrZlh7F46CRESH8uPDctEF3AFiujRX4A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JFlU/X5+sJwtamm6e6w3ZJRzNER7hTodeD3H28vod62qFB6wHSajyJKH+Euo5+LL6Gzoe2srVUwrm8IKMRbeuSBEKLQ590l7InbLgtYmcCpyIbeQhnvkis4J662yawC0n9awjUXzIk7o78RlgSBUfVO+ao/qvtgQLa3XJa3OwGE= 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=Hl2PJO8R; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=gEmBasKs; arc=none smtp.client-ip=205.220.180.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="Hl2PJO8R"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="gEmBasKs" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N0ka5d3271586 for ; Mon, 23 Feb 2026 10:06:47 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= fazAAiBrJ7rgJoOI1TWI0OtZrQogm6Eto7WktTDuRyg=; b=Hl2PJO8R9rWsQhpn ustIOEqAX79kepy7bCT+lNDkn2o1MbOgygdEegjqyxqbW+9k/cLr1psUeYqtytEe IKrr5R1nMOFjRin9oRNKvCcRIj0gnTurV48/g79kWZqH5AZKf+ARN80a2oebsoYi 3T+VPyYmKQbUzQIt3oOf2sKZNRC9JVrOK5uH5haUdau9qVAqy+yQFh3rfDFm1PcX SXkiIW8L4Z5zDVoF4kNFoiKNDsSKhZR52mYIqm867vNWrXNcpCscfwa5F97uLITw MdBSV0mVkW8ZR0DdlAOFe4gOt3Gy1mQk3qLUIsNHO8ateCVyb6RbldGZinJZSO8U g9AoQA== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5vj47np-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:46 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8ca3ef536ddso5137105085a.0 for ; Mon, 23 Feb 2026 02:06:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841206; x=1772446006; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fazAAiBrJ7rgJoOI1TWI0OtZrQogm6Eto7WktTDuRyg=; b=gEmBasKsnPn+6VukHwJVGaJOX5rOYnUH8rG9nnMcR/oEFdTPVgcejPfKQlrBaWpadU xfB6Bm9Vo0sxBaHaFEj6ogYrNLqPivbtdT/AwcdqqefQQCxB3DdPIThqjkeJ0mEK2M7i 2inexGzxLO08YqnPsT22Q4HpP51rt7cDrqpqRfbdidDRiQ7A0EEX/ol29VqNzbVva3Rv ORrIWtMxVm7YlrK0KXZ/RZHJ6ABtLZKhn8/jgDLSmAAV/EoUDJyZfH3UxD6tyFWl5ylC tg5mXGi6dNIA0aiPLO4t8+JC5FFnXOco71hJMtzOuUkuwhPVEQtYhzzHkGWb9NITR7g5 rZjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841206; x=1772446006; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=fazAAiBrJ7rgJoOI1TWI0OtZrQogm6Eto7WktTDuRyg=; b=Oz6NAghh69LFUhJfcUNzDq3HmxZBUaRgR1y62JmJ5JgEdu8+i9GSRdcZvvCMfVi+FF 5rPF90Jv+0S3pO+BkFh4gUKsBToHrR5TfoeWAELiwIzOr2nt0QJ4WMFfHnX8Bl1+sMqQ TqWcpQz2Qs6f8ZmWwIlykKBdeRC6AMTIa2nJLeZ0fBlbGEilRqk7MT0Ax7mSqlnNXKMF GdTgN24jzVx72Z2pRvktRZeKeLp0w6KO3OxHZDPNbv1ZzdzWfU45EwREssUg8qVHTAIb c1FOieHE9pZy/1TiD1gLKfzV6/s1dhZs62MFYW01w67z9kk3Fn/nHD715dfO+L3dDQO4 Dl0A== X-Gm-Message-State: AOJu0YwKZZyRK6hgIzeZQGqij0+ijsEfI6YyQlybRQrxn/VLlT16XMxJ EOpMAyaW5Lkf2hG0OL8rg3VqGV1VGkIgKuKMk7enQsbVleR5IBpUrIOmYLPgEgAM1dKdO10kxQS U0URq4YfthjpW+vjKFoCvhofK1+TlLUsqBCyf0SWDD3LJ4oDarORN+BG8A2sgf2wmic8= X-Gm-Gg: AZuq6aK8/LnmUv5M2qX5KYM+39fZVYwPrahfKVhJSb+qW8bm/irXGEJ82Oo5NpXYGSj Zky5qAdqBqH/EwVLPD0aQ6QsGiTiML+wYskWttZfN7ArghfqGU7W7eaiQFDV4WJwJq/9Ea7In1u jTxvtoaEZstUYo9XcS9R+ODOYD14sTYPsm+g0RXG68iYbw816ifs0weRQaUNYHXHFP1PxXBVPlg fecOa4hzFjKvew6nF5L18OCNVFl4IGkr1mw5T+d9FMVvMzNT51WvTy71LbmItmZsHw9+swvutg+ q51Lz98aR4N+KfHnKfe+wMYtWlymlxoRvIMB6dq194JNhiEpC4jxAD5E+WZinIcYr6FCduq0J5y 3sdtsIx3wI+hy0dzVI5IZspmQ97CkISnWEQZebLv01IE56WE6WWBH X-Received: by 2002:a05:620a:28c3:b0:8b2:f2c5:e7f6 with SMTP id af79cd13be357-8cb8ca65f56mr941515985a.37.1771841206174; Mon, 23 Feb 2026 02:06:46 -0800 (PST) X-Received: by 2002:a05:620a:28c3:b0:8b2:f2c5:e7f6 with SMTP id af79cd13be357-8cb8ca65f56mr941513285a.37.1771841205652; Mon, 23 Feb 2026 02:06:45 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:45 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:21 +0100 Subject: [PATCH v2 08/14] reset: handle removing supplier before consumers 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: <20260223-reset-core-refactor-v2-8-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=10031; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=sL1q9wwhxHZZrZlh7F46CRESH8uPDctEF3AFiujRX4A=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCantW9jF1Qf4GiKFMRfo7cmpDuFo+/otKKhl SWkitJGeAuJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmpwAKCRAFnS7L/zaE w/c1D/0TcGdkNiV3LY34U3o+ivXFRX6SlB2YnAJoBh9UGnFBrEB6ELX7b5AMQA7+7Gsxw/nrekX iA2U/BbcZBS164KERKHAk2DGO5djPxXIg1EhLPvJPC/Ri185Ej5wSXhBj5p/i3EWfx0r/b6Ht/3 YcLncT5r0qFmQBJGkbvEcyGzbKYEv7NaARAEdE4gJ/Nm4SmbxQWJB1D7ft2ym+0q5ntSGJTorHp 7hBQZOW8RxsVakJz5opua97D5UZgn6TCuf+5pu+Od2X0yoq26AF9AXlWszVt1JfLM4Tig8Oy5jk 0+KiCZ/b7EEgcN2sKlDfKcip9IymZmvomm1uCFdnG5RGXVbu9fhl1BbpBQNaZZvvpFUhxKWVwj1 RYLUR4CNqRy2SO18ftuDdXb1ihCLZkeEgEExGIROmY7N/v0lmzMOeqmXZNjeRu2t+szAiN0JrOV SEHIvC8UhCVChZsrWLw/k1fv0VZc3q/G6TGsR5/Is84/onFxNaLi8FCOb7KX2ZbQ5slNRh8qYF/ GbRhLuUK+IH5k8avCMfY1ZJbCchIR3rZDxGdH2WBQNgQ92IzMKycD/0zIkPzRiSLtA4dv5nkiDe aGYj96I4WlQlde1piLjaXInZxhajsbRBd7Ibjn0LQkssXN4D6FzTm0J3A8nES1V7dOUx0BK3oi2 PdXfMHy2t74hpKQ== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfX11PrKfOj7z4y P5eqzcStJjeN0TKACUIskvt56k2UuTqIK4+HV3oDC/IDOW58XDoKbqZAP0Iitj4o6mEJFzcC9Ca 7ZTM6JM79EUdBPSJ3NijgvfOdyYvpKLlYwmotB0mPRGqYV0PXSmaUdIGePxzw1f4pNszceEYGS2 YK0YCpe3+wXjr6CJxnKHl61FuHkyFg5n6QZrwN3ZZ88F1GLywzVHtWLymEYBG+9L9fhk2hQ8cCP 1FVwKnLMh3xJAyc3E+tLxoNPvRi77F3D+Fw8H5zUA5Tv0WItJXcavMmYPQjXDa15mtc9kfS2lJV IV0Zsijntb4+ZftTgDFl41txJl0DtulWM0RoWb6Zhwr/j8UHCozxzUU5uzp6gMZH+34+GXvR4QL g1upfh3wi3CHSwxmGiOYFJ1+E5DH7tqjHBQZvKGvT6jaczT60cg1lSxd+PFG2thtVqkmEcj1zPJ d57NCO+8fRqSNWRLnww== X-Authority-Analysis: v=2.4 cv=T5KBjvKQ c=1 sm=1 tr=0 ts=699c26b6 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=GiwafSNXLQ0EgbbDNmMA:9 a=QEXdDO2ut3YA:10 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-GUID: 9mLKEHjtKP9XPs9qldPn_HmDGvu30lDw X-Proofpoint-ORIG-GUID: 9mLKEHjtKP9XPs9qldPn_HmDGvu30lDw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 Except for the reset-gpio, all reset drivers use device tree - and as such - benefit from the device links set up by driver core. This means, that no reset supplier will be unbound before all its consumers have been. For this reason, nobody bothered making the reset core resiliant to the object life-time issues that are plagueing the kernel. In this case: reset control handles referencing the reset provider device with no serialization or NULL-pointer checking. We now want to make the reset core fwnode-agnostic but before we do, we must make sure it can survive unbinding of suppliers with consumers still holding reset control handles. To that end: use SRCU to protect the rcdev pointer inside struct reset_control. We protect all sections using the pointer with SRCU read-only critical sections and synchronize SRCU after every modification of the pointer. This is in line with what the GPIO subsystem does and what the proposed revocable API tries to generalize. When and if the latter makes its way into the kernel, reset core could potentially also be generalized to use it. Signed-off-by: Bartosz Golaszewski --- drivers/reset/core.c | 108 +++++++++++++++++++++++++++++++++++++++++++----= ---- 1 file changed, 91 insertions(+), 17 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 9fef9f972e93fb7388f27ac3bbdf68c884b72ff5..96199e7b0dd7c89c5a11e2e2c3e= 5eb7fd5d49355 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -23,6 +23,7 @@ #include #include #include +#include =20 static DEFINE_MUTEX(reset_list_mutex); static LIST_HEAD(reset_controller_list); @@ -36,6 +37,7 @@ static DEFINE_IDA(reset_gpio_ida); * struct reset_control - a reset control * @rcdev: a pointer to the reset controller device * this reset control belongs to + * @srcu: protects the rcdev pointer from removal during consumer access * @list: list entry for the rcdev's reset controller list * @id: ID of the reset controller in the reset * controller device @@ -49,7 +51,8 @@ static DEFINE_IDA(reset_gpio_ida); * will be either 0 or 1. */ struct reset_control { - struct reset_controller_dev *rcdev; + struct reset_controller_dev __rcu *rcdev; + struct srcu_struct srcu; struct list_head list; unsigned int id; struct kref refcnt; @@ -137,15 +140,35 @@ int reset_controller_register(struct reset_controller= _dev *rcdev) } EXPORT_SYMBOL_GPL(reset_controller_register); =20 +static void reset_controller_remove(struct reset_controller_dev *rcdev, + struct reset_control *rstc) +{ + list_del(&rstc->list); + module_put(rcdev->owner); + put_device(rcdev->dev); +} + /** * reset_controller_unregister - unregister a reset controller device * @rcdev: a pointer to the reset controller device */ void reset_controller_unregister(struct reset_controller_dev *rcdev) { + struct reset_control *rstc, *pos; + guard(mutex)(&reset_list_mutex); =20 list_del(&rcdev->list); + + /* + * Numb but don't free the remaining reset control handles that are + * still held by consumers. + */ + list_for_each_entry_safe(rstc, pos, &rcdev->reset_control_head, list) { + rcu_assign_pointer(rstc->rcdev, NULL); + synchronize_srcu(&rstc->srcu); + reset_controller_remove(rcdev, rstc); + } } EXPORT_SYMBOL_GPL(reset_controller_unregister); =20 @@ -322,6 +345,7 @@ static inline bool reset_control_is_array(struct reset_= control *rstc) */ int reset_control_reset(struct reset_control *rstc) { + struct reset_controller_dev *rcdev; int ret; =20 if (!rstc) @@ -333,7 +357,13 @@ int reset_control_reset(struct reset_control *rstc) if (reset_control_is_array(rstc)) return reset_control_array_reset(rstc_to_array(rstc)); =20 - if (!rstc->rcdev->ops->reset) + guard(srcu)(&rstc->srcu); + + rcdev =3D srcu_dereference(rstc->rcdev, &rstc->srcu); + if (!rcdev) + return -ENODEV; + + if (!rcdev->ops->reset) return -ENOTSUPP; =20 if (rstc->shared) { @@ -347,7 +377,7 @@ int reset_control_reset(struct reset_control *rstc) return -EPERM; } =20 - ret =3D rstc->rcdev->ops->reset(rstc->rcdev, rstc->id); + ret =3D rcdev->ops->reset(rcdev, rstc->id); if (rstc->shared && ret) atomic_dec(&rstc->triggered_count); =20 @@ -437,6 +467,8 @@ EXPORT_SYMBOL_GPL(reset_control_rearm); */ int reset_control_assert(struct reset_control *rstc) { + struct reset_controller_dev *rcdev; + if (!rstc) return 0; =20 @@ -446,6 +478,12 @@ int reset_control_assert(struct reset_control *rstc) if (reset_control_is_array(rstc)) return reset_control_array_assert(rstc_to_array(rstc)); =20 + guard(srcu)(&rstc->srcu); + + rcdev =3D srcu_dereference(rstc->rcdev, &rstc->srcu); + if (!rcdev) + return -ENODEV; + if (rstc->shared) { if (WARN_ON(atomic_read(&rstc->triggered_count) !=3D 0)) return -EINVAL; @@ -460,7 +498,7 @@ int reset_control_assert(struct reset_control *rstc) * Shared reset controls allow the reset line to be in any state * after this call, so doing nothing is a valid option. */ - if (!rstc->rcdev->ops->assert) + if (!rcdev->ops->assert) return 0; } else { /* @@ -468,17 +506,17 @@ int reset_control_assert(struct reset_control *rstc) * is no way to guarantee that the reset line is asserted after * this call. */ - if (!rstc->rcdev->ops->assert) + if (!rcdev->ops->assert) return -ENOTSUPP; =20 if (!rstc->acquired) { WARN(1, "reset %s (ID: %u) is not acquired\n", - rcdev_name(rstc->rcdev), rstc->id); + rcdev_name(rcdev), rstc->id); return -EPERM; } } =20 - return rstc->rcdev->ops->assert(rstc->rcdev, rstc->id); + return rcdev->ops->assert(rcdev, rstc->id); } EXPORT_SYMBOL_GPL(reset_control_assert); =20 @@ -525,6 +563,8 @@ EXPORT_SYMBOL_GPL(reset_control_bulk_assert); */ int reset_control_deassert(struct reset_control *rstc) { + struct reset_controller_dev *rcdev; + if (!rstc) return 0; =20 @@ -534,6 +574,12 @@ int reset_control_deassert(struct reset_control *rstc) if (reset_control_is_array(rstc)) return reset_control_array_deassert(rstc_to_array(rstc)); =20 + guard(srcu)(&rstc->srcu); + + rcdev =3D srcu_dereference(rstc->rcdev, &rstc->srcu); + if (!rcdev) + return -ENODEV; + if (rstc->shared) { if (WARN_ON(atomic_read(&rstc->triggered_count) !=3D 0)) return -EINVAL; @@ -543,7 +589,7 @@ int reset_control_deassert(struct reset_control *rstc) } else { if (!rstc->acquired) { WARN(1, "reset %s (ID: %u) is not acquired\n", - rcdev_name(rstc->rcdev), rstc->id); + rcdev_name(rcdev), rstc->id); return -EPERM; } } @@ -555,10 +601,10 @@ int reset_control_deassert(struct reset_control *rstc) * case, the reset controller driver should implement .deassert() and * return -ENOTSUPP. */ - if (!rstc->rcdev->ops->deassert) + if (!rcdev->ops->deassert) return 0; =20 - return rstc->rcdev->ops->deassert(rstc->rcdev, rstc->id); + return rcdev->ops->deassert(rcdev, rstc->id); } EXPORT_SYMBOL_GPL(reset_control_deassert); =20 @@ -600,14 +646,22 @@ EXPORT_SYMBOL_GPL(reset_control_bulk_deassert); */ int reset_control_status(struct reset_control *rstc) { + struct reset_controller_dev *rcdev; + if (!rstc) return 0; =20 if (WARN_ON(IS_ERR(rstc)) || reset_control_is_array(rstc)) return -EINVAL; =20 - if (rstc->rcdev->ops->status) - return rstc->rcdev->ops->status(rstc->rcdev, rstc->id); + guard(srcu)(&rstc->srcu); + + rcdev =3D srcu_dereference(rstc->rcdev, &rstc->srcu); + if (!rcdev) + return -ENODEV; + + if (rcdev->ops->status) + return rcdev->ops->status(rcdev, rstc->id); =20 return -ENOTSUPP; } @@ -635,6 +689,7 @@ EXPORT_SYMBOL_GPL(reset_control_status); */ int reset_control_acquire(struct reset_control *rstc) { + struct reset_controller_dev *rcdev; struct reset_control *rc; =20 if (!rstc) @@ -651,7 +706,13 @@ int reset_control_acquire(struct reset_control *rstc) if (rstc->acquired) return 0; =20 - list_for_each_entry(rc, &rstc->rcdev->reset_control_head, list) { + guard(srcu)(&rstc->srcu); + + rcdev =3D srcu_dereference(rstc->rcdev, &rstc->srcu); + if (!rcdev) + return -ENODEV; + + list_for_each_entry(rc, &rcdev->reset_control_head, list) { if (rstc !=3D rc && rstc->id =3D=3D rc->id) { if (rc->acquired) return -EBUSY; @@ -743,6 +804,7 @@ __reset_control_get_internal(struct reset_controller_de= v *rcdev, bool shared =3D flags & RESET_CONTROL_FLAGS_BIT_SHARED; bool acquired =3D flags & RESET_CONTROL_FLAGS_BIT_ACQUIRED; struct reset_control *rstc; + int ret; =20 lockdep_assert_held(&reset_list_mutex); =20 @@ -773,12 +835,19 @@ __reset_control_get_internal(struct reset_controller_= dev *rcdev, if (!rstc) return ERR_PTR(-ENOMEM); =20 + ret =3D init_srcu_struct(&rstc->srcu); + if (ret) { + kfree(rstc); + return ERR_PTR(ret); + } + if (!try_module_get(rcdev->owner)) { + cleanup_srcu_struct(&rstc->srcu); kfree(rstc); return ERR_PTR(-ENODEV); } =20 - rstc->rcdev =3D rcdev; + rcu_assign_pointer(rstc->rcdev, rcdev); list_add(&rstc->list, &rcdev->reset_control_head); rstc->id =3D index; kref_init(&rstc->refcnt); @@ -793,13 +862,18 @@ static void __reset_control_release(struct kref *kref) { struct reset_control *rstc =3D container_of(kref, struct reset_control, refcnt); + struct reset_controller_dev *rcdev; =20 lockdep_assert_held(&reset_list_mutex); =20 - module_put(rstc->rcdev->owner); + scoped_guard(srcu, &rstc->srcu) { + rcdev =3D rcu_replace_pointer(rstc->rcdev, NULL, true); + if (rcdev) + reset_controller_remove(rcdev, rstc); + } =20 - list_del(&rstc->list); - put_device(rstc->rcdev->dev); + synchronize_srcu(&rstc->srcu); + cleanup_srcu_struct(&rstc->srcu); kfree(rstc); } =20 --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 21821361DB5 for ; Mon, 23 Feb 2026 10:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841210; cv=none; b=ZkPWkqC9hNt1ST0JcZZx6CyC8ikPKXQAEem1Ouw4tSBj2gVB+IRX5HpmUGsjEHZymgxtH0QsUi3FV5bMlFyDyfb1YOhZXB9mztG550nue1JMpg646wM8ddND79LkbY8ePK0O8WfQ3i4GfWbfsHSe/n5LAjmOMCgMs+wjio0Bg50= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841210; c=relaxed/simple; bh=XIaVIFGyKxRFAVNTCoC6mtQQ9fiI4L7RdNBVhpzo77c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R5Wb62J9Ffz2jqN9o6gznsP4nb9Gmq33ARaaKGZasUuaLi32larWqRloywM5X+StdIOsztghqviDag9PY0HXNBzn4Xf5RRt8wwtfyMC71ZTcaun1n82dy931/+UQ18npxZahrQRwxl/f/hk/fYo5rCvvZ2QfTAtFJRcNSEzLMEs= 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=ZMa7iH1S; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=aWmj2GVm; arc=none smtp.client-ip=205.220.180.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="ZMa7iH1S"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="aWmj2GVm" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N8xHmr2320254 for ; Mon, 23 Feb 2026 10:06: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= MCKmBMM6OnSuHzXoHkqHCseMHs6O0rCeUxE/L5JsgZ0=; b=ZMa7iH1SIuVMec3d Gq3qCDaH7/FxAVSzhx41j97PBvFuEu+A1bSQT4KfjyjbwilqI9hJMKmN/41wAhhX E+sYhZoYQcHP1wcpodhJivbo0nu7S6+AoroL/wZnETAWdqvztEbueYU+Q3s8Vmne CZ9MO0pwfaVQn/bUgTMZ/ColEigvKkKsNuTfm3OEZiGmsUk4kJ0D2uelvlTN3H8g B0L8gstPpoRomABfmQov843auKk0ZQWTYFDMEk1Ls3NyQjFCF7x6b6Ev5ZrjOd0N +ZARGMtAx/6gQsYHVL/YjZv1nWWY9Glk630ZsjXjBwkONmuTwS6beGQr9HxQgRLC Uta6/Q== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5vj47nt-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:47 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8c71500f274so464239085a.1 for ; Mon, 23 Feb 2026 02:06:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841207; x=1772446007; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MCKmBMM6OnSuHzXoHkqHCseMHs6O0rCeUxE/L5JsgZ0=; b=aWmj2GVmgoMTam7hPMex73wAaB3vQA34AwVk821vvf0lizvXqs8rFPpKXHUYx7Zw+C W616OCL7T5mfUumKSdS+KRprU72tgJp8UfDAgsoFgfY9DgTeKuoNG40WVOw9xpVQwyhF 6PRb5FDZrksfyZVC2awELg6ZAeK0EJpUcHHj/OkSixZhPk9OqdcMZwCCEAqw7V+dm972 RpYjbH4jI0KJbA+hczIXGuia4noQxHELbgzhJfW1J25vsF7v42zRS9EkrtpoLMZ3nRGB Lq+6udqFjgdDwinzx1I/nUKKgRQVqzzRIUMOHLH5NA6rpCTtiabUxYs+5G4eD0H14Jka dunA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841207; x=1772446007; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=MCKmBMM6OnSuHzXoHkqHCseMHs6O0rCeUxE/L5JsgZ0=; b=GjPJWn8LwF0F0oDND+ffy4WcUvEKivdbRwoQZ4Zr3WZafNZ8gGfC9BS/CWjsbeH2V6 SLMKvNx+rX/8+YMi1p0EjfpeJx4JdLv+w5hej4GAXjhwME0c0dzBXwRkpGkDGdhQeQ6B qzTtnkYri+A1ii89WDlVGqUgaP7v6FoFuKdzcEoNoBuQalVrVfYDgvjyKm+nUibIskrq DqlvXlu8wxEk50JiZN2lyOln2lF9l+mU3TKWRYZPiKcBDvUeDnz/6LXiZmaWxPa6jPwE +7Va3YPjdh6MmU6b7XZMYVE+/OU49mfx1kakLiyo2Dk56m68Cuqd+q6id2b3FtB6u3Op NkbA== X-Gm-Message-State: AOJu0YzUwiJu/n2eF7w1xpS29dMEdw4pT4ABvVbCkjqDEXizUVUpIpSX 9f6A2ezHB3hpwSpXTiHkyzSUyogOoWycSDZZNZFv3QNrqhNitvfM28SX4MnLkKReuFQFnHiBBek 7/ppkJ5n8nPxjLuf9md0xTqjOLG8da+d1ZjQxl4RLNMhjPAt1ua/xyQ4chn6/V01h5jA= X-Gm-Gg: AZuq6aI9BRMdpBs2jdSEFLHyeobx++TxGriDBhNeBegBUdS0xbyOOJMkOil3ZU+Jfl4 mgQRhzJUTW/py+hwzxvAH01pXeg4ZjO2n7ITXfMwOWk3XX+FbtnqpIgvPHMyXKKIf8oOFM7KXt6 qr8dpOoF1kQE1/ugwRLQoO9tMvGREi8bX8DBjeCnnDnLV98geW3ycoHt2246RwyvKGLvj6eUrpI 0snnxGpQXWEyW2soL3BzXUDsxAUUlcBl9N3bNFSb/cDahHfSn752wIF9Mj4N22TOTi7esO3SyGu AhcfUdOzGDfXIGeiz231dMOa/t5/RDkloekqlNJg9o42JwbbHpdod76ha4GjRG3A0TAyXdE/U04 LBxpcwm59n6w9ju+qTcgMBOMJg++bgEKiIh0knnmlzHum2etszNV6 X-Received: by 2002:a05:620a:4491:b0:8cb:4ba9:cce6 with SMTP id af79cd13be357-8cb8ca83450mr1008628185a.66.1771841207308; Mon, 23 Feb 2026 02:06:47 -0800 (PST) X-Received: by 2002:a05:620a:4491:b0:8cb:4ba9:cce6 with SMTP id af79cd13be357-8cb8ca83450mr1008624985a.66.1771841206762; Mon, 23 Feb 2026 02:06:46 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:46 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:22 +0100 Subject: [PATCH v2 09/14] reset: protect struct reset_controller_dev with its own mutex 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: <20260223-reset-core-refactor-v2-9-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4635; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=XIaVIFGyKxRFAVNTCoC6mtQQ9fiI4L7RdNBVhpzo77c=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCaohGyBCuO5ufMCfJpv/H6sQTR+qZKMUgq02 jWEgVJR1GqJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmqAAKCRAFnS7L/zaE wyGUD/kB8IqpNC2SAEfXA09Y5xTU+6fF449xNcfbSsinqRrN5f8kXGRPlPOV0ZGUMdGaoPCPu82 Kn9OroAaUa69LxGdwc+IrgwIYO/RYqDgW5gtaNeDWLGqKksxXfHg+YZYmBy3G9ckl7vsMxFZr1+ VB3gQ7dH4KM5PulAEFs/TWpke47fF0J+Bmt38EAOeeTVB8i+L/aQDxSr/SsQ7fvZ5d79yZR4Q8z ygfAKXRO3SdYjKmeOr96P03LNPby5FMHFBoyVuFjMVLACtXS0FOymBWcnqcpBg3T1ld9rIoLvH5 5Wif9aA/+Oi2lXlUpzaCcvCeSw37dUYx7elho7MR7ddJw7AOfwuprt1a6pVhA5GJKi/KBIyOLdZ BySOjt/lrV3YqhwwWaVc8bZPa+JlREFFjJ7cEjn6vRvU7Y7yGfxSsL8wMpCDkDLfLWVQpyPiE/X 7TwWbntI5j9EFjAhzN/dbh/jTjOvCj24JEsNWNpbvZcFWzFFXwkUpGrbKNRuqANko6oNiZEHZLo eO52rQavFLrxPQDPSFkIsCrfFldQj1c0EIR53NiPTYdkkqEtc5JCXpi52NJcSxATXnMH+cZ/K3q YSv7E1B4LMRV/Q4e8LQzz8PVj+o4JmLwnL5A6REXsAzKkEk59F5KF8UCxSgmhig6tXAYQpo+DCx WjLLjqe99/dy7iw== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfX7uhdCIMqfEtP ld+Z79Ax7TErUm3yTFNeP3HWbd8IuaDiKFwzCqdQDXgOf0+GtynmNPzwJkV60/bdM+SGaBUlHYN loe45yuTnlAbV5hMwCJsZcxuUubJRLx5yJIKNgfewnaWDrHUgxeYiorXVhjmTSGavfoV+xsD0za EUUmiMC0mC7ikpUDEqxcYeCytlt585a1zgBv2LNrGZOUP38SXqFsxm0iF1glB9U8SJ0TR7X13UB 3CJhf2jmdyubBoWopkcmPGlQoJv4WtEjwBma0JcbSUrocUSTlav9+sUaW4nxXzbbyzKq+APQcoQ 1XbzflB0Jwia+G1/YG3IPepy0RdB9ot2BjNYGOja+59nr+ik+BJ7l4sTdNogpBgLKPtKapTxAbh vF4IUDNLzUBlE5m5vBEZV3JPg7VQ25AYSr/O832Tfu8BGVp9na7h1DXR0gpZjP1L5B/Q/4B+tvR LMNp335OZkks68mx6Sg== X-Authority-Analysis: v=2.4 cv=T5KBjvKQ c=1 sm=1 tr=0 ts=699c26b8 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=nQ7P6-40-II7rw7jOZoA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-GUID: BXINIbumMj93IFrguGR5VwuGnzOtBLkd X-Proofpoint-ORIG-GUID: BXINIbumMj93IFrguGR5VwuGnzOtBLkd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 Currently we use a single, global mutex - misleadingly names reset_list_mutex - to protect the global list of reset devices, per-controller list of reset control handles and also internal fields of struct reset_control. Locking can be made a lot more fine-grained if we use a separate mutex for serializing operations on the list AND accessing the reset controller device. Signed-off-by: Bartosz Golaszewski --- drivers/reset/core.c | 44 ++++++++++++++++++++++++------------= ---- include/linux/reset-controller.h | 3 +++ 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 96199e7b0dd7c89c5a11e2e2c3e5eb7fd5d49355..d4813c712abf3df7993b0c2be1f= e292b89241d11 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -131,6 +131,7 @@ int reset_controller_register(struct reset_controller_d= ev *rcdev) } =20 INIT_LIST_HEAD(&rcdev->reset_control_head); + mutex_init(&rcdev->lock); =20 guard(mutex)(&reset_list_mutex); =20 @@ -143,6 +144,8 @@ EXPORT_SYMBOL_GPL(reset_controller_register); static void reset_controller_remove(struct reset_controller_dev *rcdev, struct reset_control *rstc) { + lockdep_assert_held(&rcdev->lock); + list_del(&rstc->list); module_put(rcdev->owner); put_device(rcdev->dev); @@ -156,19 +159,22 @@ void reset_controller_unregister(struct reset_control= ler_dev *rcdev) { struct reset_control *rstc, *pos; =20 - guard(mutex)(&reset_list_mutex); - - list_del(&rcdev->list); + scoped_guard(mutex, &reset_list_mutex) + list_del(&rcdev->list); =20 - /* - * Numb but don't free the remaining reset control handles that are - * still held by consumers. - */ - list_for_each_entry_safe(rstc, pos, &rcdev->reset_control_head, list) { - rcu_assign_pointer(rstc->rcdev, NULL); - synchronize_srcu(&rstc->srcu); - reset_controller_remove(rcdev, rstc); + scoped_guard(mutex, &rcdev->lock) { + /* + * Numb but don't free the remaining reset control handles that are + * still held by consumers. + */ + list_for_each_entry_safe(rstc, pos, &rcdev->reset_control_head, list) { + rcu_assign_pointer(rstc->rcdev, NULL); + synchronize_srcu(&rstc->srcu); + reset_controller_remove(rcdev, rstc); + } } + + mutex_destroy(&rcdev->lock); } EXPORT_SYMBOL_GPL(reset_controller_unregister); =20 @@ -712,10 +718,12 @@ int reset_control_acquire(struct reset_control *rstc) if (!rcdev) return -ENODEV; =20 - list_for_each_entry(rc, &rcdev->reset_control_head, list) { - if (rstc !=3D rc && rstc->id =3D=3D rc->id) { - if (rc->acquired) - return -EBUSY; + scoped_guard(mutex, &rcdev->lock) { + list_for_each_entry(rc, &rcdev->reset_control_head, list) { + if (rstc !=3D rc && rstc->id =3D=3D rc->id) { + if (rc->acquired) + return -EBUSY; + } } } =20 @@ -806,7 +814,7 @@ __reset_control_get_internal(struct reset_controller_de= v *rcdev, struct reset_control *rstc; int ret; =20 - lockdep_assert_held(&reset_list_mutex); + lockdep_assert_held(&rcdev->lock); =20 /* Expect callers to filter out OPTIONAL and DEASSERTED bits */ if (WARN_ON(flags & ~(RESET_CONTROL_FLAGS_BIT_SHARED | @@ -868,8 +876,10 @@ static void __reset_control_release(struct kref *kref) =20 scoped_guard(srcu, &rstc->srcu) { rcdev =3D rcu_replace_pointer(rstc->rcdev, NULL, true); - if (rcdev) + if (rcdev) { + guard(mutex)(&rcdev->lock); reset_controller_remove(rcdev, rstc); + } } =20 synchronize_srcu(&rstc->srcu); diff --git a/include/linux/reset-controller.h b/include/linux/reset-control= ler.h index aa95b460fdf86f10002a465e285cd0119da6eeaf..2fecb4edeba1a2b1f5f5db2b34c= 867362c5f9c18 100644 --- a/include/linux/reset-controller.h +++ b/include/linux/reset-controller.h @@ -3,6 +3,7 @@ #define _LINUX_RESET_CONTROLLER_H_ =20 #include +#include =20 struct reset_controller_dev; =20 @@ -40,6 +41,7 @@ struct of_phandle_args; * device tree to id as given to the reset control ops, defaults * to :c:func:`of_reset_simple_xlate`. * @nr_resets: number of reset controls in this reset controller device + * @lock: synchronizes concurrent access to the structure's fields */ struct reset_controller_dev { const struct reset_control_ops *ops; @@ -52,6 +54,7 @@ struct reset_controller_dev { int (*of_xlate)(struct reset_controller_dev *rcdev, const struct of_phandle_args *reset_spec); unsigned int nr_resets; + struct mutex lock; }; =20 #if IS_ENABLED(CONFIG_RESET_CONTROLLER) --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 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 8C128362120 for ; Mon, 23 Feb 2026 10:06:50 +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=1771841212; cv=none; b=DM2BPE9XRX6PDvyNvWk6QLBePAopGpzjdEATaKDrNcimKbm6lHqnyOU/eIfZenzco6FjoAaQxd/dr3EpYkaLojbDgwDvO26XkfslU1GYiCYCUSTXW9Fv9e0DONUfWrfMcbqvhuI6T5ilAXIoQBSRf3jxxwwampZiqCxT5Tznnzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841212; c=relaxed/simple; bh=FJixpdRr9RVjSNGAF4dAgado5bV56wITIMLjI/KfEC8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jbuHKb9lPpUtLTpJnTmYVvO4FVcw6nnE6hfmqJmKBwUnt4gQjuuuVQZTlXha9Zi5Q1IwSeGJK7eRfUopVSswC8IUrQeLMg1XkCGVGsEipz6xEj1LcfEcb2f6IQ9luIYGBDFT5JpYTGHQ1LrSf+pnmhP/Eswx2gKYTQcNejEH4QY= 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=bwjtz3bV; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=OGTo0zRQ; 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="bwjtz3bV"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="OGTo0zRQ" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N9c18T3234263 for ; Mon, 23 Feb 2026 10:06:50 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= rg6UttrPDN9MfpCZ9fONPOkfz6eMrgkH8r0kh8ZqjyQ=; b=bwjtz3bVTvOL6O3m PKiVGXgMQt9jdbxepOXF2v0ZoKzi7w0nUFdBbSDCzjb70sT0AguA+MheArimYzdH nsxJ9qc0bl1/YXjx9FXeLgQ05sg1I75E+DiFqEl84YFBT7gS0q+KaICw5HWumEk8 2B1DYnW2CKyKpjnZKDs45ycTZEMQI25jrEls098dTK1UEXmCk5jUOBn0j+48J1D9 7HjwY9KAjLiJXla7K9Mvfq41VQBgAi98G85V6EOa6oN+3iL3q5Q4wbo0Sq+sHvJb KlbAZUqtTk2S8o4BuYfGPcr5OodfQQtBPtKga+7j/9KM8XtxjV8rH1CdAdtJlHb1 Aua9zQ== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5wk4901-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:49 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cb0595def4so5316618485a.0 for ; Mon, 23 Feb 2026 02:06:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841209; x=1772446009; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rg6UttrPDN9MfpCZ9fONPOkfz6eMrgkH8r0kh8ZqjyQ=; b=OGTo0zRQneRtBLNAY93nOt5sn6DdSp3G3DWMdWnI7ZWyVqq4A7URZI+KTvw30fhv+F Lkk0k+jKfZqYdlP/zBlxAcT3ErfqXb8xo0iNv8UdNO4/IwiaDChMPz1eVdiTgw5Svs96 qcBI5eIZAUSKf1aj9Ffwgf2RSNZDLR6za3JdqgQ6kagplRerL2VAdJEvkvRkFCkZKp3/ yrSTQuTp7dtJmq+Z/NmHfDDmD8s/M4lsr2bMlzWY+Sw8PFAIJrsyb1IW6ETeQbYxWty2 0JV+6S2d2sgba50ggxwx5YhJqqfQmDP7EZg3x4VxlpZ46gou6syEBT7YHjTS7YZPvB11 japw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841209; x=1772446009; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=rg6UttrPDN9MfpCZ9fONPOkfz6eMrgkH8r0kh8ZqjyQ=; b=Qhsf2U5CZggzt+gyzLa2SYAzPZ2WDS6Ptfy39uv+smzhMlfQ/0A0t0KHbVv5jRd0dW N0LLQaZcYMwq1B1UL4Xll0lzlfyFLRj8cwty+mNRRO6v/JfuVxE+cM6pRuYPGQ/xkjBK 3zL/PZcpiIz1//UjxytjzPBzxRr7NH+bySOtWsqPYs/39Mujqt+qzjbT+m+7YHHW9Vtz YtXKGZOsQB61aw8wcofy2f64bZPEVVCZWd4Xit0DSjpmUMzRYFJnLjW9rfdlLM9qGe02 mhKomv8ttjxa5AcDJPd5LNaVyj95VVaV5P+8msWsGzU0KS0pGX47Z/TLMOFy5K2s54AT HUkg== X-Gm-Message-State: AOJu0YyBQ9e1uJGr9RGQZr9wG+kJ4NFt9za2MKfdtymguLgyCyFRc8Q0 QFXFelRQzFFH7nqBFM5bhv3ghoLfnSTIqZYe9guWniaHhS/+ds2loRYJ3Glo/e5TuU+/TMvprMx wloA3anLhVsIEPDuX5cNl3IPL1TtK2GKkqH77Fof3h73vC3gVhq4EcwF2/N6UFZOgjho= X-Gm-Gg: AZuq6aI2PayzxgJ2A1akmHsostHg/xun/oztccwYwOzlR7YcoGc7byW3qTKFMDeO2tL atj2mszlgsn/yr3gPVU0j6CMKLv79NVVlB1/zT739C2WzbbYbaYhlQTbdjvTnEggIT2ybXNuqyc qMaZzSvvkK5xoDcwz22bzRv+QjtIjLIuNfF4Jz+nMtbFhnxUYGET4F8DLnvuDtaaop+dayewlBX bAzEck4XNxrTkCak5aFfrJzVf4UCUSUZhgTiN/RIQqvZK13sllRsSmyPATnK7ObiIdqzYRDOtq1 2/5zYeGosV5SMwaG9xxvpYEfLt4Y2kYxPXMZxYphLyV1j7jWV88GHhSN0iK+n/2yymPswT06EQX 8ah8WRf01d7W3qRJrLFekmIxjZinRUuNx31L1rgZDc4P7N0E0SaKb X-Received: by 2002:ae9:ea0a:0:b0:8cb:83d8:31bd with SMTP id af79cd13be357-8cb83d836c2mr975735185a.40.1771841208680; Mon, 23 Feb 2026 02:06:48 -0800 (PST) X-Received: by 2002:ae9:ea0a:0:b0:8cb:83d8:31bd with SMTP id af79cd13be357-8cb83d836c2mr975733685a.40.1771841208227; Mon, 23 Feb 2026 02:06:48 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:47 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:23 +0100 Subject: [PATCH v2 10/14] reset: protect struct reset_control with its own mutex 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: <20260223-reset-core-refactor-v2-10-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5041; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=FJixpdRr9RVjSNGAF4dAgado5bV56wITIMLjI/KfEC8=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCapCvHSLtZRXRlys2e+f+SxucYyfek/Rypkj 2tVxYIhCBSJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmqQAKCRAFnS7L/zaE w8LAD/0ba5XGHVSHAvMTgn41dqGYKvuFlQPQ/+MJCUhJypPetuGakYjhwlOTYZP76T2bSASGAOt gmAUu13LWrH/Mz8yoqiUf++jBmFGcMkcGy7T+UJMGNHjD7wrb2KQYD2XOJlFLWauTF6+Ot8i/ys V64DeGBIpT7XlivcscI7CJAYJjftUnF9aH2vECEuqZ+gP8cNtN89rgjOMoq3gdOAzHLUte9NohS juITjaweqXzXQoz7GJ83DmDZGkyeBEen4VFGR6X7QQketjoF1wzT8pkFaiwTce/GfCIpAPGKhza iw3XlUGSGCU1shZCQ1MeHSlc9cMcsRAirKdm8YBtZvoMfLz3/tYv/9oyM1ayq4NOX+pylOB6aEG I9OEmAURFK1/lcnT3T2ya+CYpFE+JSPCzg3gaKjCvyCziYvvOVj6MknX7Jf4s6/tPF8bs3B8d72 rHfksJJOPxd2V+7kgQX+6aJq0hWSVBWDkv/q32gzxj+HNmZjSm7yaxiwz6yEETtdiTORy71Veqw D8/FxNG9z4nzJ0AyGGR+8nmSBs2gHvjXJQzap8PFgxEkc8Qzo2l9TkcCgSgBr/72jMSIgk3ygEx J5HqL8LjtBFaeSwa4FMshIwDcpBe0usqCcCQwR+RmtE9zclHO3TW8f+BONiTNkLsAImZn1I599P oBpDFGkJv1Zbngg== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Authority-Analysis: v=2.4 cv=a6k9NESF c=1 sm=1 tr=0 ts=699c26b9 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=dYSpPNroVltAtaK4QdUA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfXygkFUVj2zVEK 0rnny06ny+pMTjU3ckR24HGjpaFEZ6bQnZ9LvwSvhlvDneK445aZhNeJ2ubyA0UrPjd98ruV7Sw Pa2hw2/FXQYAiJSfn0YOnG6E/PFggCYldKVbK3zxwxYifxO5u+PSVeqAOUm+KHI0qfshqgHXJ2i 3b7kahOuKFNgY5SM3+S9uU7w2d8X6258vH01A/AgRPRJvsCYJdTvZsgALhy5iv722Ocd6fypzgj aoYVsrh1KpG+FxKWFS378E2I/UOIXzJdFkmngLTNlOhKC9l6UYJTEC20sye5zXJDDoCW5WcNsXC FgObw4Zt+53Z6vrwfKZ0JktgP/Cu9v/osL3Niv5tCPQLkmH1WJGrM+5W7prTHPQfergP+iFeVNj igl8FsMMhfxhEEe+Q99QEOCO5GFRayo5mp0yBFuUGgYaReEFTvkV2OoRgM5XCH7iK+EU/G+ovPq C3z8IYwL7MQYl0mFh8Q== X-Proofpoint-ORIG-GUID: _SSKw1J0TiV3NUDFbUkRoIHBS2tA2-iG X-Proofpoint-GUID: _SSKw1J0TiV3NUDFbUkRoIHBS2tA2-iG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 phishscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 Currently we use a single, global mutex - misleadingly names reset_list_mutex - to protect the global list of reset devices, per-controller list of reset control handles and also internal fields of struct reset_control. Locking can be made a lot more fine-grained if we use a separate mutex for serializing operations on the list AND accessing the reset control handle. Signed-off-by: Bartosz Golaszewski --- drivers/reset/core.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index d4813c712abf3df7993b0c2be1fe292b89241d11..647e7112779517d2425f55728e1= e7fb6e76a8045 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -49,6 +49,7 @@ static DEFINE_IDA(reset_gpio_ida); * @triggered_count: Number of times this reset line has been reset. Curre= ntly * only used for shared resets, which means that the val= ue * will be either 0 or 1. + * @lock: Serializes access to other fields of this structure */ struct reset_control { struct reset_controller_dev __rcu *rcdev; @@ -61,6 +62,7 @@ struct reset_control { bool array; atomic_t deassert_count; atomic_t triggered_count; + struct mutex lock; }; =20 /** @@ -707,7 +709,7 @@ int reset_control_acquire(struct reset_control *rstc) if (reset_control_is_array(rstc)) return reset_control_array_acquire(rstc_to_array(rstc)); =20 - guard(mutex)(&reset_list_mutex); + guard(mutex)(&rstc->lock); =20 if (rstc->acquired) return 0; @@ -859,6 +861,7 @@ __reset_control_get_internal(struct reset_controller_de= v *rcdev, list_add(&rstc->list, &rcdev->reset_control_head); rstc->id =3D index; kref_init(&rstc->refcnt); + mutex_init(&rstc->lock); rstc->acquired =3D acquired; rstc->shared =3D shared; get_device(rcdev->dev); @@ -872,8 +875,6 @@ static void __reset_control_release(struct kref *kref) refcnt); struct reset_controller_dev *rcdev; =20 - lockdep_assert_held(&reset_list_mutex); - scoped_guard(srcu, &rstc->srcu) { rcdev =3D rcu_replace_pointer(rstc->rcdev, NULL, true); if (rcdev) { @@ -882,15 +883,14 @@ static void __reset_control_release(struct kref *kref) } } =20 + mutex_destroy(&rstc->lock); synchronize_srcu(&rstc->srcu); cleanup_srcu_struct(&rstc->srcu); kfree(rstc); } =20 -static void __reset_control_put_internal(struct reset_control *rstc) +static void reset_control_put_internal(struct reset_control *rstc) { - lockdep_assert_held(&reset_list_mutex); - if (IS_ERR_OR_NULL(rstc)) return; =20 @@ -1104,7 +1104,7 @@ __of_reset_control_get(struct device_node *node, cons= t char *id, int index, { bool optional =3D flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL; bool gpio_fallback =3D false; - struct reset_control *rstc; + struct reset_control *rstc =3D ERR_PTR(-EINVAL); struct reset_controller_dev *rcdev; struct of_phandle_args args; int rstc_id; @@ -1169,8 +1169,8 @@ __of_reset_control_get(struct device_node *node, cons= t char *id, int index, =20 flags &=3D ~RESET_CONTROL_FLAGS_BIT_OPTIONAL; =20 - /* reset_list_mutex also protects the rcdev's reset_control list */ - rstc =3D __reset_control_get_internal(rcdev, rstc_id, flags); + scoped_guard(mutex, &rcdev->lock) + rstc =3D __reset_control_get_internal(rcdev, rstc_id, flags); =20 out_put: of_node_put(args.np); @@ -1213,10 +1213,8 @@ int __reset_control_bulk_get(struct device *dev, int= num_rstcs, return 0; =20 err: - guard(mutex)(&reset_list_mutex); - while (i--) - __reset_control_put_internal(rstcs[i].rstc); + reset_control_put_internal(rstcs[i].rstc); =20 return ret; } @@ -1226,10 +1224,8 @@ static void reset_control_array_put(struct reset_con= trol_array *resets) { int i; =20 - guard(mutex)(&reset_list_mutex); - for (i =3D 0; i < resets->num_rstcs; i++) - __reset_control_put_internal(resets->rstc[i]); + reset_control_put_internal(resets->rstc[i]); kfree(resets); } =20 @@ -1247,9 +1243,7 @@ void reset_control_put(struct reset_control *rstc) return; } =20 - guard(mutex)(&reset_list_mutex); - - __reset_control_put_internal(rstc); + reset_control_put_internal(rstc); } EXPORT_SYMBOL_GPL(reset_control_put); =20 @@ -1260,10 +1254,8 @@ EXPORT_SYMBOL_GPL(reset_control_put); */ void reset_control_bulk_put(int num_rstcs, struct reset_control_bulk_data = *rstcs) { - guard(mutex)(&reset_list_mutex); - while (num_rstcs--) - __reset_control_put_internal(rstcs[num_rstcs].rstc); + reset_control_put_internal(rstcs[num_rstcs].rstc); } EXPORT_SYMBOL_GPL(reset_control_bulk_put); =20 @@ -1482,10 +1474,8 @@ of_reset_control_array_get(struct device_node *np, e= num reset_control_flags flag return &resets->base; =20 err_rst: - guard(mutex)(&reset_list_mutex); - while (--i >=3D 0) - __reset_control_put_internal(resets->rstc[i]); + reset_control_put_internal(resets->rstc[i]); =20 kfree(resets); =20 --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 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 AE46A362132 for ; Mon, 23 Feb 2026 10:06:51 +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=1771841213; cv=none; b=VJ18cHh4AKeCsP5iqd1pcyUMHIucfDsoIzqK9csQjO9hXwnwm3lPu6S4ziPM7MDovOXZSuLEVJblUBef/a1MU4UXDK23y5z/P0K44fs8uZXzHBEp8kkcHDT82JFXMfm2rii8VPzNgi/fhDVKdrUeJ33uVCNsgaOpMqCfQIcYQBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841213; c=relaxed/simple; bh=+9U3vfqz3RTXNkB71MQ4OBd5KGxsJluBJdUVB97/vFo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=El2cA+hVJjulkzni5xgrW2wdC2MRpLEs5kW+n9MndjbnTR8hvyVu1r7GSkVuLETGmpPNtrbAy6Yykl4O2ns6qPm/V+qi80FoMMIvo3SNeBQdGC8GFKUXTCf05Ld8B3OHzMZpJ6qkZWxxZzWDz5GAfwyp3L3sVcon1u7z+/EBGPE= 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=dgX2raGk; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jDD20iW5; 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="dgX2raGk"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jDD20iW5" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N9gacH1313614 for ; Mon, 23 Feb 2026 10:06:51 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= BfkdELt6kGkmasXMBFzN6Mr76TsBAt305RHAChO/ylA=; b=dgX2raGkfPfyc25f 8XlUxhny5YSIAE6wdC1XohfUlMYB4rppl7cmU2kxRh9aeuowmjELCMWr1xfo6vNM kR2UhrIYcYXJxNLKiucv/UKhRPkevptGKhfHf5oqXfeNbh0SH00YABvNigJQTppt LuHkccj0z1D0zQWZ8t8n4DEhTizSLG0A7xBE5gvjxFxP9dXf/l8G82Mu6vglco+M IH8+LVPEE+3assOojdIpkBmYtYEyK5aeJuDbd7Ybojj0GP6+NV32amZXS9twG0Zp SnJp5ZzIKfGa267BdOdRZ+i5ufHjqiEGTS1KKZI3k9xOwT1fqWigWnGAcJYsE/SO iGnnNA== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf603mb56-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:51 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8cb4a241582so3900098085a.0 for ; Mon, 23 Feb 2026 02:06:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841210; x=1772446010; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BfkdELt6kGkmasXMBFzN6Mr76TsBAt305RHAChO/ylA=; b=jDD20iW5jflwNFwdv1FB12zw4L/RV8NjkDmqy+YsMwQM7lziU/6t2T3rRwzqrLM4N2 DBcukylsixV6TU42zTx+M9Qu97bGYuzxD7CmY8gPaqS4LEdYIld+5qo5dAKcJIpHR+2S DbMbTNZvpabfhI7nofQAexmJGJPmW1OQ/evzBIQyKhOaiCS/b6I+lZIqfyMcN1Gpk5pq OyTHSswiY7QYQQ+OPt7qfaYQ66wC8J1J/i1vK6xFyVTTYyOjVKpv8ZbFo8eUTXshnGIo EEi89dxbpq74AirA3d4PcCnpq9s4PKcn/IyFuaOpfPl/4WpCvdC7rkGkbeCLROVB34XT sJvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841210; x=1772446010; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=BfkdELt6kGkmasXMBFzN6Mr76TsBAt305RHAChO/ylA=; b=DWzSH3nKTG3vKnK7PfsNjDmXz6hqF9X58HxJ63D78PCvZuLZcLLrZ8gqS0eeS31eP1 yBouLWWpQ181CVBr/lcfeESLFO2LNOPzMlkOL2LGXuhK+cDsAALSzWms25yj8XLkNJL8 JGMC+pn3DvkczQ41ROLfI2yOm4MuWNRyJOWX86l2+nF3sfGowjNxhIVWmAGROhRb6G77 B5xfGplRI6eiJM+3XbUKCBoH3TYZdgSOAlinLfCsWVF2aLnvwtwA98ZxRX+hOSXeQyE7 hRhTAmZSoDkMZ8klbZELbkEG0AZ1ksB4oqbyMN3B5KUzyITvaOAuLPQ0S96zcAezAyUv WTew== X-Gm-Message-State: AOJu0YxeoUywii/hicnsKIEQm48byVtC7wTDR1W3Q46wCJLUEVRLICMq cq3ERfXM5TJcn6ggGLGxkPXs4k/vONaL2MLY+aFnUmT+Zw4rNPBCOvC5NIuiraAfUe4u3WhA1WB HKWFTjeuTE+PVfYZrAl3Aw8s1msuihKC3uNxMCZWzoChO2RcF3WVcMPz6g2oanK0W8UA= X-Gm-Gg: AZuq6aI6n8GZtsHxHXCNGoWETPioF9gk5hYQCxoLK3Ewij6nqKgZy/mewNJf5wpEHjQ ZK7q7onX7QEE5GwBBYfPE7uWNcBpRpLknCAoseTLXdmrsKQ3lX6/owMpPyz8EkG0ArcgESM11Cf agUJ33K/w1vs5bKw3420YfgzqnKLhShm7pNL4p1iZ+yXgRizhX7F9N6qrLNR7B55IdGXZU/JY8i tUwWRlZynHVHPLRq9iMuXFr7FJPkFkjJG7ft7IyJ0/9exw3NmMjcL4+SWF5aO03TjjEt54VKg7J fr8T8JLdcAG0jUwXIstj4jqCfzHhHnm1ja0K2mGI7NoWkxjkooP36/4SxNhod4o/RI1BerdjINg VOeI0Y0ANJphHw9IMLD+pTkdeG+2Ld2bZtNCW0Kr0si7wPkTAtWTM X-Received: by 2002:a05:620a:269a:b0:8c9:fb65:7f08 with SMTP id af79cd13be357-8cb8ca63f57mr992733285a.46.1771841210097; Mon, 23 Feb 2026 02:06:50 -0800 (PST) X-Received: by 2002:a05:620a:269a:b0:8c9:fb65:7f08 with SMTP id af79cd13be357-8cb8ca63f57mr992731385a.46.1771841209673; Mon, 23 Feb 2026 02:06:49 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:49 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:24 +0100 Subject: [PATCH v2 11/14] reset: convert of_reset_control_get_count() to using firmware nodes 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: <20260223-reset-core-refactor-v2-11-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2871; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=+9U3vfqz3RTXNkB71MQ4OBd5KGxsJluBJdUVB97/vFo=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCapiUx2FbXwvZghJfkjjmi1JQUsCMK4SicKX 0VDY9VafU+JAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmqQAKCRAFnS7L/zaE w/egD/0XEj6Px2OaqYLkOf+4CGBlsVFp10CjMnrPKfC+vutctTKsu7hxLorwYdFdSptheKGXWV8 86iWATFWjpa2R/Xo6Ojrw30RxWM3t9fhTN+cRAbFHzo9lmWQSLQP1WvS+arPIvHv3X1irfzMGcs YDqJoPFFAwSeog19krFaiCdWRvomGFkWIxds21dOWMKUKHCuHSeu7n2jyBP2e49Dy5zaD507zob X+rYuZ6FfWSCbXMg8C1Y4/ADr/9iBCQJoDe0DUqqyn2eSvVdwLBvf1y7wlYn36hpxcQDiHJhqvw hbbqe63aQZ91ageQCFmcdf7SvfD1WfmE17Po7JOwAEz1jLP1C2cW2vseymvDN+SrLrnDRBevWit UKt3I78+sDgYExQjn5ivwEKMQW4iqXiySIo/yQegP6YdhnLYPP1yRuIWIDj96B3gxUYBilQRrLW JJKf6NE/24mMbQr5BncUdJLt69L2zpGUaX7pRla5xmtItNhcCymC39iLOanBV2xvrD8adc3QDfJ MSwLaErasQyjVa5QZT5xh7e65X3i7CTKXoud3XDIrnssYNoYK5Xq8W366hsQ5qHJuWiQcQ0+kHH VzY0uhB8Oe2+yNf5p9HnxUHBmZUUcIORgpwRo6zbQq8zLa+x2T8t4XCqe2sBSBGAt4+PugNcPOn dmdErGc2zE1XUtQ== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Authority-Analysis: v=2.4 cv=XbWEDY55 c=1 sm=1 tr=0 ts=699c26bb cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=xt4VrH2ZgDK96Vd3V1EA:9 a=QEXdDO2ut3YA:10 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfX80Dcfb923Nb5 ZEpvk1b2Ts1aEo0o4n6UHq6aXjCZq/H5cKTrYMNkHagubsrmrMDYtZdqUwis0tNgqLLA7SgarSr vVLXuh54HIrkKiqYBZ5ya5A8w2zN4fWaugqk2eKgScaOWiKrr58/F40o0n5Mp4doJzpdAkFxz7A 4hIhKOMJcSaUucFpDczw/PK6CAJkFPLM3ZUhA7CSn28DaoqDqbBh/bL+3n/GcXY1j8jYv9z0QDy hdf3/y0mPumt5ji3XItBanjLKHPIRAIAjp8GUXAx5XKKJiESLDOdCtYnoV8KT/PIkDwLLELV/2f LA1i3J8/PCs+g0iP84k2S3HoD7SCGrEnvSp0sBlBZBEXmjwmD9FakvQdenPLp/1gYV7mmTKddNQ qzH/qp35aqW8JGlnqvORord7kQp5E8TQlZUWp8n3eSOAKO+jmBtHNOaKI9etX2exgD5tjxA+We7 sd4iG0lv8YZIeyTRWoQ== X-Proofpoint-ORIG-GUID: Ri53VTZLvKvhjtD7yvywqtTiTHpcBkW_ X-Proofpoint-GUID: Ri53VTZLvKvhjtD7yvywqtTiTHpcBkW_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 malwarescore=0 phishscore=0 priorityscore=1501 adultscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 Start the conversion of reset core to using firmware nodes by reworking of_reset_control_get_count(). Unfortunately there is no fwnode-based alternative to of_count_phandle_with_args() so we have to hand-code it. Signed-off-by: Bartosz Golaszewski Reviewed-by: Philipp Zabel --- drivers/reset/core.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 647e7112779517d2425f55728e1e7fb6e76a8045..b215f5a4aab3f7b625b35d18306= 8633c9c581067 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -1416,21 +1418,35 @@ EXPORT_SYMBOL_GPL(__device_reset); */ =20 /** - * of_reset_control_get_count - Count number of resets available with a de= vice + * fwnode_reset_control_get_count - Count number of resets available with = a device * - * @node: device node that contains 'resets'. + * @fwnode: firmware node that contains 'resets'. * * Returns positive reset count on success, or error number on failure and * on count being zero. */ -static int of_reset_control_get_count(struct device_node *node) +static int fwnode_reset_control_get_count(struct fwnode_handle *fwnode) { - int count; + struct fwnode_reference_args args; + int count =3D 0, ret; =20 - if (!node) + if (!fwnode) return -EINVAL; =20 - count =3D of_count_phandle_with_args(node, "resets", "#reset-cells"); + for (;;) { + ret =3D fwnode_property_get_reference_args(fwnode, "resets", "#reset-cel= ls", + 0, count, &args); + if (ret) { + if (ret =3D=3D -ENOENT) + break; + + return ret; + } + + fwnode_handle_put(args.fwnode); + count++; + } + if (count =3D=3D 0) count =3D -ENOENT; =20 @@ -1454,7 +1470,7 @@ of_reset_control_array_get(struct device_node *np, en= um reset_control_flags flag struct reset_control *rstc; int num, i; =20 - num =3D of_reset_control_get_count(np); + num =3D fwnode_reset_control_get_count(of_fwnode_handle(np)); if (num < 0) return optional ? NULL : ERR_PTR(num); =20 @@ -1528,8 +1544,10 @@ EXPORT_SYMBOL_GPL(devm_reset_control_array_get); */ int reset_control_get_count(struct device *dev) { - if (dev->of_node) - return of_reset_control_get_count(dev->of_node); + struct fwnode_handle *fwnode =3D dev_fwnode(dev); + + if (fwnode) + return fwnode_reset_control_get_count(fwnode); =20 return -ENOENT; } --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 4F1A035C1BF for ; Mon, 23 Feb 2026 10:06:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841215; cv=none; b=dIHu6U6sTFmk6Y/C3ad1lPPO+2YE4bRusu/WnB2nY3Yp9uD3TtO1Cqjv9CTBlvieVdOSf7RYwrURoSpHr50bRnAAYzsfnxL3kBlrriUPGzwUdVXO+h4f0hZJvCN5xmyLIjH+4629fXNGAeUxMWtGYmhGvCrgMj3I0jDQvkF35K0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841215; c=relaxed/simple; bh=5iIYYjHPNq5p0+kaAniTf6969MKCe1l8k6ebZsiec14=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ghEVjJIC20vywI/sM2Y2gNYrBVZmGtgpl7oAiKrBQwnqgnAKs0mKUcm6fUr6ijacR19PJiDfM6hkEYv/tO9a9vYv/uy0LVllBoUEmAodKQzj9WmZYYHBbehwj8ifjnsCTSRz/S9sY/QvLjA6Z76b+oWBD+mfeg5/M2VDDlT0uG0= 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=IVBNg/7L; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=MhuGI7jm; arc=none smtp.client-ip=205.220.180.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="IVBNg/7L"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="MhuGI7jm" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N0TdVi1921214 for ; Mon, 23 Feb 2026 10:06:52 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= g2tOlerWd4OhWfCIFMbquts3zgLhKIvbzSHxskK9mKQ=; b=IVBNg/7LpNuPIi90 lWTWC5XTxPA2FMpSWy+CHfZaqQzNSJ1lyvA1tHymG8NTfLBCdO66sUU9DbXc3oaG RR6D6qF0vNsFdIvyK7D1tw1xqy3V023NKvFczTKeVxEoI2No8iTC/6GDydGJBgrx YLpF235vAfziSZ6DKL+C3SLil8y977D/IByRTRCOOKWciX/75HGHnevU2/RvBtwj cS/M0ZfcCnmyoRgYltcfbX0S22dBacdfHho4n+ALPS/IC+RTeFAaHL4rmu6Gu6CW TXVoffHN9sXHt1Alfnd55x8e0OKwhtSn5rycbkW0Gy0ANyLsvGY3OG/RZrR22E5K 2yrWkw== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5u9v9sr-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:51 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8c711251ac5so3609339685a.1 for ; Mon, 23 Feb 2026 02:06:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841211; x=1772446011; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=g2tOlerWd4OhWfCIFMbquts3zgLhKIvbzSHxskK9mKQ=; b=MhuGI7jmuQuotoaBkBxHUbiWzrGNAb4jEqiYr1WLEwsR8S7pHP7tLIG6Fxv5eko7V1 1s7rfZbHJkBMhTaRbaI5vzAE3CgnHosge47KCW0yNBwHdNfRLbRCnWedVox3b6G+nNEh ttc2BznUrQowu3N5e/U2+aa26hp9PR0kFDrIqd25NuKUHYzbgeHHsfpekIjVx3ff3clU LdF5EnSzPk7WTxxtYJxfU63IlkSxXDaqNCwjJcp963JskJ4SdxEd3fZWa+u7jmbKyTxF rnt6Kabiq46QPUNjCDNDKAZIycVmHR9RQDnBEUxyNUWXyp2j9ZwLzUJ/gVNmspORmyYw N7aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841211; x=1772446011; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=g2tOlerWd4OhWfCIFMbquts3zgLhKIvbzSHxskK9mKQ=; b=MMCexAsmtRCSW6i4v3jem9sYiU/VboZvaOhLYz7tLL7TbCYftZUI8qPrT9u4Hi74vU SzRd/9zSisKpLBSKQx2DaOTr77dVuOOUs7Sk2R0za0/tWHBx8DW5mYi5F+khzisGDcjw gZBAhrwJBU7blOI0zWqqTMUMBjXcF8H6mOBRE0MMN2tdcestKWNRgZL4wKy+EsGFDmBM 4ZYcFgSEWgjHkOm0zKdSHzu4vdaHP6Pftg9ZkjClUzSN+puGdQPiUpAMouytkg90r8cq fPH2Ol4fyGTXwgWfaQFToidjo7NIhZbaMonH1xNvEAfIngf9zfRCsERiAY2KtxbDCI9S UqZw== X-Gm-Message-State: AOJu0Yx3ywuZ1next3nxs24gQYOZuMY1bP4IAT/Z+GQBSYDryX+L81tW Rq07PtTbZthaJobY715ks2N/IsC/yHicmn93/CvPptvnKbgbK7r5xPXqCPcLVJGkogqWE8DU2Rd VMpsxhPM0QF0Yi1JR0hToFd0VhzZ6hJFxJjWtOsDjd9YHZro0zZnNgzJ1l9XHEyTtchrRfvCVox I= X-Gm-Gg: AZuq6aKkbSj2HtT3s9Je6C1iX9Gpk2Gl33C1NccatMLbg8BC5QfoBUVtLzI/DaMrXse hAefaY8Jme/i4Wpgw8dbgAuu9B2WlrsJr1qGhOBrritbMon2Mg7PeqDxtn7pmBy02YOUaFhgtxn 4UBTpySkJCurBdJTUTpBd33MKhrKLZsygJ6DSmi55BADQ1H5pDq/fxE4kRzhsGQr93mX3a66XFK fbYuvx9EVYPBcX4TvKcr72AiODjARsORg9omsWi6IaR2CfTxwz4sqA9U+zy3LTAAuCIuKem9zNV HkG18CLrplp9gNbGBN4Wuev+hqAqqmXaW8yz3Z2UvOHGPBTEU8dA4DLR1ELdropEuUYVhUp0rol 9XVQ+DNKnZz9HuFavBwZv5x7vlaJix6FajhJVfTRA0aQtGjtBPGBy X-Received: by 2002:a05:620a:4542:b0:8cb:49e8:d465 with SMTP id af79cd13be357-8cb8c9cdf1amr1003567285a.1.1771841211178; Mon, 23 Feb 2026 02:06:51 -0800 (PST) X-Received: by 2002:a05:620a:4542:b0:8cb:49e8:d465 with SMTP id af79cd13be357-8cb8c9cdf1amr1003564585a.1.1771841210677; Mon, 23 Feb 2026 02:06:50 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:50 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:25 +0100 Subject: [PATCH v2 12/14] reset: convert the core API to using firmware nodes 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: <20260223-reset-core-refactor-v2-12-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=11270; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=5iIYYjHPNq5p0+kaAniTf6969MKCe1l8k6ebZsiec14=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCaqmYmqTdgwEuwu9Z4M6CLq1UYsnL20VX4jr NTcCcGNMPWJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmqgAKCRAFnS7L/zaE w20xD/0TGHwWYLZrD5gkwti7WAEGz4+UyF+8J0EJBXzGdP3+/N9K4nGPmZGWRkturA89yR4OZkG P/MMG/5ABb7R0Kw/F/B3RDF7CHwDoW0FUIRBZHZTSfgeRhSsBWUcr+QClKQzOyGJOKnDTk1SB+h cvjEfNriDJ9C9B1nrSWpIC49RDfdXZ0+lOpHlQZNDQa95OINAaUJWFUOIwZgH8+eZDPuzSdF37V OeycdTll0r0iI0WeXGPO5UE6WLAS9R5XC9Pjf2HrQAvpK+P/v9mEy50iSsSKe3Dini6itjw0df4 ZXWkIN2oJxwtqg1hqn+DiRC1uIHhXINcgPNpTBmVPSgjQUf0giC29Q/3XnWlCXFeWAwcjdUP4+F LuL9QqkenYUaoLlRosnjl0NN+MhvPwc9pN6uwcUAfqQka+3vaeQC8h80g1Xc+qBJfTN9nAPjUOg u/b/IVlbomV2mIHK44hEeCLzhmIt8DjBFwUGhFafLyg5LTjjorwTcukL38LvigsEC0IZlPpaM0t FbwkJnBXs4PYErXU8nPnDgywDW064b0s0gEvicFFzYvJVz1K2wfuEewxXiaYWCWnPjbljZyS4N6 ytNIFhvzACeO35Ov69D34Vmw1fK4fY4C33X6ba9i4C6ssQ36szZf8MQ7tAnvdOQiwGigMsyRb20 Nhokme1OW+PqeUA== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfX1NOFCEnwIM5g K492jI68tN7MEWwe4OzsT81eTuRXFgI7nl4bwct64EYPgH9Kwk6CYGQp2X2VhHTSmDztV+aTYjg PAHkYKQ2Mctqd71J1wvli5k7zhDj5VA/5qN7g0RTID/ViyjDUz8c729Zuor9gkz3KYPnX/DDarZ Ns67oE8yH5n3jplF6vch8FJ/igYSn/L5f7fsyqF+w6D2RjFWZrUjiMi//kP41BxQKtXRMdfCm3C W9IgLekprvBT4vGZdl6shFZCHTxfbrYlN9KsLcozKH1yFle/idZuMinV++FdEM+5pUjTo4iSSnY pl086heIH9CTPeLtmSbf0RGWfYru7ogsySTJQ5flrcYCPNhLJ160VVRjLFvFkjB225CWGyK7hvz NpoMdPujBpKm9hcjmXNvoONx3oYAH1BhRj5Rg/d7jUj9nniBZNbwoqKs0Z58slY9iaHDA/0w9r9 p5CIeNrX8cDuuFISv2g== X-Proofpoint-GUID: wWfmMtFGLavENmQvH9bRckf3ZQoBf3Oj X-Proofpoint-ORIG-GUID: wWfmMtFGLavENmQvH9bRckf3ZQoBf3Oj X-Authority-Analysis: v=2.4 cv=RpDI7SmK c=1 sm=1 tr=0 ts=699c26bc cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=jmokhBh6uMhyoXQoT5cA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 adultscore=0 suspectscore=0 clxscore=1015 spamscore=0 bulkscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 In order to simplify the commit converting the internals of reset core to using firmware nodes, first convert the user-facing API. Modify the signature of the core consumer functions but leave the specialized wrappers as is to avoid modifying users for now. No functional change intended. Signed-off-by: Bartosz Golaszewski Reviewed-by: Philipp Zabel --- drivers/reset/core.c | 33 ++++++++++++++++++--------------- include/linux/reset.h | 43 ++++++++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 30 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index b215f5a4aab3f7b625b35d183068633c9c581067..1ac68371b77101b18db5a16c647= 1cfffee0dce7c 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -1047,7 +1047,7 @@ static int __reset_add_reset_gpio_device(struct devic= e_node *np, rgpio_dev->of_args =3D *args; /* * We keep the device_node reference, but of_args.np is put at the end - * of __of_reset_control_get(), so get it one more time. + * of __fwnode_reset_control_get(), so get it one more time. * Hold reference as long as rgpio_dev memory is valid. */ of_node_get(rgpio_dev->of_args.np); @@ -1101,18 +1101,19 @@ static struct reset_controller_dev *__reset_find_rc= dev(const struct of_phandle_a } =20 struct reset_control * -__of_reset_control_get(struct device_node *node, const char *id, int index, - enum reset_control_flags flags) +__fwnode_reset_control_get(struct fwnode_handle *fwnode, const char *id, i= nt index, + enum reset_control_flags flags) { bool optional =3D flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL; bool gpio_fallback =3D false; + struct device_node *node =3D to_of_node(fwnode); struct reset_control *rstc =3D ERR_PTR(-EINVAL); struct reset_controller_dev *rcdev; struct of_phandle_args args; int rstc_id; int ret; =20 - if (!node) + if (!fwnode) return ERR_PTR(-EINVAL); =20 if (id) { @@ -1179,7 +1180,7 @@ __of_reset_control_get(struct device_node *node, cons= t char *id, int index, =20 return rstc; } -EXPORT_SYMBOL_GPL(__of_reset_control_get); +EXPORT_SYMBOL_GPL(__fwnode_reset_control_get); =20 struct reset_control *__reset_control_get(struct device *dev, const char *= id, int index, enum reset_control_flags flags) @@ -1187,12 +1188,13 @@ struct reset_control *__reset_control_get(struct de= vice *dev, const char *id, bool shared =3D flags & RESET_CONTROL_FLAGS_BIT_SHARED; bool acquired =3D flags & RESET_CONTROL_FLAGS_BIT_ACQUIRED; bool optional =3D flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL; + struct fwnode_handle *fwnode =3D dev_fwnode(dev); =20 if (WARN_ON(shared && acquired)) return ERR_PTR(-EINVAL); =20 - if (dev->of_node) - return __of_reset_control_get(dev->of_node, id, index, flags); + if (fwnode) + return __fwnode_reset_control_get(fwnode, id, index, flags); =20 return optional ? NULL : ERR_PTR(-ENOENT); } @@ -1454,23 +1456,24 @@ static int fwnode_reset_control_get_count(struct fw= node_handle *fwnode) } =20 /** - * of_reset_control_array_get - Get a list of reset controls using - * device node. + * fwnode_reset_control_array_get - Get a list of reset controls using + * a firmware node. * - * @np: device node for the device that requests the reset controls array + * @fwnode: firmware node for the device that requests the reset controls = array * @flags: whether reset controls are shared, optional, acquired * * Returns pointer to allocated reset_control on success or error on failu= re */ struct reset_control * -of_reset_control_array_get(struct device_node *np, enum reset_control_flag= s flags) +fwnode_reset_control_array_get(struct fwnode_handle *fwnode, + enum reset_control_flags flags) { bool optional =3D flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL; struct reset_control_array *resets; struct reset_control *rstc; int num, i; =20 - num =3D fwnode_reset_control_get_count(of_fwnode_handle(np)); + num =3D fwnode_reset_control_get_count(fwnode); if (num < 0) return optional ? NULL : ERR_PTR(num); =20 @@ -1480,7 +1483,7 @@ of_reset_control_array_get(struct device_node *np, en= um reset_control_flags flag resets->num_rstcs =3D num; =20 for (i =3D 0; i < num; i++) { - rstc =3D __of_reset_control_get(np, NULL, i, flags); + rstc =3D __fwnode_reset_control_get(fwnode, NULL, i, flags); if (IS_ERR(rstc)) goto err_rst; resets->rstc[i] =3D rstc; @@ -1497,7 +1500,7 @@ of_reset_control_array_get(struct device_node *np, en= um reset_control_flags flag =20 return rstc; } -EXPORT_SYMBOL_GPL(of_reset_control_array_get); +EXPORT_SYMBOL_GPL(fwnode_reset_control_array_get); =20 /** * devm_reset_control_array_get - Resource managed reset control array get @@ -1521,7 +1524,7 @@ devm_reset_control_array_get(struct device *dev, enum= reset_control_flags flags) if (!ptr) return ERR_PTR(-ENOMEM); =20 - rstc =3D of_reset_control_array_get(dev->of_node, flags); + rstc =3D fwnode_reset_control_array_get(dev_fwnode(dev), flags); if (IS_ERR_OR_NULL(rstc)) { devres_free(ptr); return rstc; diff --git a/include/linux/reset.h b/include/linux/reset.h index 44f9e3415f92c9d7591b898cdb4bf7f05f2b0568..9c391cf0c82298a06a4d84eebd2= 93864ef8c48da 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -5,10 +5,12 @@ #include #include #include +#include #include =20 struct device; struct device_node; +struct fwnode_handle; struct reset_control; =20 /** @@ -84,7 +86,7 @@ int reset_control_bulk_deassert(int num_rstcs, struct res= et_control_bulk_data *r int reset_control_bulk_acquire(int num_rstcs, struct reset_control_bulk_da= ta *rstcs); void reset_control_bulk_release(int num_rstcs, struct reset_control_bulk_d= ata *rstcs); =20 -struct reset_control *__of_reset_control_get(struct device_node *node, +struct reset_control *__fwnode_reset_control_get(struct fwnode_handle *fwn= ode, const char *id, int index, enum reset_control_flags flags); struct reset_control *__reset_control_get(struct device *dev, const char *= id, int index, enum reset_control_flags flags); @@ -103,7 +105,8 @@ int __devm_reset_control_bulk_get(struct device *dev, i= nt num_rstcs, =20 struct reset_control *devm_reset_control_array_get(struct device *dev, enum reset_control_flags flags); -struct reset_control *of_reset_control_array_get(struct device_node *np, e= num reset_control_flags); +struct reset_control *fwnode_reset_control_array_get(struct fwnode_handle = *fwnode, + enum reset_control_flags); =20 int reset_control_get_count(struct device *dev); =20 @@ -152,8 +155,8 @@ static inline int __device_reset(struct device *dev, bo= ol optional) return optional ? 0 : -ENOTSUPP; } =20 -static inline struct reset_control *__of_reset_control_get( - struct device_node *node, +static inline struct reset_control *__fwnode_reset_control_get( + struct fwnode_handle *fwnode, const char *id, int index, enum reset_control_flags flags) { bool optional =3D flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL; @@ -242,7 +245,7 @@ devm_reset_control_array_get(struct device *dev, enum r= eset_control_flags flags) } =20 static inline struct reset_control * -of_reset_control_array_get(struct device_node *np, enum reset_control_flag= s flags) +fwnode_reset_control_array_get(struct fwnode_handle *fwnode, enum reset_co= ntrol_flags flags) { bool optional =3D flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL; =20 @@ -500,7 +503,8 @@ reset_control_bulk_get_optional_shared(struct device *d= ev, int num_rstcs, static inline struct reset_control *of_reset_control_get_exclusive( struct device_node *node, const char *id) { - return __of_reset_control_get(node, id, 0, RESET_CONTROL_EXCLUSIVE); + return __fwnode_reset_control_get(of_fwnode_handle(node), id, 0, + RESET_CONTROL_EXCLUSIVE); } =20 /** @@ -520,7 +524,8 @@ static inline struct reset_control *of_reset_control_ge= t_exclusive( static inline struct reset_control *of_reset_control_get_optional_exclusiv= e( struct device_node *node, const char *id) { - return __of_reset_control_get(node, id, 0, RESET_CONTROL_OPTIONAL_EXCLUSI= VE); + return __fwnode_reset_control_get(of_fwnode_handle(node), id, 0, + RESET_CONTROL_OPTIONAL_EXCLUSIVE); } =20 /** @@ -545,7 +550,8 @@ static inline struct reset_control *of_reset_control_ge= t_optional_exclusive( static inline struct reset_control *of_reset_control_get_shared( struct device_node *node, const char *id) { - return __of_reset_control_get(node, id, 0, RESET_CONTROL_SHARED); + return __fwnode_reset_control_get(of_fwnode_handle(node), id, 0, + RESET_CONTROL_SHARED); } =20 /** @@ -562,7 +568,8 @@ static inline struct reset_control *of_reset_control_ge= t_shared( static inline struct reset_control *of_reset_control_get_exclusive_by_inde= x( struct device_node *node, int index) { - return __of_reset_control_get(node, NULL, index, RESET_CONTROL_EXCLUSIVE); + return __fwnode_reset_control_get(of_fwnode_handle(node), NULL, index, + RESET_CONTROL_EXCLUSIVE); } =20 /** @@ -590,7 +597,8 @@ static inline struct reset_control *of_reset_control_ge= t_exclusive_by_index( static inline struct reset_control *of_reset_control_get_shared_by_index( struct device_node *node, int index) { - return __of_reset_control_get(node, NULL, index, RESET_CONTROL_SHARED); + return __fwnode_reset_control_get(of_fwnode_handle(node), NULL, index, + RESET_CONTROL_SHARED); } =20 /** @@ -1032,30 +1040,35 @@ devm_reset_control_array_get_optional_shared(struct= device *dev) static inline struct reset_control * of_reset_control_array_get_exclusive(struct device_node *node) { - return of_reset_control_array_get(node, RESET_CONTROL_EXCLUSIVE); + return fwnode_reset_control_array_get(of_fwnode_handle(node), + RESET_CONTROL_EXCLUSIVE); } =20 static inline struct reset_control * of_reset_control_array_get_exclusive_released(struct device_node *node) { - return of_reset_control_array_get(node, RESET_CONTROL_EXCLUSIVE_RELEASED); + return fwnode_reset_control_array_get(of_fwnode_handle(node), + RESET_CONTROL_EXCLUSIVE_RELEASED); } =20 static inline struct reset_control * of_reset_control_array_get_shared(struct device_node *node) { - return of_reset_control_array_get(node, RESET_CONTROL_SHARED); + return fwnode_reset_control_array_get(of_fwnode_handle(node), + RESET_CONTROL_SHARED); } =20 static inline struct reset_control * of_reset_control_array_get_optional_exclusive(struct device_node *node) { - return of_reset_control_array_get(node, RESET_CONTROL_OPTIONAL_EXCLUSIVE); + return fwnode_reset_control_array_get(of_fwnode_handle(node), + RESET_CONTROL_OPTIONAL_EXCLUSIVE); } =20 static inline struct reset_control * of_reset_control_array_get_optional_shared(struct device_node *node) { - return of_reset_control_array_get(node, RESET_CONTROL_OPTIONAL_SHARED); + return fwnode_reset_control_array_get(of_fwnode_handle(node), + RESET_CONTROL_OPTIONAL_SHARED); } #endif --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 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 2E02635FF73 for ; Mon, 23 Feb 2026 10:06:53 +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=1771841216; cv=none; b=POFuzUSu3Fdp0KgTthyJ/tZw7oOO1A3Ebl7VXHe3xzDUCdx+5eoeNaHDpm1+KmxKyOqBdtDu3Cc5e9AVQKuFYLWwXdaHa8icE7E+tuBiOkhycI9PJ+ma0I5F+i1JTgVhIG1jGuGDfvv+ZPZ7pJ6Ryo/HUU6X3czvDvpMTvFTXfA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841216; c=relaxed/simple; bh=jum6Qho+wp9sD55zthJFwhWw/JVxWHj7gRydsVtAeno=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KPUawfQ43RzCEyTwEkO6L9vvi7+ZO/Br6qEaFpLlEgJKde1AYjWosn9wTFCju0+8HLcTql/h0nD0SUQdJSvCbB9gHdJ/oNNJe6K+A1/d/tsj7tFV2DdO5o0LOc4Ua0CS5J5JDAwwJ3kc/GxbDyNP9l3w6IlEGq/YlaxgNumWGso= 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=kouCVdFY; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=c0Jav1vU; 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="kouCVdFY"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="c0Jav1vU" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N8csZ01857015 for ; Mon, 23 Feb 2026 10:06:53 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= 9CYcjONxBsNvTa+zYyCl8Cx7PqH2W10kWCvU/1Yb+a8=; b=kouCVdFY+cXOR+zm iHn3h3CpCONYnU11I8X/CS+X+4dTqGzNR1Ta7080oNpnZEKPW425c2obCYUNcmHQ X/KuqAsHcBu5Qw2XwzKLGBY8OojY7G1foWOq+sftA2Oc8yH2JLR87/pOu2R1MiVq Oho3uqLkLUIwHBS3BTaH20zlEOM0Ro5ONwMPnhh7R+YSrhYCzalM+LU5PsPXR3/L p7toUhhCLUvYuf2xgpmsKqirNkYHLhqgEim6G/jThWOjpKuu2mps9DYfl+0UCRKD ZF03l7TWbSgwnM0O+ZLsR6zr8rgCUKeBQZpJ295qPt9GKwxvxcEJVvECFYkMoWHy 2yCBYw== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5vgvba1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:53 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8cb37db8b79so1409131485a.3 for ; Mon, 23 Feb 2026 02:06:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841212; x=1772446012; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=9CYcjONxBsNvTa+zYyCl8Cx7PqH2W10kWCvU/1Yb+a8=; b=c0Jav1vUYWPN1jmMJ7eKXcQCVC9WKdlLxK7ddjeHoyGu5Mi2jzE2mD6iw59mHrBPbh dsSyvrs9DqKapR26Ur3ZF4wogrfs+bP4wrtMTSqqC+gryFUyDjDr0y7oqkIEW7C7Aalv mJh7ZmEXxSFKGQ6JlPReiV9IoY6CPOy+6qCS7lAlzDmEjCFcjfyJDwd3QG2LNDE3v9ep v8RuU4fF67JvKn30PnfxuTJLPhgdbvIU0KdNUzDwOJ0UoNVf8fIhb21rU8isS0U2gdS+ QXnpBnRRmrfbRzV2MHDINnZNYSqc+wMjstieaS5wMt2A5fObeQeXE+nJe8nHbWG3hkL0 7M0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841212; x=1772446012; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9CYcjONxBsNvTa+zYyCl8Cx7PqH2W10kWCvU/1Yb+a8=; b=bf+iqsEK5YjjzcA8SZSZKt5UwOvd7Ib4X71qEc5e7IrxET1gaTsXmVqyF3y0eJ0olq u3mL96QZ2g0eaqfc+M7rFmhFHwR1a5lN6N/0/SHMPQMPwV2ugwK6e8HgYKYxGpRv9BrZ 4I3GfW1TiOFVh8F6Wf0kvBGEVaxG0UN3B+JE0EdKS5Mi/nsvINfHwA0ClVmVHy1JCz1e 4edNrUJCU7dg6//zhp+tcuBZLXJRXKtskMIbSpR+mkjYtHPg/lmME1TQnjy2tToN8wuJ YBkD84bM05MHuMz7vJlUoGAXyqOJh/pRIhHNXU7dSYelP6fzeCWA7GOxG4AoCQc45Q6+ 4pCQ== X-Gm-Message-State: AOJu0YxptRx+luPd2kqnvx9+Aw6sll8twjr13VamJKAjzIY5T5UENuNi yyIo/6WWgWOi+8X7p0uGLmXolyiJ8pR6QuZdC4JutukjkUeeMv2dyGQSKo2ucYdNbNZpHLbu1Nz QaV02Bn/ghRm0ZgeWIYjFTHyOp8SO3xNUOQlkemMLvkfzmHjTCZq2SQEXpSeGXTJVW2k= X-Gm-Gg: AZuq6aJyK5tH8YGp8jM+KK2XAOsWRQLVzsPrCVDr316QJ5ZOJkLWKnfntyUnFzYStud yl/Yl3KA6uu/zuIAPcMsatVi4etQRsyNJvRxHkP/mLTITsxlqarravG01dQzjVxl8XvZKrPzPiZ tl7J2IuMmiS3fYwPQbzyw3havuBr5rpLskPfqY0mLRJM7j57qlRx00uasbPWbzQw0+38B/iy3bv /9+tJdKyzQ7xViUey651HP/SrIv8J35VMjm6sWpjyBCD2ZLBV8hcHSFyi4vWeZqJAdw8jz3RZjU yce95nMB+lCQH6RVNIGut+mi9T/TpK8+4w3RePrpSdc8G77tKqqVVKAeW0otdOy3jlvShydbW2v v+7MZqkf+aelKd6sVpzAyq/m+5PvMrPvFUepsGISPlStTW+ej1FyI X-Received: by 2002:a05:620a:1927:b0:8c6:a8a6:e164 with SMTP id af79cd13be357-8cb8ca64fc7mr1018058785a.45.1771841212095; Mon, 23 Feb 2026 02:06:52 -0800 (PST) X-Received: by 2002:a05:620a:1927:b0:8c6:a8a6:e164 with SMTP id af79cd13be357-8cb8ca64fc7mr1018056085a.45.1771841211641; Mon, 23 Feb 2026 02:06:51 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:51 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:26 +0100 Subject: [PATCH v2 13/14] reset: convert reset core to using firmware nodes 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: <20260223-reset-core-refactor-v2-13-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=15369; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=jum6Qho+wp9sD55zthJFwhWw/JVxWHj7gRydsVtAeno=; b=owEBbQKS/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCarjvUpx2ZGaFo9jppQnyJsivuBQn76AuAEf feBXACKCAaJAjMEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmqwAKCRAFnS7L/zaE wzEDEACrENyyjBwtziDj1aynCfR/M9H2eiaTxB+GXK/Lw7eDKcnB3bYAQz2DgxDBOvS4EkwyHsZ xtbo762U23WuhRsWVSxT/NVi++7WLvuzgXOGqTnLHvoCbuwQVvB8tDc/Q/ymWrFFcGs1zBn/JdX uIoYpE3kPQSTf5pZdozuqlBO63+sc5cYlo+x8Px1n+HPcJBzNsHUCjYJ9JdbJkwXDdlCjjszY9b Jw86wJBb5Qt4LN3sZgCdCVgb5gTK4+KZUdQSDoNKza8G42HaWKw/qCPxzkMtiqToucNDBfGtrDP MTEIu+GR+YNnq9fLwzf2tjNiJf2fqleNF/AgapjlIml41KiGUK5FLHaKkP2WwXUVyU7sMoWs6zk BAJJoFEGQlSDAqfI/Eu6nvJLTLZ3Gz2lWCtCvhoxNjuMBtOao9x5y+CDIUSYTtLOdBetdeopFeO uWrQbvKQ2kJAIAoK/NglieGnuHwhJIGgVoIjHLw9RSFqiJTdkI80LO+va3w5IptJENBdEx+Vm6O JS2hBS9IZ4tkjmX5OvOuT50FTvc0RVYDvHiQ49P6nFWHTfUP5PN50vE/KnxibI4NCLxqLnZqs2A LJuaCdxsNTzACYH0kUSaDpHW2J72DfZZr39GmZK+dWbRkYQAyTrRky4TkkxHOGDEn5ocC8DI/Bx 2uaarZs077GZ8ww== X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfX6fXG39XjPxPi HrFlaS4JaAnYqHpySllmdwXyCCcp6kqo/h2nIZFF51P5uiMwLXi9nbUyVBH0/9a9Y2MUEA9SmL/ 4qIKDFn7CXLSa9KDJt8CtpHy3WQElfG1WIVma/pupryMhZ1GOtcNmUDRHR7u52VUwWf87h1Ms8s FDVCRAcuvPRBwKfjBlGCz3z4Q2nreBPsNZ+dgsM1AIzOqOKsoFY25h0qO2SzKrgSCW10rFidLuI 8m26T7shJFrCGl1bCh4wQ2mmYvFIMPOIEz2YDa524rOSRIYwZKO9YENigG8swQT6Ft9bmWux9xh tVRrSbxYzuxQrzHSFKUzJwKPnq1bJ0Ja/tQ1AsEYxcCZzJBqYjjpzWE5ZSCpuT8ZhWOQdKK3JIv +88zW1Z3ze/du4YG1NhHVrfTmK3250wT+06q6M3ilah+Yi9ntQKD6DXjfv+fKp20mS8asFA0Udy Uvy5Z/MFqaKAYtHbXJA== X-Authority-Analysis: v=2.4 cv=W+A1lBWk c=1 sm=1 tr=0 ts=699c26bd cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=EAxQ06SQvwH9g5cYwaQA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-GUID: zg1WVNXz-VK8tghl8uOMzBESaK68a4RY X-Proofpoint-ORIG-GUID: zg1WVNXz-VK8tghl8uOMzBESaK68a4RY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 With everything else now in place, we can convert the remaining parts of the reset subsystem to becoming fwnode-agnostic - meaning it will work with all kinds of firmware nodes, not only devicetree. To that end: extend struct reset_controller_dev with fields taking information relevant for using firmware nodes (which mirrors what we already do for OF-nodes) and limit using of_ APIs only to where it's absolutely necessary (mostly around the of_xlate callback). For backward compatibility of existing drivers we still support OF-nodes but firmware nodes become the preferred method. Signed-off-by: Bartosz Golaszewski --- drivers/reset/core.c | 154 +++++++++++++++++++++++------------= ---- include/linux/reset-controller.h | 14 +++- 2 files changed, 103 insertions(+), 65 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 1ac68371b77101b18db5a16c6471cfffee0dce7c..174b50eda01948bc697529a549c= f38bfca7180f8 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -81,13 +81,13 @@ struct reset_control_array { =20 /** * struct reset_gpio_lookup - lookup key for ad-hoc created reset-gpio dev= ices - * @of_args: phandle to the reset controller with all the args like GPIO n= umber + * @ref_args: Reference to the reset controller with all the args like GPI= O number * @swnode: Software node containing the reference to the GPIO provider * @list: list entry for the reset_gpio_lookup_list * @adev: Auxiliary device representing the reset controller */ struct reset_gpio_lookup { - struct of_phandle_args of_args; + struct fwnode_reference_args ref_args; struct fwnode_handle *swnode; struct list_head list; struct auxiliary_device adev; @@ -98,24 +98,24 @@ static const char *rcdev_name(struct reset_controller_d= ev *rcdev) if (rcdev->dev) return dev_name(rcdev->dev); =20 - if (rcdev->of_node) - return rcdev->of_node->full_name; + if (rcdev->fwnode) + return fwnode_get_name(rcdev->fwnode); =20 return NULL; } =20 /** - * of_reset_simple_xlate - translate reset_spec to the reset line number + * fwnode_reset_simple_xlate - translate reset_spec to the reset line numb= er * @rcdev: a pointer to the reset controller device - * @reset_spec: reset line specifier as found in the device tree + * @reset_spec: reset line specifier as found in firmware * - * This static translation function is used by default if of_xlate in + * This static translation function is used by default if fwnode_xlate in * :c:type:`reset_controller_dev` is not set. It is useful for all reset * controllers with 1:1 mapping, where reset lines can be indexed by number * without gaps. */ -static int of_reset_simple_xlate(struct reset_controller_dev *rcdev, - const struct of_phandle_args *reset_spec) +static int fwnode_reset_simple_xlate(struct reset_controller_dev *rcdev, + const struct fwnode_reference_args *reset_spec) { if (reset_spec->args[0] >=3D rcdev->nr_resets) return -EINVAL; @@ -129,9 +129,17 @@ static int of_reset_simple_xlate(struct reset_controll= er_dev *rcdev, */ int reset_controller_register(struct reset_controller_dev *rcdev) { - if (!rcdev->of_xlate) { - rcdev->of_reset_n_cells =3D 1; - rcdev->of_xlate =3D of_reset_simple_xlate; + if ((rcdev->of_node && rcdev->fwnode) || (rcdev->of_xlate && rcdev->fwnod= e_xlate)) + return -EINVAL; + + if (rcdev->of_node) { + rcdev->fwnode =3D of_fwnode_handle(rcdev->of_node); + rcdev->fwnode_reset_n_cells =3D rcdev->of_reset_n_cells; + } + + if (rcdev->fwnode && !rcdev->fwnode_xlate) { + rcdev->fwnode_reset_n_cells =3D 1; + rcdev->fwnode_xlate =3D fwnode_reset_simple_xlate; } =20 INIT_LIST_HEAD(&rcdev->reset_control_head); @@ -917,7 +925,7 @@ static int reset_create_gpio_aux_device(struct reset_gp= io_lookup *rgpio_dev, adev->id =3D id; adev->name =3D "gpio"; adev->dev.parent =3D parent; - adev->dev.platform_data =3D &rgpio_dev->of_args; + adev->dev.platform_data =3D &rgpio_dev->ref_args; adev->dev.release =3D reset_gpio_aux_device_release; device_set_node(&adev->dev, rgpio_dev->swnode); =20 @@ -937,18 +945,18 @@ static int reset_create_gpio_aux_device(struct reset_= gpio_lookup *rgpio_dev, return 0; } =20 -static void reset_gpio_add_devlink(struct device_node *np, +static void reset_gpio_add_devlink(struct fwnode_handle *fwnode, struct reset_gpio_lookup *rgpio_dev) { struct device *consumer; =20 /* - * We must use get_dev_from_fwnode() and not of_find_device_by_node() + * We must use get_dev_from_fwnode() and not ref_find_device_by_node() * because the latter only considers the platform bus while we want to * get consumers of any kind that can be associated with firmware * nodes: auxiliary, soundwire, etc. */ - consumer =3D get_dev_from_fwnode(of_fwnode_handle(np)); + consumer =3D get_dev_from_fwnode(fwnode); if (consumer) { if (!device_link_add(consumer, &rgpio_dev->adev.dev, DL_FLAG_AUTOREMOVE_CONSUMER)) @@ -968,15 +976,23 @@ static void reset_gpio_add_devlink(struct device_node= *np, */ } =20 +/* TODO: move it out into drivers/base/ */ +static bool fwnode_reference_args_equal(const struct fwnode_reference_args= *left, + const struct fwnode_reference_args *right) +{ + return left->fwnode =3D=3D right->fwnode && left->nargs =3D=3D right->nar= gs && + !memcmp(left->args, right->args, sizeof(left->args[0]) * left->nar= gs); +} + /* * @np: OF-node associated with the consumer - * @args: phandle to the GPIO provider with all the args like GPIO number + * @args: Reference to the GPIO provider with all the args like GPIO number */ -static int __reset_add_reset_gpio_device(struct device_node *np, - const struct of_phandle_args *args) +static int __reset_add_reset_gpio_device(struct fwnode_handle *fwnode, + const struct fwnode_reference_args *args) { struct property_entry properties[3] =3D { }; - unsigned int offset, of_flags, lflags; + unsigned int offset, flags, lflags; struct reset_gpio_lookup *rgpio_dev; struct device *parent; int ret, prop =3D 0; @@ -987,7 +1003,7 @@ static int __reset_add_reset_gpio_device(struct device= _node *np, * args[1]: GPIO flags * TODO: Handle other cases. */ - if (args->args_count !=3D 2) + if (args->nargs !=3D 2) return -ENOENT; =20 /* @@ -998,7 +1014,7 @@ static int __reset_add_reset_gpio_device(struct device= _node *np, lockdep_assert_not_held(&reset_list_mutex); =20 offset =3D args->args[0]; - of_flags =3D args->args[1]; + flags =3D args->args[1]; =20 /* * Later we map GPIO flags between OF and Linux, however not all @@ -1008,33 +1024,31 @@ static int __reset_add_reset_gpio_device(struct dev= ice_node *np, * FIXME: Find a better way of translating OF flags to GPIO lookup * flags. */ - if (of_flags > GPIO_ACTIVE_LOW) { + if (flags > GPIO_ACTIVE_LOW) { pr_err("reset-gpio code does not support GPIO flags %u for GPIO %u\n", - of_flags, offset); + flags, offset); return -EINVAL; } =20 struct gpio_device *gdev __free(gpio_device_put) =3D - gpio_device_find_by_fwnode(of_fwnode_handle(args->np)); + gpio_device_find_by_fwnode(args->fwnode); if (!gdev) return -EPROBE_DEFER; =20 guard(mutex)(&reset_gpio_lookup_mutex); =20 list_for_each_entry(rgpio_dev, &reset_gpio_lookup_list, list) { - if (args->np =3D=3D rgpio_dev->of_args.np) { - if (of_phandle_args_equal(args, &rgpio_dev->of_args)) { - /* - * Already on the list, create the device link - * and stop here. - */ - reset_gpio_add_devlink(np, rgpio_dev); - return 0; - } + if (fwnode_reference_args_equal(args, &rgpio_dev->ref_args)) { + /* + * Already on the list, create the device link + * and stop here. + */ + reset_gpio_add_devlink(fwnode, rgpio_dev); + return 0; } } =20 - lflags =3D GPIO_PERSISTENT | (of_flags & GPIO_ACTIVE_LOW); + lflags =3D GPIO_PERSISTENT | (flags & GPIO_ACTIVE_LOW); parent =3D gpio_device_to_device(gdev); properties[prop++] =3D PROPERTY_ENTRY_STRING("compatible", "reset-gpio"); properties[prop++] =3D PROPERTY_ENTRY_GPIO("reset-gpios", parent->fwnode,= offset, lflags); @@ -1044,43 +1058,43 @@ static int __reset_add_reset_gpio_device(struct dev= ice_node *np, if (!rgpio_dev) return -ENOMEM; =20 - rgpio_dev->of_args =3D *args; + rgpio_dev->ref_args =3D *args; /* - * We keep the device_node reference, but of_args.np is put at the end - * of __fwnode_reset_control_get(), so get it one more time. + * We keep the fwnode_handle reference, but ref_args.fwnode is put at + * the end of __fwnode_reset_control_get(), so get it one more time. * Hold reference as long as rgpio_dev memory is valid. */ - of_node_get(rgpio_dev->of_args.np); + fwnode_handle_get(rgpio_dev->ref_args.fwnode); =20 rgpio_dev->swnode =3D fwnode_create_software_node(properties, NULL); if (IS_ERR(rgpio_dev->swnode)) { ret =3D PTR_ERR(rgpio_dev->swnode); - goto err_put_of_node; + goto err_put_fwnode; } =20 ret =3D reset_create_gpio_aux_device(rgpio_dev, parent); if (ret) goto err_del_swnode; =20 - reset_gpio_add_devlink(np, rgpio_dev); + reset_gpio_add_devlink(fwnode, rgpio_dev); list_add(&rgpio_dev->list, &reset_gpio_lookup_list); =20 return 0; =20 err_del_swnode: fwnode_remove_software_node(rgpio_dev->swnode); -err_put_of_node: - of_node_put(rgpio_dev->of_args.np); +err_put_fwnode: + fwnode_handle_put(rgpio_dev->ref_args.fwnode); kfree(rgpio_dev); =20 return ret; } =20 -static struct reset_controller_dev *__reset_find_rcdev(const struct of_pha= ndle_args *args, - bool gpio_fallback) +static struct reset_controller_dev * +__reset_find_rcdev(const struct fwnode_reference_args *args, bool gpio_fal= lback) { + struct fwnode_reference_args *rc_args; struct reset_controller_dev *rcdev; - struct of_phandle_args *rc_args; =20 lockdep_assert_held(&reset_list_mutex); =20 @@ -1089,10 +1103,10 @@ static struct reset_controller_dev *__reset_find_rc= dev(const struct of_phandle_a device_is_compatible(rcdev->dev, "reset-gpio")) { rc_args =3D dev_get_platdata(rcdev->dev); =20 - if (of_phandle_args_equal(args, rc_args)) + if (fwnode_reference_args_equal(args, rc_args)) return rcdev; } else { - if (args->np =3D=3D rcdev->of_node) + if (args->fwnode =3D=3D rcdev->fwnode) return rcdev; } } @@ -1106,27 +1120,26 @@ __fwnode_reset_control_get(struct fwnode_handle *fw= node, const char *id, int ind { bool optional =3D flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL; bool gpio_fallback =3D false; - struct device_node *node =3D to_of_node(fwnode); struct reset_control *rstc =3D ERR_PTR(-EINVAL); struct reset_controller_dev *rcdev; - struct of_phandle_args args; - int rstc_id; + struct fwnode_reference_args args; + struct of_phandle_args of_args; + int rstc_id =3D -EINVAL; int ret; =20 if (!fwnode) return ERR_PTR(-EINVAL); =20 if (id) { - index =3D of_property_match_string(node, - "reset-names", id); + index =3D fwnode_property_match_string(fwnode, "reset-names", id); if (index =3D=3D -EILSEQ) return ERR_PTR(index); if (index < 0) return optional ? NULL : ERR_PTR(-ENOENT); } =20 - ret =3D of_parse_phandle_with_args(node, "resets", "#reset-cells", - index, &args); + ret =3D fwnode_property_get_reference_args(fwnode, "resets", "#reset-cell= s", + 0, index, &args); if (ret =3D=3D -EINVAL) return ERR_PTR(ret); if (ret) { @@ -1137,16 +1150,16 @@ __fwnode_reset_control_get(struct fwnode_handle *fw= node, const char *id, int ind * There can be only one reset-gpio for regular devices, so * don't bother with the "reset-gpios" phandle index. */ - ret =3D of_parse_phandle_with_args(node, "reset-gpios", "#gpio-cells", - 0, &args); + ret =3D fwnode_property_get_reference_args(fwnode, "reset-gpios", + "#gpio-cells", 0, 0, &args); if (ret) return optional ? NULL : ERR_PTR(ret); =20 gpio_fallback =3D true; =20 - ret =3D __reset_add_reset_gpio_device(node, &args); + ret =3D __reset_add_reset_gpio_device(fwnode, &args); if (ret) { - of_node_put(args.np); + fwnode_handle_put(args.fwnode); return ERR_PTR(ret); } } @@ -1159,15 +1172,30 @@ __fwnode_reset_control_get(struct fwnode_handle *fw= node, const char *id, int ind goto out_put; } =20 - if (WARN_ON(args.args_count !=3D rcdev->of_reset_n_cells)) { + if (WARN_ON(args.nargs !=3D rcdev->fwnode_reset_n_cells)) { rstc =3D ERR_PTR(-EINVAL); goto out_put; } =20 - rstc_id =3D rcdev->of_xlate(rcdev, &args); + if (rcdev->of_xlate && is_of_node(fwnode)) { + ret =3D of_parse_phandle_with_args(to_of_node(fwnode), + gpio_fallback ? "reset-gpios" : "resets", + gpio_fallback ? "#gpio-cells" : "#reset-cells", + gpio_fallback ? 0 : index, + &of_args); + if (ret) { + rstc =3D ERR_PTR(ret); + goto out_put; + } + + rstc_id =3D rcdev->of_xlate(rcdev, &of_args); + of_node_put(of_args.np); + } else if (rcdev->fwnode_xlate) { + rstc_id =3D rcdev->fwnode_xlate(rcdev, &args); + } if (rstc_id < 0) { rstc =3D ERR_PTR(rstc_id); - goto out_put; + goto out_put; } =20 flags &=3D ~RESET_CONTROL_FLAGS_BIT_OPTIONAL; @@ -1176,7 +1204,7 @@ __fwnode_reset_control_get(struct fwnode_handle *fwno= de, const char *id, int ind rstc =3D __reset_control_get_internal(rcdev, rstc_id, flags); =20 out_put: - of_node_put(args.np); + fwnode_handle_put(args.fwnode); =20 return rstc; } diff --git a/include/linux/reset-controller.h b/include/linux/reset-control= ler.h index 2fecb4edeba1a2b1f5f5db2b34c867362c5f9c18..2f7a1217d0ec6dba4f8831fb8c6= 6308188f7a339 100644 --- a/include/linux/reset-controller.h +++ b/include/linux/reset-controller.h @@ -5,6 +5,8 @@ #include #include =20 +struct fwnode_handle; +struct fwnode_reference_args; struct reset_controller_dev; =20 /** @@ -38,8 +40,12 @@ struct of_phandle_args; * @of_node: corresponding device tree node as phandle target * @of_reset_n_cells: number of cells in reset line specifiers * @of_xlate: translation function to translate from specifier as found in= the - * device tree to id as given to the reset control ops, defaults - * to :c:func:`of_reset_simple_xlate`. + * device tree to id as given to the reset control ops + * @fwnode: firmware node associated with this device + * @fwnode_reset_n_cells: number of cells in reset line specifiers + * @fwnode_xlate: translation function to translate from firmware specifie= r to + * id as given to the reset control ops, defaults to + * :c:func:`fwnode_reset_simple_xlate` * @nr_resets: number of reset controls in this reset controller device * @lock: synchronizes concurrent access to the structure's fields */ @@ -53,6 +59,10 @@ struct reset_controller_dev { int of_reset_n_cells; int (*of_xlate)(struct reset_controller_dev *rcdev, const struct of_phandle_args *reset_spec); + struct fwnode_handle *fwnode; + int fwnode_reset_n_cells; + int (*fwnode_xlate)(struct reset_controller_dev *rcdev, + const struct fwnode_reference_args *reset_spec); unsigned int nr_resets; struct mutex lock; }; --=20 2.47.3 From nobody Fri Apr 17 06:15:35 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 978643624A6 for ; Mon, 23 Feb 2026 10:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841216; cv=none; b=NL5whH1mvarlSwwqvkxFFgQLFRDTmWfbluUVC9253IzJ0hOVuQmY/7brhEVAEZMVF1kQnSz9KiQyPe/Mcl46ScRLyluVm5K8KcpCCfLUHhvZII+0wEiH40OumKdnNK/+Ks3lqHKaUq6LzGksewJMic4HFEV7fvYYXDJhBPJBdxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841216; c=relaxed/simple; bh=TO1jJr3+9igT2IhQEfgP0iCkimVDtjNZx9rm42v2+dE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O8qmoUtFoGD9q9AGjSUKosO7YXtzEkauzxZdyhfadEyLsjkyyWEBJ068eqvolFmLtYCDHm2dvGUVvJQl5v1K8JXEWoSwMrwKytdObWWTl0IM1zOKSduY8HW1+MirPfxPiEh2S+7V1f2794nTqltuDxufyJQo+70UVDZQ+l3kaCI= 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=kRfH2q7M; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PUwoOSye; arc=none smtp.client-ip=205.220.180.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="kRfH2q7M"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PUwoOSye" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61N9htx51778082 for ; Mon, 23 Feb 2026 10:06:53 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= Ni9Q7c7XuJWgX11XPBm8RXeNkeMCNgFiQWuxPog+lNg=; b=kRfH2q7MqFWttlD1 xNLx59V2TAT3YzRbxLWx5vqCxG2v8oLZbIGlYeqQBw7R/rcIOLvWPMMuznw2CGAp 75PhAb8iwnQtwKR1I1jv8eLLcffVJoNN3FvGvI0F9Lt+SpPp/SJmOO76j/M04Lk0 hOaVQpK/f6ImG1cgrb2epM1Sa83K+aN37TR5xsWRWIdmciyzZXxecAB23T6ffjrU QRBzbHm2tfr9cN/6Jn/hYRBtNT/5cfoEdNOvwvxSK1QTpiKMvNDPgYli521rtXjk t4DFLTbneXQ77hdgG3csKc5KQAE5QQHphK0V7GbOvwKHTy8s0OwwK7hJAoTEbzTS WEcxZQ== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cf5u9v9sw-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 10:06:53 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cb4a241582so3900118685a.0 for ; Mon, 23 Feb 2026 02:06:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771841213; x=1772446013; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Ni9Q7c7XuJWgX11XPBm8RXeNkeMCNgFiQWuxPog+lNg=; b=PUwoOSyewvbciM0NEg4hg2cmUurA8UGJ9fkui6IATq/Vk6Xs//ss9Cvmksupv2z2kQ NYz61e6/QhHVYKlWhCi/jtEzlYbw4yvYCK4mNqznT1sImkG0tHmBLcqzjucfRTaoCyaq Yir0xXV6efDRulhVkkqOevdquef9EqS8WJzbhc/SRqS2MyjwePOovlcShbHN3BnqUJ+Q OD0hnWdgqFUIBc7rApFBgk6AKleLRMelJaqIdU9hsIILEIHWTIbbbPdNhah+TTOmC5XS crmOFgL+r1U1Xb70MqFguryKZUkz1VzJxhCE3PboYtIva0fcNO1GcDeAvcvxsVn/ACzx kvKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841213; x=1772446013; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Ni9Q7c7XuJWgX11XPBm8RXeNkeMCNgFiQWuxPog+lNg=; b=ESm+6Xj8KsuTBjaobL0WAcqYViDbAJe/OHaPIP6qqjgom4wIxrHv72XAjHBdj3Ff/N IZfbYGsY02FjXRuUxjrIZk58s7UeodJs+sEiRJxUHwECzI6Z5spGSvNU9YAT+oden6Uy jSHKdI+y5Uwlxu58yuJYuTMDHGq7OKavpKXgNTUZA1jhEOyT/etlyFVHQd0E5pqLXrak SCjx8912Q0eGgPFHQSlW10oLrUL+x7Krse0gcTXvkSKy1fbUJ8sxaXSmB8pjvp3V3MNo 4bFmjecayl76VTHI/vyy6jl6dtnQl8p5rXAFeOnLOhVvyDp+q9sSulfg73ZKWS0W+lcD UOCw== X-Gm-Message-State: AOJu0YzCgv852U+eI758jHr1o8xOay5u9gqR0buqY/o2X2pHFzVPrQPV CXmiPjMYkNbA5s/rh47HiSov9Q1qNTdf9nz/xnVr/wV/hHTUnrX9jhj7CY4eJJghzRgTpwbl/ax CsknHJTx7rLXZCHmjBctaVDlSQYUaq9t1KOCxfu5QnP8EqoHqirOBKxlEfLNGoUklCJw= X-Gm-Gg: AZuq6aLLN9kSrH7DRHuE4x/jn8gkBiy25Gud2mWMvUM7h6eXLRv9Cos+e7RvLt4LLm3 +I8wGVR6ZjP4mWr6/A5KGom2LxBcNBj9Ogwkvy3yRH07iKmSh87WUodOnvdgLXf5d+Ujs2IRIrS 3SoUI9P1A5Sj3AIZTlnesrlOWqINoFGho6XmN5JTDMLfZhoHsdJn3chclS/91dhzJ/w5opz0ypN fgbL0mqket1cyMqQQxCwkC+IFrfsZ6RIrWKcHSmUwJG7S6XUwf+qPG83QAgYI5JOFHwpKF6evhg QBUETz46lCxtJ+1Sv7laaAC757zTsXn2a6HwRo1wrlkXp8Pm1oBhCf4hcLTVXNEaaCPTL85l01E VP1Rf5iVIY1LyYezuX3CKd5na9SUkHL4EWVapKgMk+06Eo0DKNTaO X-Received: by 2002:a05:620a:7012:b0:8cb:2b04:85fa with SMTP id af79cd13be357-8cb8c9cde82mr1013999585a.13.1771841212972; Mon, 23 Feb 2026 02:06:52 -0800 (PST) X-Received: by 2002:a05:620a:7012:b0:8cb:2b04:85fa with SMTP id af79cd13be357-8cb8c9cde82mr1013997585a.13.1771841212487; Mon, 23 Feb 2026 02:06:52 -0800 (PST) Received: from brgl-qcom.local ([2a01:cb1d:dc:7e00:bd71:422c:5e83:8b37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d54760sm18288885f8f.35.2026.02.23.02.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:06:52 -0800 (PST) From: Bartosz Golaszewski Date: Mon, 23 Feb 2026 11:06:27 +0100 Subject: [PATCH v2 14/14] reset: gpio: make the driver fwnode-agnostic 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: <20260223-reset-core-refactor-v2-14-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> In-Reply-To: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> To: Krzysztof Kozlowski , Philipp Zabel Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1666; i=bartosz.golaszewski@oss.qualcomm.com; h=from:subject:message-id; bh=TO1jJr3+9igT2IhQEfgP0iCkimVDtjNZx9rm42v2+dE=; b=owEBbAKT/ZANAwAKAQWdLsv/NoTDAcsmYgBpnCarW1b51kEBdGfyXM3DIdzqCNBAWuEtUNiY9 y+p7fRSSKOJAjIEAAEKAB0WIQSR5RMt5bVGHXuiZfwFnS7L/zaEwwUCaZwmqwAKCRAFnS7L/zaE wz00D/dW202fOGXLMueLVSoCnsxUFWI2evrFHMA0kUFGlAU9a1sdpOmYuXBDFgg+h4GW2FpfFpY G2M2+jeDKHAV9jUof89NxybIDuhadCZyg0yHfQdPalWwtgsbkoklmkK7nAjTlUJJ7F/Cg1rnWyv L6zfXih/o6nSo+m5q2LVoZFTQ1GlJYUtgcazgoS3UwR4aSDfVGk0cAusgz0CykTDluK6QsdnmqH ZFw5buxmQ52kEyCWS+RZlfaFcvXQ3cNwo2dl1Sn0LZAfV6C74lnzfKVKTzhNtiFZ8syrmLfVuiV v7V7ykEED2T9XlusClwOQqbW+PYygnp4ao/MH5BGoV/FzWbMGGGJjnfYXIsIIE78dUNBQOgn7c6 xJKi2SL/YBIGldSuZjvJoGlZD+NGG/z57G1p6EI6TzN7rDLNWcq9ajiuLmXnVE13nNLbwBwqO+1 +yNkBJibIMiqQDvcbJQaljNqG2oOvFfKWRf1QlZPx9tb1BPSccF3BbhRVD0PyWTPpcEpFtXrU3n fvprtwSsx4MRfeMoV44dl2PDGgqIpgyP0jdkZeI+1q2/4FfLjtQSnDUKjBEFaASfV/9Tmwaj4+2 EWsv/yI3lji89NyM//bIUWXb+SbKTJnZ50JvgieacMptG2Y3+um7gRXgE12WZOIfVK+Y+mNIxrp wftzTSYy36gEm X-Developer-Key: i=bartosz.golaszewski@oss.qualcomm.com; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDA4NiBTYWx0ZWRfX6hVBTdnGqzP0 /UIL3ZtnDq4LQTBsK8VQVAOzRiDNi95Mz1RoN9xXr6Prl/11XvmR2z6OoIj+lR7zCzboBtGvP60 ETZngY1WRDYyvxs/S7uLglQ1ET2pivzyl4qCkliA26eZQQNA3cYjGGrtrimm8dX30Jh4asunOzT cbSc+rF/BCIHkcMjSIeqgVTZftenkMagGrKoinLTIKn+aeZmB7RirSJT73yQ4lADTSCuFAqK9Pu gUXR3saHK1vcFwokZcDFOoAnr/Dk5HYe/D8U5A/zm2v1lGde1Z0wHuzzmHSAv8U4KwN4DQy/k+n 5HzflIiU/9kWjKwB7QQe5to3HDpcaFb2qTjzHb3udG5jUXF6reLWlzokUnfOxJgyFWvEef7D3CA NZYdxAplbakoaFtB6onuGrrgvRS7Jk+/5vi9uUUBdmF9bSMzWJMVhLWQb/Plmj49iiJeGL40PRF 1Z/7cZzOiWcUgNmudQQ== X-Proofpoint-GUID: 7dG2ORbGhuXSZRgNBHMCzNrQfyE-JmAG X-Proofpoint-ORIG-GUID: 7dG2ORbGhuXSZRgNBHMCzNrQfyE-JmAG X-Authority-Analysis: v=2.4 cv=RpDI7SmK c=1 sm=1 tr=0 ts=699c26bd cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=3hQubXxqK_WyehwcTsYA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-23_02,2026-02-20_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 adultscore=0 suspectscore=0 clxscore=1015 spamscore=0 bulkscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230086 With reset core now being able to work with firmware nodes, we can make reset-gpio node-agnostic and drop any OF dependencies. Signed-off-by: Bartosz Golaszewski Reviewed-by: Philipp Zabel --- drivers/reset/reset-gpio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/reset/reset-gpio.c b/drivers/reset/reset-gpio.c index 5044f809d0e59a08861597f4aeb685e95328c2af..e0f07a197226e1143485a7e16c9= e247ade6e15db 100644 --- a/drivers/reset/reset-gpio.c +++ b/drivers/reset/reset-gpio.c @@ -2,9 +2,9 @@ =20 #include #include +#include #include #include -#include #include =20 struct reset_gpio_priv { @@ -46,8 +46,8 @@ static const struct reset_control_ops reset_gpio_ops =3D { .status =3D reset_gpio_status, }; =20 -static int reset_gpio_of_xlate(struct reset_controller_dev *rcdev, - const struct of_phandle_args *reset_spec) +static int reset_gpio_fwnode_xlate(struct reset_controller_dev *rcdev, + const struct fwnode_reference_args *reset_spec) { return reset_spec->args[0]; } @@ -72,8 +72,8 @@ static int reset_gpio_probe(struct auxiliary_device *adev, priv->rc.dev =3D dev; =20 /* Cells to match GPIO specifier, but it's not really used */ - priv->rc.of_reset_n_cells =3D 2; - priv->rc.of_xlate =3D reset_gpio_of_xlate; + priv->rc.fwnode_reset_n_cells =3D 2; + priv->rc.fwnode_xlate =3D reset_gpio_fwnode_xlate; priv->rc.nr_resets =3D 1; =20 return devm_reset_controller_register(dev, &priv->rc); --=20 2.47.3