From patchwork Mon Aug 26 10:07:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00D33C5321E for ; Mon, 26 Aug 2024 10:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=U/DdzSA0vze8jJF7vX2SLvT3UgFzgudCA7IbUx1PMAI=; b=c25hstkXsdVcLQLmj49vuWTHVv yx4JO/GOp3pcXubv9adUdYoWSAplmo5cn/+1DRbP0QZlTqWF5xmWWzX2wussLpeGItqXln++7Orfa LwArSxa6GCCO8w0CfvzG2uc4x8+jC1roKaNcPzBvo65v+Eg2nfZ3fNvaDDY07biKxPTsVL5whd13G 3gUuTIL8hOO3h8wzLeCKnOZ4sxUPJIGhQ0L3I2urdrsGts5qlufH8+kmTiJsd+lHS48eHdEJqxP+t cEGrrZmL+jZAEzXSxLOqDhRFKky00ylt4MlWDJ+ZydUy6GqXuMiZDhRGxER7W6OJB4wxYdaxb/R8z bOaZ/mJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWgd-00000006rgT-2QMS; Mon, 26 Aug 2024 10:10:59 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdT-00000006qfe-2K14 for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=U/DdzSA0vze8jJF7vX2SLvT3UgFzgudCA7IbUx1PMAI=; b=ZxZrCSrvxs1w1VFMYt/BiIBhzl EkpIEq9OKL33TZlXReo5cUpMQiUrudys1bhfY797vmfMpKDHLEKoicO9GSvuel3R8hYQiWnDjKD0e fJkbT9tb2Y9YKzEScS9ZXwU5jhn7Ah/cooLRM5+Qmzh3U+sA3FBnKTLnxWJVRQQlzdDsdMpgl71bu qRY7E+Vd0bpMRPKFNEtVdCEslZa3aUeemH01RL09ZTSL3mb/S/UTG3Agu/z2xdVY9mia9+iznC7x5 gfSvucQ4Bz+RVUSxwjBOOz255yoXVKm4b88y7GR3ccbLCa2T8OmTH8dEWTxioP30ZYn44NeIPDotU 7h3baa+w==; Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdO-0000000Ad6K-10AJ for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:42 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4280772333eso6335775e9.0 for ; Mon, 26 Aug 2024 03:07:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666854; x=1725271654; darn=lists.infradead.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=U/DdzSA0vze8jJF7vX2SLvT3UgFzgudCA7IbUx1PMAI=; b=j6t+eGS8Kg81wPwEG6D8uV/5y9952h2pRhA3uiv1v36k0dBwOdFNPJWFtcBEEqToI4 wvlJSW3u+IqWVWmCs1b6NjF+TAevMjXk9rifuqCCOWJyRiQ3ubEpvDUVHO84XXwSK63E BCbuRtiOfUktZnsxtTjremeQJMz0vTz7+1NEE+EYlAwl5CX/WpjMsAp2XVsBPv/ks1RJ xrnV8Fb+rhb2EwRqVgBjvSXMMgbwzqjcR+iaVyBoF6x1QMCCCP4+UrW+Pq9ouK4FZMvr ir6hQn3IEx7YRVptkl9PZNAZgRIGlGS7/OGtXUNFdfPkvU+GchRCXjOChcrdY6DB4gCT 44NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666854; x=1725271654; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U/DdzSA0vze8jJF7vX2SLvT3UgFzgudCA7IbUx1PMAI=; b=kExn0UqisIOAPoU1PlorBQNDWHXISiucIPNDXmuvJdorj2HjEWs6rnY2bwEOy95Lt+ qj6pcxlAuMTxwc9+WC2VhKtN3K/SSrzvnxW3ZHO5kBNkKgSGMJAOXqrBi6miK70rVvaw 7cKh/DhDZnlMEAmYwkJH4sNTiDOlbKD1xMsppO7Ffc4hyXE7W8rV6d9g/oztSPIJY1J9 ryszMF6ZFwekxRelqeZnx9BPsz0uuJx8vXVKacf8965MxTBiftNT96G8LnGW8+EpyK8O jiFAm2EkzN9isWXe3QEyMtbGRv+EaNjSqxxO/dUWPdOhpYyp1KFW1yShtZv5HJsEZbhh vtcA== X-Forwarded-Encrypted: i=1; AJvYcCWnPgW/RN4LtSzMi2HkPSe/tHm8uE9Yh1qPuNmYd/LPCPrjxoLzZI7Y1lABMuZDNtD1Tg3aNIRkhcyeOskzc1u0@lists.infradead.org X-Gm-Message-State: AOJu0YzUHBTl29FUHkb09WepJsi1GYFxvmwmUkg8j7Bsmi1ArujDlfGe MNPS2n8zOSMNoKCDrTzugGpuJS+vPP90QKtkZAxpK0K86PbKLtV+9/5rfjQYn/EH0tU6aXJsJ5b + X-Google-Smtp-Source: AGHT+IFCloPHVlipisTPRlj7L/4tT1LnRxXBniUHPmcalUaiFibCVkfryo9gCkJju4XSIkj5WwU/1g== X-Received: by 2002:a05:6000:154f:b0:371:730c:b0 with SMTP id ffacd0b85a97d-373118b5e0amr3921043f8f.5.1724666854063; Mon, 26 Aug 2024 03:07:34 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:33 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:17 +0200 Subject: [PATCH 01/11] phy: broadcom: bcm-cygnus-pcie: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-1-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2359; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=TpIPQN7XozxtTe7qsA1gv0aDxiJmfS+D7twYSKLPk5Y=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPZPsNHfRqaWN7YWNfr2xfCg/Ckdjq6GIWH9 BAyU2h1RcKJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT2QAKCRDBN2bmhouD 129nD/9VqOSzQXsR+Oo8j0WtHebQVSWq/Nu9rJNndOKdLXNRZ5htUwQmDUASfOxefNbc/4/Y2nj leHbwHrisD89b1WugrAkPOOzmyfMpMFw5bEEHeeHkI3AVHrzrt4Al1zj1qkHc70iR00gs+ELyUX 2VfIS6XW9NLIFlEHX03DPl5xvVc4x/7xQyanGYmh6eFVxM2izPCBTK+K9vkIj2qtclovgLrNTie KmncHhcBLslYvJKEef7dioNPu33lEMhw9+7CGrG+zgCBaaGqGUS3MisioaFN644cMhSi+qDhrz3 HGLji6BcmVQUjd7t0FgLhAZUx4GH2bKxj9WtLErzerzj0cOOlVOLhDGTniGfC+R6sdGbwKtuzOS jo25+LfkcVHVR3Bg4JZOVeH7EF6m3NGGmULvHf5ZtXALU3BTFClcJK3rO/8t0rBOGiAPv4ku8LR 9PT16AIvtCMXq4rlbLtdd36Kb9coYjfvsK3/Eb5J9+eRyVAO6+T0xj/qkFwqghcv6xjZrn8FoMd dh0aGhv7r2JqiKoYCNqT+JL9jYI/UXBF39X2dk5ekyjEXuZRM8idspON3hIdFs22m/JCIDS5uB/ yYjbGZVPLtKC0EdrJ2ZtkEOhhPuY9mPt3D1oTIpRH3oFSzWD0mqDGwOyB5u6OXTbPWn+xTwvSR9 fB8wOieD0ABnnww== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110738_658991_5A74162B X-CRM114-Status: GOOD ( 14.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Florian Fainelli --- drivers/phy/broadcom/phy-bcm-cygnus-pcie.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c b/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c index cc29b08e49eb..462c61a24ec5 100644 --- a/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c +++ b/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c @@ -113,11 +113,10 @@ static const struct phy_ops cygnus_pcie_phy_ops = { static int cygnus_pcie_phy_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *node = dev->of_node, *child; + struct device_node *node = dev->of_node; struct cygnus_pcie_phy_core *core; struct phy_provider *provider; unsigned cnt = 0; - int ret; if (of_get_child_count(node) == 0) { dev_err(dev, "PHY no child node\n"); @@ -136,35 +135,31 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev) mutex_init(&core->lock); - for_each_available_child_of_node(node, child) { + for_each_available_child_of_node_scoped(node, child) { unsigned int id; struct cygnus_pcie_phy *p; if (of_property_read_u32(child, "reg", &id)) { dev_err(dev, "missing reg property for %pOFn\n", child); - ret = -EINVAL; - goto put_child; + return -EINVAL; } if (id >= MAX_NUM_PHYS) { dev_err(dev, "invalid PHY id: %u\n", id); - ret = -EINVAL; - goto put_child; + return -EINVAL; } if (core->phys[id].phy) { dev_err(dev, "duplicated PHY id: %u\n", id); - ret = -EINVAL; - goto put_child; + return -EINVAL; } p = &core->phys[id]; p->phy = devm_phy_create(dev, child, &cygnus_pcie_phy_ops); if (IS_ERR(p->phy)) { dev_err(dev, "failed to create PHY\n"); - ret = PTR_ERR(p->phy); - goto put_child; + return PTR_ERR(p->phy); } p->core = core; @@ -184,9 +179,6 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev) dev_dbg(dev, "registered %u PCIe PHY(s)\n", cnt); return 0; -put_child: - of_node_put(child); - return ret; } static const struct of_device_id cygnus_pcie_phy_match_table[] = { From patchwork Mon Aug 26 10:07:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777594 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7065DC5321D for ; Mon, 26 Aug 2024 10:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bCMHxzrRAUFzpSiPm8CMwi63rbNv1pA6fVNc4IEznk8=; b=wIzIzqW/fKS+vz1kPllm6pr2P+ ni6qr0S82yjiFK7l9kFTlTTlD2nStpZ/fdZJg6VBtLt85BkjhNb2N9fcjaQbxRkmTm/0kXh5mtKO6 hUnHQQkZTE4ipf1w3P1AVe50L0nGemDZu79t/3kvoBpPKkj/m8Dof40dHOchRUhqDoiwgQ/3edra3 /Zr+BkF7epX0eJatqvMXIpnO7ZFzYMHHhclLfcMBdsl0Cd0PTQEenD39XW8/BwEq2qztYUTzkH4XA 9B7Ib1M5KbP1wISFpQOPH1cF3uxcmFNhJ0Fld6ky+FmVGzy0gRJLbLXIw9A3HazozwPSymVXNZ3Wx Oris2g6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWhO-00000006roa-0MTY; Mon, 26 Aug 2024 10:11:46 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdV-00000006qgp-1qLv for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=bCMHxzrRAUFzpSiPm8CMwi63rbNv1pA6fVNc4IEznk8=; b=hxLsuOQdYgT/8E79CaB5HVmm6N x6cfbH9vU4FDRs/YPpqVQR/nOE8RBoBGe9j3RQiVGwY1QiWJVGURor/nHbonHUuNzgoW215DiDhCn GcqJOVCD1ihGtfsQRtFnvzcOMuj2EJ9qQl9E90S0XXVmVOhW+lvjcqP0FIn5ERDWAmL2pQc/k66Aq FhFp6jPqPb8VvnPy1/If7eP517DMeMrNLy2fTuGPMPtzkvrEaCOQNmLlrjRAX62e7OBGSXq/PG5yX ixuJ1RWZT01GxGgzurbcLBYEZwuGaPDXjJ29S0iu7ceXTW0iADMcs+HpMfh+rxlEZ6v1WV6lYtOsu hE53w7fg==; Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdO-0000000Ad6h-2JPQ for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:43 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42802ddfaa6so4596855e9.1 for ; Mon, 26 Aug 2024 03:07:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666855; x=1725271655; darn=lists.infradead.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=bCMHxzrRAUFzpSiPm8CMwi63rbNv1pA6fVNc4IEznk8=; b=gtgH6CLVVOdpB+DtyVQzwn6yw+ujnmw08vAEKNGhrpCqzoYOTcgXlnQMYRN2L5tuiV 7Vow7fLZMdxSCuKhQvKE97jbmISbe/1w+Ro3wFC4hbDLjN91mbdFal48NPBKIteM+8Ov GIj18503EH2iHh4bhGljvEVKCQpW8NuyK19bYYrUK74gBsYmQ+IYrpw40Ejg/s2S6LM+ M5ph7lUTWuIJB/kbGjmBYMRzs4NAt/a2K5H6MacP+FaHj80EYKuUiSR+kMzfrvveM1IA NepUmaywFf84lBw8rkNX1qAZBBxcgeP6WNhmSlbHssyuwI33cFloGt+2MGvlCOBel5VE BssA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666855; x=1725271655; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bCMHxzrRAUFzpSiPm8CMwi63rbNv1pA6fVNc4IEznk8=; b=edASLLf7YXEBkcEzJQs3i+Vi+Qku9dQewFkePBcXewgxy+9kje4PXqDLBMeYtfjC+R uv/qAJsQrxFrZZjZ761wPGtiwMXWgO7y/ajoNpTOpDcHC+dWvOFFIi2QnVaj1Q+3fBXx SdqFSkknyTrsHj0dLEgJztNramvArRSjuBDfz/GM+6qR5mOG7WhZcVrzMHI6q0jNhcmy WUIqXLINRhmqpbiPRIqtxO9eIoBT7XajKQcb2puuKHagp9EmJ8lggZJKk6Vi7umJ5uRf fadPQGSVhB1tMRYc7hlXHRH2WObWlQEOuCNSo81H6hBbRlB/dg6F+ldNn/roMtt3Pvi8 6N8g== X-Forwarded-Encrypted: i=1; AJvYcCXHrS6wCZ4BWhzQhtG0QX6rZTSLb+CWC2gWXB4upX4BAU0gB3TLDw+lF/pnyD5zLXgFhQwwPEtF3OabM/IwfQ3I@lists.infradead.org X-Gm-Message-State: AOJu0Yx2KCjyhL8DUksPBXwfMeB/ELm5JU1OIqqFivb7IDaMsLc6rYKO keF0ZB7+cpYkBsZUCRbY6+F4qL9S8MtPH6BjJ/298N7Qx9BmxCebjF4jgJ17enr98QpiiBIv4gX i X-Google-Smtp-Source: AGHT+IGDbjrb2B74Avky6eGU3oCwj+LoFI4qsrsHH0Pjzz9kol++o/r/gWi6qLtWjpZvcSj6QuH++Q== X-Received: by 2002:a05:6000:4024:b0:368:654:932b with SMTP id ffacd0b85a97d-37311869b4fmr3577298f8f.4.1724666855475; Mon, 26 Aug 2024 03:07:35 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:34 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:18 +0200 Subject: [PATCH 02/11] phy: broadcom: brcm-sata: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-2-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2420; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=ConX1xoV1bzBjN+wlA70XCF5X6wLZIQ8hExvfXnxdUA=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPaAeuDX82FFSM9E7GPDKBAAJHUMIGLxCR53 Wk0I4/gdS6JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT2gAKCRDBN2bmhouD 1z/GD/4rnKh987w+rowE9WN5LMMk5lpIXrTDF1Oo6JkEirJ25CDRj2sQ92va/oAOeJhejh8xGla HlDBqPx+EXsaGhdf/ylIGJVhazNv0+uzaqTYc+gMkmRSFf+TWrYJY2bIeFYgOTcyhwizbUws4vm ASegTAtFMOWoeirXz+AehNgShieLrrYGKAm7JSGi+scXFZgQ/xn93v1TZ/M02QWkHcE//iGoroO fRm14dbzPmlc30IAvCpwkvr6G27AnlapPXqu2jK7cQzuNxsJ7IW/Wm7qP47DPGBnEdQdN2+FoWb ZlGBn8VA/dC1UqxtSxrkK93jlaDZgaFosf2E8qdjsUp5Tz0ylLt796ANXnnrIJchpjOcvgCo6BO pJlaTZLh3NSnh/MgaUkuiRV618lQAG+FLxOkqfOoCEkmPhg87S9ueikASenGqVYYhPafvWySuwk BS6/0kVFjq/UyGFUJuwtccMe1syDjg6utm3UzHgby8rU7IzwDg69lMPs06674gQ60SItOjDMEiz /z3dkObv88z1C6n8YUmcXrSsZhUDaFRS/7uX6rwCWB3CzyjyAcsUOmUcwRkbGzE9xfN1QUGVB69 RdpwSzoIaQ5SqXhUuKz0q64uI6bSb0/Dc+nzAflvSdqqcLQ+zEHNdfLLE3KONoxjrMLCzZESSXx dDK+gMmEU2nLPxg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110738_923702_0CA286AF X-CRM114-Status: GOOD ( 15.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Florian Fainelli --- drivers/phy/broadcom/phy-brcm-sata.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/phy/broadcom/phy-brcm-sata.c b/drivers/phy/broadcom/phy-brcm-sata.c index ed9e18791ec9..228100357054 100644 --- a/drivers/phy/broadcom/phy-brcm-sata.c +++ b/drivers/phy/broadcom/phy-brcm-sata.c @@ -751,11 +751,11 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) { const char *rxaeq_mode; struct device *dev = &pdev->dev; - struct device_node *dn = dev->of_node, *child; + struct device_node *dn = dev->of_node; const struct of_device_id *of_id; struct brcm_sata_phy *priv; struct phy_provider *provider; - int ret, count = 0; + int count = 0; if (of_get_child_count(dn) == 0) return -ENODEV; @@ -782,26 +782,23 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) return PTR_ERR(priv->ctrl_base); } - for_each_available_child_of_node(dn, child) { + for_each_available_child_of_node_scoped(dn, child) { unsigned int id; struct brcm_sata_port *port; if (of_property_read_u32(child, "reg", &id)) { dev_err(dev, "missing reg property in node %pOFn\n", child); - ret = -EINVAL; - goto put_child; + return -EINVAL; } if (id >= MAX_PORTS) { dev_err(dev, "invalid reg: %u\n", id); - ret = -EINVAL; - goto put_child; + return -EINVAL; } if (priv->phys[id].phy) { dev_err(dev, "already registered port %u\n", id); - ret = -EINVAL; - goto put_child; + return -EINVAL; } port = &priv->phys[id]; @@ -822,8 +819,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) port->ssc_en = of_property_read_bool(child, "brcm,enable-ssc"); if (IS_ERR(port->phy)) { dev_err(dev, "failed to create PHY\n"); - ret = PTR_ERR(port->phy); - goto put_child; + return PTR_ERR(port->phy); } phy_set_drvdata(port->phy, port); @@ -839,9 +835,6 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) dev_info(dev, "registered %d port(s)\n", count); return 0; -put_child: - of_node_put(child); - return ret; } static struct platform_driver brcm_sata_phy_driver = { From patchwork Mon Aug 26 10:07:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4732EC5321E for ; Mon, 26 Aug 2024 10:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3WbdwJwMzGd487Jm58/6IPAFGaqbJVFIEVy/1bU3kBU=; b=dfHXYotU7cE8Zs7EhHFATaPkA8 /bBopiXcWVOJntBhjkND+oq5zX6rwE85NUBBiHJW5RmmlY+igFOocMIC2tY79dyaYJRc7d/3qk3bE ldufAoLav5kaXPQX5ekKe0DwR0zJrCUWRvz+qZDW9RGoJnGW0sQTk4hrF78MoIJy4gp7yFhej9ppY Os1YcSIjFHnO2nIfdhjcondylBi2uNRC+DF6+eNWmEhnKkUOCnlR4l03ML9nzdoe+yU5GEtf9rdCn 6YndsA+JH6YvrpeAgKGDzZSSgmFwf8Db3W7OcU158OBtqcKaZktWQ/suwu8NM+9RHiwk0DYLpcq29 dwtXfnkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWi7-00000006rwk-3m1D; Mon, 26 Aug 2024 10:12:31 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdV-00000006qgq-2FGw for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=3WbdwJwMzGd487Jm58/6IPAFGaqbJVFIEVy/1bU3kBU=; b=i1TWez8dogPwPSq8l0KJeZg5iz jJHWaGmEyeArBjUbs10Ncx0xf15UXH+pgzuxL8Yo7TwIGYTyrvarWfd4MEzUqYBuyEzlKw3lK7Pn+ qyKMbKvjQJ0s9WYhTUL9jsDgIB8k3C/B7tfYkslxeT5MSBEXdBkqMgyfMA31yquMCk1O4U2DuQ4xZ uUATBkFh9CJos+sotyLTxC6TxUFB/9ZIOz0xuKDvcqRmXsf9t2sMqmJu+/oipZTAMOVbcr4GH5HNY idp4haEzauiFgUb5/S5HR1t+n+8y4uYwqoeFx4SqpezgCjKdU+VgfZGd8epCuzSvhTvminCwzvmJX VqhbpD+Q==; Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdP-0000000Ad6i-2fdG for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:44 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42803adb420so5120245e9.2 for ; Mon, 26 Aug 2024 03:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666857; x=1725271657; darn=lists.infradead.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=3WbdwJwMzGd487Jm58/6IPAFGaqbJVFIEVy/1bU3kBU=; b=oZgjnaCpq5y+DdK+o79IOjlgjdBFaspfXJfQL6quKgV8kJkGIQ6HxGqiK9H1ZbTTGv pMZSEHvYndzCdydcjgqppyKgBnho9tAx5iyuM8MyBsE/epggMFaEvOUqQYjHby0ZtJ71 V2/METTZBBzLoXS6Wpu408Am8/ijpsg8+qAa1P8/b6z6Uek8L5BHfFBPxHqnmu/LeBxv C96EU4BtsJc6Bob30Cxfdaw+FDJieXWbKnngR7NH22pEtwBP1LGM90OaslKcv9BlibH7 fWcHPOdkXUCtubvE6NhqfibD7F3sLwaRN+I8JIxNq5T9HpTqL8WHOeSZC8e5TRAEqLc1 vgoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666857; x=1725271657; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3WbdwJwMzGd487Jm58/6IPAFGaqbJVFIEVy/1bU3kBU=; b=NwZfrCUn5uJ/CaHzRUS2Be/6BnP03QT/Y3it+CFmIF+GEsHzAl3+DgMULEsEnkEP5p E/TLB2DasbTv+CVX2q5XrZvtRfaVKttLsc5xzg4qpBamh/elRuPlZ7G0Wb9L+vffgIHg CPWIaNdIa8mQ3XQPLQWpTCYSzwHtTRRCNkDA9/aVN+0CnsICyvNVEf+zuYakKbMNekIN sXI5t0Vl3woWft1GDkqA5zZEAr7FzSJJbpN3YeWgMKwSRwL+/OcZM7XQInfrrKQ4QPTR awfAzZwbcot+uN7CVJT/0+PVVk5KBRg52jOP5g3kP75l4vE3TbvxD/T6g+7Yr4jp7NsX X0+A== X-Forwarded-Encrypted: i=1; AJvYcCVkgAK2drwfO3PZK0kFhyB/Fh4MCmcyL/is/iFhagR7DIr5CnMY5PBhX5mAfSmaEbGoY6G+P/xPpqm5dP49t2T7@lists.infradead.org X-Gm-Message-State: AOJu0YwK2uE4w3SgsVWMkZc26XXdabxotLFxaGrqY62HDAp+e9FM7ZFs Ycz4Ha1sbVEqNqKiJahLlgdTvfynR6i6i9QvnBeqdDKO4Z8vh3C5CJbXsAYzoQ9PS39cj4DKB04 o X-Google-Smtp-Source: AGHT+IFklH3Ny9t7GPphcYtSHUeO9OqMZPPFfYRC9xfJkhjaSEMhKLJDJuN0g5pcthbBx7LS51ulDQ== X-Received: by 2002:a5d:648e:0:b0:373:6bf:9608 with SMTP id ffacd0b85a97d-37311843370mr3729073f8f.2.1724666856869; Mon, 26 Aug 2024 03:07:36 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:36 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:19 +0200 Subject: [PATCH 03/11] phy: cadence: sierra: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-3-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2013; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=jtNLroZp6oDWwv/KZ3xoT8RtBVpmgjpirqt/ibFxI8s=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPbbKpPHL6GdF5Qqk8rC/GGGrQ4Hh1ZvCtrZ cPY7A2jkAWJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT2wAKCRDBN2bmhouD 15SfD/9OO/+x3tuIvYd/WbnMT1CUTEf/bF9MuCLRDZpGzwZ8G5dCifwH0FuB5yPntS+hAZlBHp3 uIrluv46zJ/Bwsu8eq55BNiIRX2jDecimSOcjXpQndqjiK0v11mZqrpzbFr0PFZcxC2LdszLC9j /1mXPHAhb7CRvCnzKAieTGIY0RA+XP2H0vmzYIQLoc4P7pX19VuxzJhn1pz3CAxAS5qu/iHf5EE 7MfJDnYLKjy48xxkuXs2K2x7jfQv1rBa400T84DoO34MI6A/CxhYEvclBvEVotu+W2zY6x+C+ek QcfKOYnaW1fgCgbA6BpD64ycS2PLcs0Sa+U9KCaaxGkMFF3wcsTeHQ8medG4dhIrzRPyKTMyPkt VluPLHFOHLDew0KlZGSnd2Q1ksOGy+/45S1Oco+2jKUJKyOaiVhsS21scCBagibIWtRLLGHlDid JUVnWiX9yv436GZxILEaeALTUJZbn7NOJUcZK/mcLgVLcaG46CZnZgF+iw7uv1WpwIAUqXkaUpM bnfiSwO5YAEdHESCbWUmxilRSIntxrgzfEhTmEipYjHtmtGNX7nO0ZtShMAiKmpIsqb1+g8nxXE Vl6HFgHWsh5qYz0LpYb7xlW7AmzeV+0LqjatoYQECv4pDCWf/rZiuC8oqhQw3mBeO4gq/qcGhbr 2ZWDAaRAwHdBApA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110739_845382_3C28FD9B X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/phy/cadence/phy-cadence-sierra.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 3010c9f24136..aeec6eb6be23 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -1366,7 +1366,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) unsigned int id_value; int ret, node = 0; void __iomem *base; - struct device_node *dn = dev->of_node, *child; + struct device_node *dn = dev->of_node; if (of_get_child_count(dn) == 0) return -ENODEV; @@ -1438,7 +1438,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) sp->autoconf = of_property_read_bool(dn, "cdns,autoconf"); - for_each_available_child_of_node(dn, child) { + for_each_available_child_of_node_scoped(dn, child) { struct phy *gphy; if (!(of_node_name_eq(child, "phy") || @@ -1452,7 +1452,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) dev_err(dev, "failed to get reset %s\n", child->full_name); ret = PTR_ERR(sp->phys[node].lnk_rst); - of_node_put(child); goto put_control; } @@ -1461,7 +1460,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) if (ret) { dev_err(dev, "missing property in node %s\n", child->name); - of_node_put(child); reset_control_put(sp->phys[node].lnk_rst); goto put_control; } @@ -1475,7 +1473,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) gphy = devm_phy_create(dev, child, &noop_ops); if (IS_ERR(gphy)) { ret = PTR_ERR(gphy); - of_node_put(child); reset_control_put(sp->phys[node].lnk_rst); goto put_control; } From patchwork Mon Aug 26 10:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04459C5321E for ; Mon, 26 Aug 2024 10:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=g4NvmLlxu/k307IUSr+vlW1RyZ9QbfRpgymkG5UhSlQ=; b=N/k2uQI+GXKE+IjBVdvta4Fu+k YA3WBqLtZpZReWcnugHJs+/1rrrvQfdj+/gWPEkAunXnTh4VUV3Si4KsmAvfw/TKZvdnyzGe54tOI uA0N5nxD4MHQhsxD8cqvT9AJ15EnvZkjHsfOlR4dqi4LsPd5BO8sz8a4bgcMoDXd5KasPlF4slt60 GRQ9cdvHnuoaUzE90hdLf9j51u55D91xlKv+mk6DdD3cpHKmSehaiWAN57bHgG5CTr+T1XvWQvTOQ AtIEoGnADEo+k4dl4MBSC2KMYcBOco6hfI24aF6pdlwH2aJM9kZiq0dG5f9z3p7j2jwFaicCxBjB+ upipO6gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWf8-00000006rHu-1r6s; Mon, 26 Aug 2024 10:09:26 +0000 Received: from mail-wm1-f53.google.com ([209.85.128.53]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdQ-00000006qdo-1izk for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:41 +0000 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4290075c7e1so5145445e9.0 for ; Mon, 26 Aug 2024 03:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666858; x=1725271658; darn=lists.infradead.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=g4NvmLlxu/k307IUSr+vlW1RyZ9QbfRpgymkG5UhSlQ=; b=D7/xYm6ygmlaJsxxmtMohOEAVA4f7e4UsqzstO8BCqhICtjBhuHEp4bP4MFaxipKS9 c6w1Hcs68Dq2NuHhisQL7L4py0GXgcKmCmmo5fUYDf64d2wuouciI0qzsQqJ95zD00ut JiQKl+De8AIUXKkV1IoFYbm2vLtuwx8UPGCDn6NNlmW0v04t4ldl9EdPNQLKGpSyi9Fd h9JUPqIkdhe4TrJV2otI3z/pC3ud6nai7yyVeRlbCA+wxPXG9kqZwjP3O0D05NDADg5K vVxedJe1QYhJaIO/7xXg1OJl1hGxGhhZGfzkDIijacGpOrxcGThoMuQNQhx3b5oMZjSw 7Wpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666858; x=1725271658; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g4NvmLlxu/k307IUSr+vlW1RyZ9QbfRpgymkG5UhSlQ=; b=pfCiJ1m/DOie+kBQdY8EO6t8nAjUa8Cu8Ukq8yEP0WCGRbOaydhMXQqmeKAasLXWel VZ+RmxU/nAfExsP6B1HFdYcoolrK1rZRNS1qMfNac6VPg0t2uWOt0RavdQf81yQP0x70 DmGpby/lGAjqVmN7G7A28Iq/yWDUO1xjGOw3LjqevbJnE0gHvQtl4dAjZC+Efmq1nY+p Og3ls+JFeGZ0TLROng0fNIwZM8+11WceCkv+YRj21xw51I+xPGPEJIv+DKWUhRdopfpU 6rTmnRbBpgltko7HZRwwkaYoRSobAghRslU6PohrzgvbjeW/oys3U3N70QHT6tkc4rwn cvLQ== X-Forwarded-Encrypted: i=1; AJvYcCVKzc9FF2bmRoksjWC1rDXy85nX7/iHxu9AsevuuQvgN1lpblJMVHmMR0wW6MybhOw2WrMHxFM6c8g4CzpYTGxC@lists.infradead.org X-Gm-Message-State: AOJu0YxdQvlZNKA2WbF1FCGDCSbe6/9Myc7kmdhZZ7A4B1SLrZu7Y0Ai HvHPucZnp4rVJoCdkKEQ/RT7ohYErhALrsqaf0uNUb6zfKkxmHB5ecGvmsrM1HcjqXIBMSYcPZ1 h X-Google-Smtp-Source: AGHT+IFw9/YOcCZ4U7WA87IeV+RhOZP4bUxwWYn8Wb7oiTEYe4Ohe64MYDaPtt1DLAHFY/viNcl8kw== X-Received: by 2002:a05:6000:402a:b0:367:4d9d:56a6 with SMTP id ffacd0b85a97d-37311842d2amr3539393f8f.1.1724666858308; Mon, 26 Aug 2024 03:07:38 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:37 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:20 +0200 Subject: [PATCH 04/11] phy: hisilicon: usb2: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-4-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1786; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=uw0Pf+zldgzboru4goVYRFCRCYr8alqMpX4Y+JIze8E=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPb4sshkjU2CA9+XXXwCTRdCMdijvb6c9Og6 nYQj7pay9CJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT2wAKCRDBN2bmhouD 13HXD/4pvENOHQUutqEqhtyXsdoTSjcrpUUfXLAHO6/21A1P+HQwDV6r4fVVRJN+4aUHynnlwXw GopDkMKpVV2abQ/lO5LqbUkMMvXi1M9o6QNEGnzu2scYkY+OVy4MT4Z2EK2zvjR5Fr6V9ICc7C6 MoLxq+uREB5PWt23Z6GkcU86pc45o7ZiNHR9jwfwCXYRvJr/5mUkFXq08RZVzuHcMBtFiPxN5qL nif11Z04T3flhl4Zz+5zF7ciAB61V1d0DxFDBiMRVlgvBjpt2drTsYvNwlpdZMAeGYRTRUKqH36 D5CFi+A3qFLoCpEKnu3mO2vhk9rwc3a9o5Mhf/wP6A8ivCt6hNJztUKLrbmhg4RNdZ0ME/e0R/+ D2U0wc6Ig7cchhg3q0CSw9qsId2CBEnDjdxB3guCj0qCH4UkFrPwpfS7me8CQvi85Pb3Zd1VC9A Q347IbJLWq4RSEl2uNBC7eNv44Em7byvi6+84nUAjpG3ValeHjvjLwMs2db5G2ZmzAM2pCR1YfT pcdYwuwDicAdmXdNmDaQGWWdGisY6Ar6Ij3s09BWqqS6XfgG5sZ8O28puUNgcQvMc2MWoh0iXez GGTUDZrNnEJYSEa8sU3rRg3Xfy3NwR+S7QmmV/zP0ztj1PHnbRI3QzquMymUKGaJnm1Lxwa6K+y JtdTYdv9csoe90w== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_030740_509782_248572F9 X-CRM114-Status: GOOD ( 13.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c index c138cd4807d6..c843923252aa 100644 --- a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c +++ b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c @@ -138,7 +138,6 @@ static int hisi_inno_phy_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct hisi_inno_phy_priv *priv; struct phy_provider *provider; - struct device_node *child; int i = 0; int ret; @@ -162,24 +161,20 @@ static int hisi_inno_phy_probe(struct platform_device *pdev) priv->type = (uintptr_t) of_device_get_match_data(dev); - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { struct reset_control *rst; struct phy *phy; rst = of_reset_control_get_exclusive(child, NULL); - if (IS_ERR(rst)) { - of_node_put(child); + if (IS_ERR(rst)) return PTR_ERR(rst); - } priv->ports[i].utmi_rst = rst; priv->ports[i].priv = priv; phy = devm_phy_create(dev, child, &hisi_inno_phy_ops); - if (IS_ERR(phy)) { - of_node_put(child); + if (IS_ERR(phy)) return PTR_ERR(phy); - } phy_set_bus_width(phy, 8); phy_set_drvdata(phy, &priv->ports[i]); @@ -187,7 +182,6 @@ static int hisi_inno_phy_probe(struct platform_device *pdev) if (i >= INNO_PHY_PORT_NUM) { dev_warn(dev, "Support %d ports in maximum\n", i); - of_node_put(child); break; } } From patchwork Mon Aug 26 10:07:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61C9DC5321D for ; Mon, 26 Aug 2024 11:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0GaYhvDqOLdQ0LiAwBiqvznHKPRO8c0nk7Yc/S2Se7Y=; b=h4KKzQ7czzCvsXLPqHvDUDL0xx OjggQLtBcQYI+SZKOK65l4jKFP246K5KhxAYSKsekVBthGiToSth5rK0WVqrEBcYTy/p2Y1WdCG1+ MODc42ZxCD8HcW7o48DGvlS9WRyjNhfAwU1uamcBcLVdQ0aDrlp2S918EFNc7g22MeUQHLWwnSM5W NAkM+vzYS7Z5RqAsKlpovOVB7aRkEfFpYZfSOd4CcG3yW7df+Rh+UpT7Ce8CkmG5oUf2Sv3AUZYhU 1a58I6IXlsjsGDsL6xdyZFFF3+VU38C1ZLlM/wCkkAc8Dp2hiKTV4DX3QgrJETVdXuh33qm+QpDQm 3gIRP/+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siXgv-000000076Kb-2tI1; Mon, 26 Aug 2024 11:15:21 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdX-00000006qhb-0cUD for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=0GaYhvDqOLdQ0LiAwBiqvznHKPRO8c0nk7Yc/S2Se7Y=; b=CG34HuFAdCQi+aRkGKV00Aybbr lcF/xYA/R55IVsdNTEqAG9eUiWqxcvVk2YTHqF20rAz7MNt9Vg8Fhs5ZQgzn8y++vRxEkJQ6MmVKb 8wsGpzkWx5n69eQ5Rm4GbP9QTVQ7N2JJrz1RB4TAehNImKxgCP2UpMdw2Y1YBxKUmX8stROuQBd/S 1/NwFeRKBOxIXm5PGxXDO7Mm/QHpvjafhHniya7TDx51q5N/JGQlYCoZlo954I1mFfeNvJbJ5EulQ f8uyti1tfCMCbpFcHOf9r0qjO6Smj4R67fD5lpfuFN5YoHAbBptU5SXan8EpUAd/j5QNbONYdCI6h 5N8862SQ==; Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdS-0000000Ad8p-42pU for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:45 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42808a69a93so6291025e9.3 for ; Mon, 26 Aug 2024 03:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666860; x=1725271660; darn=lists.infradead.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=0GaYhvDqOLdQ0LiAwBiqvznHKPRO8c0nk7Yc/S2Se7Y=; b=MvCTcrkK2YPnuDRm1EeDmg/HS0THLimgf/QT4lu6zwb1kFWgEC3rGmZ+o7EMandpuH TV1FNjZouJRSY3fi2uo+yOkIdNirq6qXdQVK0Vw86dizBl7gGBCv5i0cNkN1USz6GGNN +rFgAlogPvFu3PTN4Eu2uqw18GXNREdVMvMXn1qy6H/vLYw+k1IGfIifDmJVGmGyOdsB KREVDl6KUySHabjskQEa5LqligG90RXqY6WcN9wMDhgOpcaaC8E3+StBt0prggXFbBwG 2XEwplkrv1bB8P5G8ixn3DOwh4TIGNVwvrzOCWvNNKkD7t974zCM8eeWsPfphReidHjy IZhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666860; x=1725271660; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0GaYhvDqOLdQ0LiAwBiqvznHKPRO8c0nk7Yc/S2Se7Y=; b=YM3xVjAW8mmOife9WmFCbH3rpIn6ki3ipTSkuehMK6QwHoF4yopvujYzUSBfPlK5Di 7lOyLU5RUBWLUd6keDRt1C1JuK+/Hp1l+w2hKGmMavM7hjV2iK5wdRwoOq/hXjBvcPer MtzTH41L2rjp+aAkWXFW8IoKfSuQBHSqYV2lAUFTxDLy+axF2Avu8ug4SKIozuplnSI5 vkxcy5xkpTe396yqkDu+HijNm1qg3zivqiJUa471Qckzwp9WW1TkclC/tymEsfXTuAOh m5pS5+jH6NKxjUDNE8iv/+LP6xm0Pm/zWlZI6pCuUUlHahx+ZixKVsm3cTHB4UB7TNIs lnUg== X-Forwarded-Encrypted: i=1; AJvYcCX3AAtZc5SmKpJtox59yAshnJemTplh3mbaNBaN1lXEeuTHuGhrXWeaLpxDgSrFqBbAQf///wcpBSIYJQ6Q62aa@lists.infradead.org X-Gm-Message-State: AOJu0YzVHiaYLBMQ/GN1HfvHZSH6zPda3kwsKDn5OjSz5x6RfvTqu3t+ k/VosWmLzbqrcwap+btqJew08srDHhfnYGOYPGvbZPrN+nVA50+Iyo8j7h4RA4uzE5zg6gYaA8a g X-Google-Smtp-Source: AGHT+IHAE0Rm2NAn+4wjgcKvkxwPa4s7aWdk9L4hMBcsuf6xx9Pm4Kt8Ws0+LEPOIoRTC/kzupBvqA== X-Received: by 2002:a5d:47c2:0:b0:367:9cf7:6df8 with SMTP id ffacd0b85a97d-37311830cd4mr3462928f8f.2.1724666859817; Mon, 26 Aug 2024 03:07:39 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:39 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:21 +0200 Subject: [PATCH 05/11] phy: mediatek: tphy: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-5-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2867; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=d6YjtlhFoRREw1+Zm7s3VPFYbcnOL8lp7zFl+ncHJGc=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPcISCpOL78DthcvA7n9HD0PjGn3OQrBZ0N6 9WAbz2hyTiJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT3AAKCRDBN2bmhouD 1/L+EACU8UjoaFd/VCOUIcGc4SNtlfbfC+VIH3e/hLs5GQvLFRRKaw/ctKPrtD5hehNwo8cqZGd dbw5yPIsS9sW9/GVW1zLhi2allQ5HZKJqUSsrUXVrFQApwPK++u2IJ33hHv6CIjyLO4vvEbIA6t 8GJlZuVUzRGxaCTDhPsL4H2HCYaZujr+qRH4DWBOKRD2qqzPpL/JoPlt2TH0+AoJXmHCNW7db9Z 1utOfTYXSq61lEXGuuZimVJ9TXXnhfRkmH2oq6Xc/0exvXZG1MbWU7CQM4PdG9DreJnFuNLbtap ruBReOQDSvd9AHBgC/o8s6E/4+lP3cP5fS0SBki7LgcoegQrMVbw2cEQQZ6xI/eQtuPnpyVxAGJ wVVPLZwSvfW539p4NPtF6IFBDj0FJ09mosqDstt/Wc73q5PkaFd7vUoKaMVAKaIvolHFen6oaBO i08cuJne7aIPc01MiGV2kCxoUaKV+dNs4UA+prfk8xydUpMvxgAbhyT2nZ6CGVVyaY8hxGgXeFj 0qZ7duixEF2nhzTlLhFJTLL7v74FlpJ8hM1FiYp/MdMks6Fogf6HycKJkUqanRrymxvL/QD3Q5x L3ejj/i3hAyBxNyuZeexLBUMc69HrPnaFYtg8u/Sw524zBA6MpifbyrXCL5tBSGsJhV8BE4OTJD IC1QCJiWHP5cqjA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110743_177798_98D5B04C X-CRM114-Status: GOOD ( 15.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/phy/mediatek/phy-mtk-tphy.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c index 25b86bbb9cec..3f7095ec5978 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c @@ -1577,12 +1577,11 @@ static int mtk_tphy_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct device_node *child_np; struct phy_provider *provider; struct resource *sif_res; struct mtk_tphy *tphy; struct resource res; - int port, retval; + int port; tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL); if (!tphy) @@ -1623,25 +1622,23 @@ static int mtk_tphy_probe(struct platform_device *pdev) } port = 0; - for_each_child_of_node(np, child_np) { + for_each_child_of_node_scoped(np, child_np) { struct mtk_phy_instance *instance; struct clk_bulk_data *clks; struct device *subdev; struct phy *phy; + int retval; instance = devm_kzalloc(dev, sizeof(*instance), GFP_KERNEL); - if (!instance) { - retval = -ENOMEM; - goto put_child; - } + if (!instance) + return -ENOMEM; tphy->phys[port] = instance; phy = devm_phy_create(dev, child_np, &mtk_tphy_ops); if (IS_ERR(phy)) { dev_err(dev, "failed to create phy\n"); - retval = PTR_ERR(phy); - goto put_child; + return PTR_ERR(phy); } subdev = &phy->dev; @@ -1649,14 +1646,12 @@ static int mtk_tphy_probe(struct platform_device *pdev) if (retval) { dev_err(subdev, "failed to get address resource(id-%d)\n", port); - goto put_child; + return retval; } instance->port_base = devm_ioremap_resource(subdev, &res); - if (IS_ERR(instance->port_base)) { - retval = PTR_ERR(instance->port_base); - goto put_child; - } + if (IS_ERR(instance->port_base)) + return PTR_ERR(instance->port_base); instance->phy = phy; instance->index = port; @@ -1668,19 +1663,16 @@ static int mtk_tphy_probe(struct platform_device *pdev) clks[1].id = "da_ref"; /* analog clock */ retval = devm_clk_bulk_get_optional(subdev, TPHY_CLKS_CNT, clks); if (retval) - goto put_child; + return retval; retval = phy_type_syscon_get(instance, child_np); if (retval) - goto put_child; + return retval; } provider = devm_of_phy_provider_register(dev, mtk_phy_xlate); return PTR_ERR_OR_ZERO(provider); -put_child: - of_node_put(child_np); - return retval; } static struct platform_driver mtk_tphy_driver = { From patchwork Mon Aug 26 10:07:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1361C5321E for ; Mon, 26 Aug 2024 10:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ASWJ1lNjHUuMpa6qAsr3Tj5tgry0xzTBJeveJBPNnU4=; b=tN8h77RRKDopjBI+lheWC5wMNH CVijhkUfk19QecSxLEdB2mGgfNJW/D2MJSa3cchXAzNkBNlIRSsMfOP/ouNIAPwuXleQcQixy+Laa yVCGk6yFTWCb0QmR52YhV3x83LXrRv4wcd6noJ3je6a0UnQzIw70Nv4fEGfR0KXvs0KXY1NMc0PzE ZoXXYksE9chOceFBTRYjTb9TwLIemRyc+e7w/kjGYxLR4twzslnIqDutuLGmFsCleP9qL+VEokKeI xtcpErGvZmTmQlY18I4Ar66mhg8E/DqMjVfp3A56RSqpuSSMAchqVfCMOFfnfobQ+x6pDVXp++eMa LfiSi6Hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWjc-00000006sEy-32Xb; Mon, 26 Aug 2024 10:14:04 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdX-00000006qhe-0sDW for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=ASWJ1lNjHUuMpa6qAsr3Tj5tgry0xzTBJeveJBPNnU4=; b=aTsT/SzrmSsEcFZBOTZgTZmx7F RS92Rc6H1GW+LHYr+Q7m6ubpsFd8SJjn71ztosB7s1bXt//8lIZQCAr2YJ8rddFs3Jdap/esBV3b5 xpXWauxoz+5x8rH+Sy7x7P4tvOZm4yIqxuE3l0evxjUlVcjKWgJo3gKQRKOQ2opmDPq5lUIKAxp1d o/JFVhcylvKIcEXv8O6EhD7ZtSQ5jZWcWtSl2gaNAXjgHtTmlTJoVzo2pC0MWJjyWPHM1M7epRY8G +cpxsUBk65Hf9z+BZHU308bA2Ed0y+7actA1HH+2K5WAI44X6Fn8cESn4dNn6gCCnJ0gcjDhho+Nk WdjXnH0g==; Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdS-0000000Ad9J-42Je for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:45 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42802e90140so1841995e9.0 for ; Mon, 26 Aug 2024 03:07:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666861; x=1725271661; darn=lists.infradead.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=ASWJ1lNjHUuMpa6qAsr3Tj5tgry0xzTBJeveJBPNnU4=; b=ioKbMr+/cwkHYkM2SSwYqDP4bTIldLjQha7nBrRB9iqrzFpwJyB1JWquvn56QFTrxo KKCQiJotcoP2ynp8xWlqYnCiKRWv37MyB5ju9hclmFX3ZR38pkMCxKwY53q4xFHk8XBr z77MdViri0Ubs65X/Q30G41l6yZWDoZx+ENVk5BJS1A6c4PKfNzEyDua0lduXF/TjwAK e5AFAY7ePFb4QqPc66vhIHS78tjZqxvayf6iJ0Dpkat+a52MYqWAzngwbuVHDSx1dV+2 BJBY7eMXZ0+6EMO7m8tSQqhpd2DXN3Nd62/sDqZzkNqrnxqtLkFuRE+bgtvHW5moiHh9 seWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666861; x=1725271661; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ASWJ1lNjHUuMpa6qAsr3Tj5tgry0xzTBJeveJBPNnU4=; b=J3uIR2VyLLznfbd4KZprTvQ/XNf0xO7560qvqXZp3YRH6G0N3OIb1wxdWtjBrqjERg 71XwK1FADSfTKGWynl+f2gftGHWFcZKb03Mxq8of4PiVTtAikm9oSCuLMlR2G5LvvMEo OlPevm4Pz+Sq88DDhkCmcT4y/arqcX8MPwVVwKItwBwNauYDTPnk5EHFbGvzdetTXP1G /dgEcsEX2vqZ7A1Q5rObhT+9fKCMJj2uPX6Mwt4paSEUpZ8Dmztc9tlTwGKYMc9EQ9s6 Btwd8jX1HSP77eVUvNmrV5p2dI222rwkGP0+KIe6uUbrq+zmTfbmgUxz+B+lRog1LntE fGOg== X-Forwarded-Encrypted: i=1; AJvYcCUcpH77VQL0Yd87yLwtegMp2+9VwyX7t9xwL3HRSyT5Q7Urcu9l3plqT1KObo5HGuVIo05c3ThG3h/f2ASWz0bX@lists.infradead.org X-Gm-Message-State: AOJu0YzOi2O3Scza00t7MfLNdP9XY8xjyjVyeGvfmqBqyPAecaVXjAZh YVRhaMjKiHQ1cNpjPyi699QSJlcQjI6Qc4qpfGrVAT4JqwNIP6CBeswmearjerhEVzdJGWONi0g G X-Google-Smtp-Source: AGHT+IGnpO6+krf9to/NrSDs8QxwhaBThYRXrUT2BYv5yO/i1nNfdR3qX52BrU7X1WNRyqqZ2hzEKw== X-Received: by 2002:a05:600c:5104:b0:428:f17:6baf with SMTP id 5b1f17b1804b1-42acca104f1mr43496065e9.5.1724666861335; Mon, 26 Aug 2024 03:07:41 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:40 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:22 +0200 Subject: [PATCH 06/11] phy: mediatek: xsphy: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-6-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2728; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=leD8tF3yHCNMBo9vM9LVLXB5PNba9al/SNWQPAQYPNY=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPdbq398dEPwi9VsOu0ZYKL/TxY+EchqiwUv jtz4Z1F6wOJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT3QAKCRDBN2bmhouD 189TD/0QjWxZ8926h1MFxLw4xEdxSn6C7GFD7UWOUoHho2maLGHAP0d69x+ozFtJlztBohHkqbW kRJNDsp6wHEfcnBupn8tIBsDZbC/np6CT6l8qW64k9CaatbGcD95BsD5LuC31pzpc2WoGPir634 eHuXAc3970XdG9x+sJYhyyS9ONcHPmJcdpPfbtGTzffmsUYWdcnK8iC51dhESPWiVyWfWWkGVy0 ZxagVj/Y77BiwaPv3B0bMQDHjnEj6N7dhh/umLiwgY1pusksIG121C1vbM5R8kzYtunZVtemQ43 uMldHhstgo4Ev3VynweUyowv4pAA0rkxxP8dT0bzB0fjubttMbnwlAB+K+MAppBWGDIepsgfK5H gPdIcCGNbt3ILpIrCRUcqz2Qpiluzlq5KTjQugyQMsnQYyUXg4KgbOJuWsmI3R4hCY4II4e7WOt eQiyP1d/13zdBKlf55/XR+G9EPieqO0UIQ+NgK7lFiD8fZtYJXKeg2E70iWo+YGSyHe+BlOKFVw jbt6ll62mrjY0N0sH3DKkrgdIAbmNJ4AdM4U6uX3FMYf43kEh+eS8SLmk7s5NaAUdZLazZpY7ME sOLGuytbfXbqflrjDXbwOmne4MXE6W5NI1XcgkZCed4ImXGKbfDdUMvVGEelI5QojoNJBOhf35q irWNDnlCOCWDxrA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110743_246732_BA0C0B3B X-CRM114-Status: GOOD ( 15.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/phy/mediatek/phy-mtk-xsphy.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/phy/mediatek/phy-mtk-xsphy.c b/drivers/phy/mediatek/phy-mtk-xsphy.c index 064fd0941727..7c248f5cfca5 100644 --- a/drivers/phy/mediatek/phy-mtk-xsphy.c +++ b/drivers/phy/mediatek/phy-mtk-xsphy.c @@ -432,12 +432,11 @@ static int mtk_xsphy_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct device_node *child_np; struct phy_provider *provider; struct resource *glb_res; struct mtk_xsphy *xsphy; struct resource res; - int port, retval; + int port; xsphy = devm_kzalloc(dev, sizeof(*xsphy), GFP_KERNEL); if (!xsphy) @@ -471,37 +470,34 @@ static int mtk_xsphy_probe(struct platform_device *pdev) device_property_read_u32(dev, "mediatek,src-coef", &xsphy->src_coef); port = 0; - for_each_child_of_node(np, child_np) { + for_each_child_of_node_scoped(np, child_np) { struct xsphy_instance *inst; struct phy *phy; + int retval; inst = devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL); - if (!inst) { - retval = -ENOMEM; - goto put_child; - } + if (!inst) + return -ENOMEM; xsphy->phys[port] = inst; phy = devm_phy_create(dev, child_np, &mtk_xsphy_ops); if (IS_ERR(phy)) { dev_err(dev, "failed to create phy\n"); - retval = PTR_ERR(phy); - goto put_child; + return PTR_ERR(phy); } retval = of_address_to_resource(child_np, 0, &res); if (retval) { dev_err(dev, "failed to get address resource(id-%d)\n", port); - goto put_child; + return retval; } inst->port_base = devm_ioremap_resource(&phy->dev, &res); if (IS_ERR(inst->port_base)) { dev_err(dev, "failed to remap phy regs\n"); - retval = PTR_ERR(inst->port_base); - goto put_child; + return PTR_ERR(inst->port_base); } inst->phy = phy; @@ -512,17 +508,12 @@ static int mtk_xsphy_probe(struct platform_device *pdev) inst->ref_clk = devm_clk_get(&phy->dev, "ref"); if (IS_ERR(inst->ref_clk)) { dev_err(dev, "failed to get ref_clk(id-%d)\n", port); - retval = PTR_ERR(inst->ref_clk); - goto put_child; + return PTR_ERR(inst->ref_clk); } } provider = devm_of_phy_provider_register(dev, mtk_phy_xlate); return PTR_ERR_OR_ZERO(provider); - -put_child: - of_node_put(child_np); - return retval; } static struct platform_driver mtk_xsphy_driver = { From patchwork Mon Aug 26 10:07:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777610 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC149C5321E for ; Mon, 26 Aug 2024 10:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=w76jNQAWt6bAp+W3zUZ22TllXAAFoaq8C3LjT25NtVg=; b=1aQJ2gvuVkN5SGYi/bDAvXyPrW 5nVBaEA0OetzGLvP0ctr7vNCPZqof323ZC2VFYdCZyS8TJ8uQ4KllZs5uSe2h/VTxaGlwIPJw+Iny BsclmdqTbzdzYCf1M0CjeLpdawpfGqVwozN24P9U9FssTWfyr/xbDq5OLvXFH17dFvrDmat7wuhYv tnPXKTsA9oEoei5bXLD2ra9N13glQDDW09r/twBDsg/hN/0/UgQh5Ncvy/Y8SRUg/fK75V5t26Qda Dusw2dfnwDT94xuol+gHa1KRuLNb4c+CdiAjsCIF5Ms0YwkYtJJbiWN5hR/G7pcCVIc0Tqupc43W3 ycNaPKNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWkN-00000006sWI-3oLL; Mon, 26 Aug 2024 10:14:51 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdX-00000006qhm-32Wb for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=w76jNQAWt6bAp+W3zUZ22TllXAAFoaq8C3LjT25NtVg=; b=U7y7PTR63llOE3O6J/EAnGiqVL M7q+PN/MBh9wOqa+hs6WqF0FPlFT0g1PSip6PDzpaTUje7dzCH6c3Z4PszmQ/LdBHI6DFk59gh5OD WwA9KTNpqHDUUB7f9LG7KY22pqtjle1zy/c3g3LKyO6/sGwjVb/1Win/Ru26aiqRzAbT3fw/Cr/uW 1CXfwQOGY27QzyhgZxE3O1kT+tMdgruGVPvxbuGUBQh+lenNbDDRfFnrJ62C+iCzprLGahjYM0Xsp 9soMet+tDV7Waiggc8Zbpbd1TCvd52WQhuPvlleoasFZwAX+rzHuasvgl+I0b0me2X2+vMkOeoOul zZvQzx6w==; Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdU-0000000Ad9s-20FO for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:46 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42b964d7526so628865e9.1 for ; Mon, 26 Aug 2024 03:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666863; x=1725271663; darn=lists.infradead.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=w76jNQAWt6bAp+W3zUZ22TllXAAFoaq8C3LjT25NtVg=; b=MmoYJxw5AEtQVRFNe61sLwWL9esePIYl8Dv/guf49TOXrKtT+/EFLBBqAUKMAFriWh M0iGWFeMWJTsZPbxmpOMUysKisqIvLgAbSeuDX1OfkyselV7gn5lsswuxzA2B6STNcVT R2GudTSpT8eHe1lau4uoT+7q/QQPnNGghW7sz59R/saAYchipPHraxcxf60fBMhkTDcZ gNbuXC/KAOsEP0TCRzCVsPv+R03PW4vec7voijxayzBfwZBTrRY8f/OcBnsE2JD5+OBD CsuuDojMd3DD78pLHklEukzwArVI3eKDX38kZqRx0oweQrA5NREvR1cj/SWH8ur9KDi1 31/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666863; x=1725271663; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w76jNQAWt6bAp+W3zUZ22TllXAAFoaq8C3LjT25NtVg=; b=MURJPfRB3mTSeyQNL4EfFhuZzsJbrAFG/BCqk8RAsoqWISKPXE3WU3xUVsWA6uqsAt sir5id4XjdGxB32k9G4Gll5C4Lvawe2QfajUIVBAcpFg4aXHYdfu1XAcV4TnrEeLc+wJ 3DumP0hWneGuf6kpTpnysZjHYvkGFNzLqdq9wMlj+cJqRw/6i+2cu7OJGOZtj/nZtf/7 5HfveNJLrqg7Jjg+BXGwzx/9T/kOXiLBMkcShM7rOcB0CB7AtgqDLoTVmlCMxaoKQ1Kh o6w63ykRX86QXZSKIAEQfpV8svcFuy9cMRrAma6K/izPro5nicXmVmmiFkpijj1aJ2Dh 54OA== X-Forwarded-Encrypted: i=1; AJvYcCWoQWaRV9ijv9qkdmuH05Lp3H/V1OcYdG+NELM2g74xzZ4Y81Y0FcgYjHgmB9NDGIN3DuAO/Q9lnYv99AFTYey/@lists.infradead.org X-Gm-Message-State: AOJu0YxpSkqNuNR7ask+kUGuaFg34tgM5DwPArweY8CFJYyIy6XKCZ76 6RGEWlAWg+sjkNeciju3A+2vUHW+cf0waVspigGM0VQapy56/rdhjPOsZIzDTwJmhBXMEL2HUn7 w X-Google-Smtp-Source: AGHT+IExT3kmRSceNRiJcXglO6EQr+JgRlwbktOceZAKBgocM3t4FdK6T71lQ8U1bTjnR+v/YdTdjA== X-Received: by 2002:a05:600c:1d22:b0:426:6fc0:5910 with SMTP id 5b1f17b1804b1-42acc8d4dabmr44531595e9.1.1724666862755; Mon, 26 Aug 2024 03:07:42 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:42 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:23 +0200 Subject: [PATCH 07/11] phy: qcom: qmp-pcie-msm8996: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-7-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1922; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=XFJ5tns8gjfvYAtdDyTfcLoPh02DwDwXoBQWVHMfwN4=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPe01E0Dq3KWujpfT2EVykCertsjntcsXBD7 +xUsNUHtVaJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT3gAKCRDBN2bmhouD 14N3D/47LpfmUaVHVAo6X4RPv0WAxp15k+koHvm3j2dUhTy7ZzV4EXYQECCOfFGsB+CPzxwJwc5 Lg5d7XwJxs9h5sfcDWf5rvgrpSoPqbgPEgMt3ofDnhmXcpelT+lJwgZ9DxZdGMx46xMNr0PIA63 1RHnEPF5iJQlH1zjQVUaiUtIoq9H5DtH3i3uF2msnwsgYRl/r11LxSlaBb37HgmubTH0EYr/3aV UyG65tricVuY4f7q9XjgSI86CCCoPjiclzQoYKo2Uwrw6e8/kbt6F2TfGwyadrvLyuWdwca9UhY NwnzS5Dfc+jtMIm1MG9dX+2Xog9uutXkTRBVyN/JAPUw4COYFxLwvoGdRNFtaK57V96PZF8TduH jB74iPXTm5PWTrZQlbhZlAuVbYzjVWL8F6cI62QbCjiJVaZXzJyHlVTCDKTL4a+qKhtQitydsGi YymvzTC0L9jX7NsoATfnvbDN5A04ldqhv7gyRHIghP4YZjWk5FGQU4KZC7j3Trdm2SH6aCR6T7G jIww5t/cBdwRPzapjcCNHE89Qks4EXKfW8NXS5TysLeSU0okvPw3A9eqJH/YyBqLPBWkmEu06zw gciV7L+UwHo++g8M73hfXlCa8sLYeYOySlvoUr+GWhJoZ1IHIl1LMpwU8WGjxFU02xUhUganhfm 6E0aoiBNZ6ogpTw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110744_900379_BF8EF6E1 X-CRM114-Status: GOOD ( 14.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c index 5f89e3a3e54f..a7c65cfe31df 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c @@ -725,7 +725,6 @@ static int qmp_pcie_msm8996_probe(struct platform_device *pdev) { struct qcom_qmp *qmp; struct device *dev = &pdev->dev; - struct device_node *child; struct phy_provider *phy_provider; void __iomem *serdes; const struct qmp_phy_cfg *cfg = NULL; @@ -773,13 +772,13 @@ static int qmp_pcie_msm8996_probe(struct platform_device *pdev) return -ENOMEM; id = 0; - for_each_available_child_of_node(dev->of_node, child) { + for_each_available_child_of_node_scoped(dev->of_node, child) { /* Create per-lane phy */ ret = qmp_pcie_msm8996_create(dev, child, id, serdes, cfg); if (ret) { dev_err(dev, "failed to create lane%d phy, %d\n", id, ret); - goto err_node_put; + return ret; } /* @@ -790,7 +789,7 @@ static int qmp_pcie_msm8996_probe(struct platform_device *pdev) if (ret) { dev_err(qmp->dev, "failed to register pipe clock source\n"); - goto err_node_put; + return ret; } id++; @@ -799,10 +798,6 @@ static int qmp_pcie_msm8996_probe(struct platform_device *pdev) phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); return PTR_ERR_OR_ZERO(phy_provider); - -err_node_put: - of_node_put(child); - return ret; } static struct platform_driver qmp_pcie_msm8996_driver = { From patchwork Mon Aug 26 10:07:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777680 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF833C5321E for ; Mon, 26 Aug 2024 11:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LJH7gzL1aTMd1FSl3D4skxiHp7HFb4KrCiWKLzsaldQ=; b=VwZfdnNd7pa0l8vdDCRr+kDkp1 UW+OvwGKeL7Onq1cYXhnDMuzCmTO3vyKfnsC/fy8/6+4aHeRHtbSmqNPGn5Y3liqAFpMt39xRp+bi 1g+OJOb6Zk/7kZQvAm/DFPS6xpNEp/YVjCZMlaBTc7aA8ltTWjqX08reUK/w6/Tw4G74Ow152ETUd eGN113MCgwLdGYIyyly+VIAU0t7U5LIikuz/emCm7k7CRh+lmKujZifNKDyyhDKkevya/ZZEnqtW0 hJ7Sdzwu3amwiaIdw8UGQPoJsBqQvaKbvESojUI7WsK+VHBzEL2raMClf0k7HmOoJEzp/DuXzUMwS C85c482w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siXvR-000000078dZ-0HWf; Mon, 26 Aug 2024 11:30:21 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdc-00000006qkb-3lgS for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=LJH7gzL1aTMd1FSl3D4skxiHp7HFb4KrCiWKLzsaldQ=; b=aQrxcWZphI1AsJ0QOXbRoXdhu/ HKaKWdXML55UdWA+u1kG+Za79/swCHCPls2sLwlGGv2Uo0Tutu6blQu4XpsXfqsLVKd5dtOhV+akp 40ryvZKFzDsJ/M8PK0nowtUJQvRAekznossFz4hpkULLDLpxyEr4K7jJJTJJLUq409Wx95qStFwyz J1ZH4TFSwASD/w6dge1nNh60j8yv/tgrAfrhvhe+RJlhmtxX2tvC9+fJpVCgSGY2Z1OyGTpyXyHpK VYV072a9E86GYS3QG60T1IVfZ+W0sQ32O2DDRAyB8jXyQU0pMnExSeVef1QuFUn402LG4EoK/P9th FbSJK90g==; Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdX-0000000AdAj-0sI3 for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:50 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4281e715904so4609855e9.0 for ; Mon, 26 Aug 2024 03:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666864; x=1725271664; darn=lists.infradead.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=LJH7gzL1aTMd1FSl3D4skxiHp7HFb4KrCiWKLzsaldQ=; b=OGg7FZ29TeF7LXJf+T+CZ4uiX4tQSVYB2Y+ZrJ91d+dlqG2n1erf3vV2Ijt0kMcsuN 6CXOdRAPXASwJbTPrWDdfjL6TIVasD/AwjRCYXDDzeSNeNz5dv7LbZ4uThUNE3kEpqd/ lnFn0EZCJIcqtlmI5aDboIKihCy6RW798SKPkktKeIDonb9TcLzEfw99z+2Itjqb9Ez4 gLDr9PGwKKNmmXRs3jlE4FZak9QRFFwP7Ts56TCYPt3A/xm8bq34/jAWwDE1RDI7O0K0 GYJKqIO2QGnuXPgt3NxJTSYkuqGsF/K6fggsFxEbw2YEU13ScFjcgjjSboJ3g/uRaPFF SV4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666864; x=1725271664; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LJH7gzL1aTMd1FSl3D4skxiHp7HFb4KrCiWKLzsaldQ=; b=TM6ti+gMyC5YMkLY7hkueiIPT5jRdefK4dqAxkjCYWL9Xv8DAKXbDqhptRkvzTgac/ YZqatle1BsozmGDafNcm24K51WgwJSYR8PVgCresTvfhFz5I3F4df6YQQWNJN545/FWa KndS3JY78OoubeLpHVDBGCqPu1dL5VsUTu7LwxeU5vEFz1gNUI1f1oA1oxujxR4sIup2 amUt8cGa6/CJI7A+W3X+VFMrNNAlGMnH2DZyCzOcs2/o3g9FCI2uZl+1gS7REFag1Orz fTBX95v/y0x+iCIYrDcoMh8lIAz2Wj0pq32zVOKqNxDKmIj9kblYmJGPcGaqtU/+hZo1 dOkQ== X-Forwarded-Encrypted: i=1; AJvYcCVlLj8o3Dm5jteKiLufi8QsjCMP39mZIJ67Z5DTk/8gLnm1eAmR7ywgIIAfAHFtCauLhDcWP511+Pz9XqbUQ2rL@lists.infradead.org X-Gm-Message-State: AOJu0Ywxc5MlOGTh3w4UeJXO5tN/akWWneH/IuNFJm/Sm4I0hwefCkx5 vNixwfSL3kKg5/JJ4cf8ZLl0U4q+bSY7Ww7VNS/3wSRuHmntUUWtA7sNmkUX1xoE4ynF3Oy6pYk S X-Google-Smtp-Source: AGHT+IE7gdrYrwOwPxXE//4QC856859teFRpRbc14X0LTKkOSDn4Vd45gs5Ik+WW2PRPGPps93azfw== X-Received: by 2002:a5d:6d05:0:b0:367:9495:9016 with SMTP id ffacd0b85a97d-373118e9996mr3690028f8f.6.1724666864363; Mon, 26 Aug 2024 03:07:44 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:43 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:24 +0200 Subject: [PATCH 08/11] phy: ti: am654-serdes: Use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-8-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3499; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=q84FqGekrYD8KTQs5gy+VU5Crg5qXmyLk1XObeFSfeo=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPftx77rNEmy2lKEvE6nmjyeiGM/8vxfHVk3 1Qxt9hxkm6JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT3wAKCRDBN2bmhouD 17VdEACDE8+ajTSInapKgMwIRqo7PrspygrbulFRV7MG7gYQuFB9ZYxJChAIKilDS3tY/vSm+mm zka8Y2ZfUndSHX5z1j9a0k9HqItYyRBcF15JckSJS39yViVxdnO2So3JwRhp9ohH5RcBNLCgWXi oAXJD/xxYm8NoZluxZwpKr/P+e1DxZ/iTxE36qxsdmc0i5K1Lyv2MrhIccKiE5GNghuU21Qlmon pjYkvu95DSOsN4sCjuZ6mLJcHSJqSBMd+nTvI7o5AzdlCw32ewr/agT640du/9fH193lr4/juHX 7I9KUOrV85awMCb205jQ9OkoqUV6T6Z6UjBzZgmfXUjW/AF/fIv4rwgpzTPwQq7FHLWhwmlSmMj O5s0De/VhSO0k8dVIg3Yj8JfcgA1eQ0JiMQFWsD358pPj/Cyx5IPK+rGGImuSWRwtuNVhQg2mDB tE2t9r3u+tYrCEA2qG8TnKtaj6PXKYOnFKzf01e3TWiDxsfmOE8Zrwrqbt2ctFhMNWRiUBPq14v UEnylJsz6b9bx/vDX3iMxSKEspCoL2hXH/uh3PTBa0BxgKi/Wc34u84+oxNf9A2BetAzxMFu3E+ e1Ixc5zUX13AWl2KIQKnaC3M6hN8dT8k/BSTRE2enP0v6cWf41IzSjaNnlu4SyqhTbjuV7gKNdX eHb/19T7Mf/oiQg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110749_049620_466AFDB7 X-CRM114-Status: GOOD ( 15.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Unlike in other typical of_node_get+syscon_node_to_regmap cases, the reference cannot be dropped immediately after syscon_node_to_regmap(), because further part of probe() uses it. Signed-off-by: Krzysztof Kozlowski --- drivers/phy/ti/phy-am654-serdes.c | 50 +++++++++++++-------------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c index 673449607c02..3bf3aff4b1c7 100644 --- a/drivers/phy/ti/phy-am654-serdes.c +++ b/drivers/phy/ti/phy-am654-serdes.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -644,7 +645,6 @@ static int serdes_am654_clk_register(struct serdes_am654 *am654_phy, struct device_node *node = am654_phy->of_node; struct device *dev = am654_phy->dev; struct serdes_am654_clk_mux *mux; - struct device_node *regmap_node; const char **parent_names; struct clk_init_data *init; unsigned int num_parents; @@ -652,7 +652,6 @@ static int serdes_am654_clk_register(struct serdes_am654 *am654_phy, const __be32 *addr; unsigned int reg; struct clk *clk; - int ret = 0; mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); if (!mux) @@ -660,41 +659,30 @@ static int serdes_am654_clk_register(struct serdes_am654 *am654_phy, init = &mux->clk_data; - regmap_node = of_parse_phandle(node, "ti,serdes-clk", 0); - if (!regmap_node) { - dev_err(dev, "Fail to get serdes-clk node\n"); - ret = -ENODEV; - goto out_put_node; - } + struct device_node *regmap_node __free(device_node) = + of_parse_phandle(node, "ti,serdes-clk", 0); + if (!regmap_node) + return dev_err_probe(dev, -ENODEV, "Fail to get serdes-clk node\n"); regmap = syscon_node_to_regmap(regmap_node->parent); - if (IS_ERR(regmap)) { - dev_err(dev, "Fail to get Syscon regmap\n"); - ret = PTR_ERR(regmap); - goto out_put_node; - } + if (IS_ERR(regmap)) + return dev_err_probe(dev, PTR_ERR(regmap), + "Fail to get Syscon regmap\n"); num_parents = of_clk_get_parent_count(node); - if (num_parents < 2) { - dev_err(dev, "SERDES clock must have parents\n"); - ret = -EINVAL; - goto out_put_node; - } + if (num_parents < 2) + return dev_err_probe(dev, -EINVAL, "SERDES clock must have parents\n"); parent_names = devm_kzalloc(dev, (sizeof(char *) * num_parents), GFP_KERNEL); - if (!parent_names) { - ret = -ENOMEM; - goto out_put_node; - } + if (!parent_names) + return -ENOMEM; of_clk_parent_fill(node, parent_names, num_parents); addr = of_get_address(regmap_node, 0, NULL, NULL); - if (!addr) { - ret = -EINVAL; - goto out_put_node; - } + if (!addr) + return -EINVAL; reg = be32_to_cpu(*addr); @@ -710,16 +698,12 @@ static int serdes_am654_clk_register(struct serdes_am654 *am654_phy, mux->hw.init = init; clk = devm_clk_register(dev, &mux->hw); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); - goto out_put_node; - } + if (IS_ERR(clk)) + return PTR_ERR(clk); am654_phy->clks[clock_num] = clk; -out_put_node: - of_node_put(regmap_node); - return ret; + return 0; } static const struct of_device_id serdes_am654_id_table[] = { From patchwork Mon Aug 26 10:07:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BEA52C5321E for ; Mon, 26 Aug 2024 10:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wBeiEf9X8N6xSFq/Sd6Q+1/33k4A8r9mRuaNtrYrkSQ=; b=O8N6f61MT9++zjzRlHOPCMre3K FO5tCax7L3A8BxnvIun6gUWnxcHt1+Fb04F4BcqX12sRMQVBZbVIgdlgTqVeNtvvbrWYQJ0Ik4IjL ZX4kR8H9Z/BHkeSa04xmXh5yAPF40vEmowEg6tnp3WweAhVOBt7B+W3gb0SY6cX59csDsluw/UVBF lgmIXA5LkRfNeYNhtVXpo1xeJ3jEz+BT2kNa1hYn0760Cg3eShpIbjjXq5eTekI5+omUDl3342Vup Y0fh0s/Yq6yFPDRIa0+QvNrhEmKHrQhD/72TIiuZLhOBt2l1EXx8jOaCVNt/SWZOA70AIFSOkPTK+ 6F0RkJLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWpy-00000006uKb-2oxc; Mon, 26 Aug 2024 10:20:38 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdc-00000006qkc-3s49 for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=wBeiEf9X8N6xSFq/Sd6Q+1/33k4A8r9mRuaNtrYrkSQ=; b=Zceo3t9BpCC+szTL3faClwc6J/ tuL3jCQ+T56kFARxMHO3X1/YQtAszzYX3m4fQDzPUe3sQFnE8xqn3TXf1T+ZfCzg89btM+wt4YJnG 54mX7Vz9Rt0oV07ngwvGzxN7rUAg9Xz9uDiSdGjpydF0Qqg3sFiDpM39UnsKZuQq415Loc9vz32yl 4BzZr1xit1qYjvdtkhV4i5xGyrxAJzxYa6471pMyPS2fo4XalA/8ZI8cjNu09ao3lNkM08U6z9Suh otN6xptQbQMhov0trD+R9tiykRsdysulc5AxgZajNpjjF93A5bUqIxOE8/bLo0Casm02XS+dLK4sy INkMar3g==; Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdX-0000000AdBo-1ekq for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:51 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4280692835dso6308785e9.1 for ; Mon, 26 Aug 2024 03:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666866; x=1725271666; darn=lists.infradead.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=wBeiEf9X8N6xSFq/Sd6Q+1/33k4A8r9mRuaNtrYrkSQ=; b=lU7LhK10qP7zkvCw6foy5ZP+dPNfOzk45p4egq/ueLjXZMVIDu8YdSocZbbFdi5ns9 MWNDDV3ooSGtPvMpJb9bUy0NLe4JDSfHabvQ0AGPVB7T9k+5tLOVNpuHBtuFyjiGSdsB A3M3ozVoAF2XHIAmPL5SBzwn07QGGMrV95kJgDHo5TXjxQdGUQnl0jka0aYBtTZGCH6t B9n1rMx82bazIh9g79UV9pk37ETnEU5Gkk0KwE3Ye2RVRIUoN7lGMiFHnpFLEFiJbwrq cRFtAlCaO1xFAjm792BSfd5vBcvlSoXlJlkh6gCwzTr1CBZj0HIrbH8TRbleT0blLo06 0TkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666866; x=1725271666; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wBeiEf9X8N6xSFq/Sd6Q+1/33k4A8r9mRuaNtrYrkSQ=; b=p7XsBvWpV36KL2OR4zD727R/kn3/k1stpgSMu8he7u0Go6t4MQoZglv+SLq7K9mCvy ApBepusMWOffF6The6PHFg5xRdysAe+cLM2mkwLyfc0FCKwru+TO6NG8mg0hwfzJZsuh qZ+RBqFYBDRB+IJBRglA03eHQlD/wKhUzerVPxvkWTARMHR3ZFHvzyTye3ULb9UFc68z BONzVyh2hGjWx113RRqrXBoGwbbZDV16cOlQPGJE51pnMx6jGhRkfreporUxwpfaf+AM NWYeAdbu+OYhMaGDEux9jOsleyPF7O2fkTcAaVWSNoSAE3tgTPDb/T2WzecGYJnDkK3A 8E4Q== X-Forwarded-Encrypted: i=1; AJvYcCUoin33KKnAjUPsWfshjgztxsizwtXSjhrRZ4QlTHiy90sqjaba2N9aPEyzteF8CHrlJ+f/HGEljjdLG5oqpMWF@lists.infradead.org X-Gm-Message-State: AOJu0YyOqhj3D15Yc3SOspaoVtUV1fz5SFWRj08NsnQacIy1UcJPxKGp i/hIH+kkH6igOaoM5juyzUYd+tkpEM4ISRB5m4wwSPRlzT6KgLw5KPjpYw33DN4ugFqJV9yEWOy n X-Google-Smtp-Source: AGHT+IGok8paLmSnpgAD267hn+gsKafIUp4M7EbxL8F3BzEx2cfwlqJfUxJ4Ip76g3TR7Pw0QL7lUQ== X-Received: by 2002:a05:6000:178a:b0:368:4c5:1b5a with SMTP id ffacd0b85a97d-373118e9be9mr3513537f8f.9.1724666865829; Mon, 26 Aug 2024 03:07:45 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:45 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:25 +0200 Subject: [PATCH 09/11] phy: ti: gmii-sel: Simplify with dev_err_probe() MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-9-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1502; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=wdcz8XiBcDZ4nb0AOyZykqRBbhQuQooZzPq8xpdRV9Q=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPg7XFF/j171N1twJsIMBg7OuBUTIrml6/H3 z9mJ585yGaJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT4AAKCRDBN2bmhouD 15gsD/9NG7meHEPdkGDSA1PRkg5U5KXHnzxvUKotKxcO1clvqIkAji/rh3oNkqiVL+FPmrussrg hDEha6daxxni20jY+Ps+KDwx8AEJx/V43b0u9zIz8mznDtIJP+QV+w65ItVJMER4EL4qFrrvNoa 84PAeHCNHzZ+yLYNMU5OHdd34ujA4aj3PG1RmhcTGHROblTW5Yo0X0FN5K2CUyqsQTWmOCftmC7 na/onL30T6APTuiL8MM7nxnifJQiejwoEAMCmuMShcfMxb2TSizTQDE2ngzW7k+rEaYYmvxTliS 6BjwvzLXMtXfGYPkqEo0sBTfKvF7BTjGkNO+bSqwqwCzgOFCUnw9amfi9dPWX3UnNeShsLOHEcg sehqouSfwTMyQlfK76x8h8hFGbP40KlZv2HZbHnEoXKZQ/qU6KCcHaHIoOzA5FMDpZ68Zjotu2W LTAeT5wfYwqcq0V+eOWZ2mERiuw5ZQfK7eqE5m4pb5Zqgnker6X9zm/EPSrE4Ai7O5VgE6jz8hs zYAfE7cvePsM2H0lwtG6C2nwx042tFYgGfFNNXp2ElpjYOLV1LXedhq1TruxTPXlOs/uEYVsp8L cD1t44/kop1FGB241wS/jpWalj3dDyx7/aXSoWpydH0n5RKrHxtztgp0t7fp3xgqmOhC+4234Lf /t4rWoyAgjN2j9Q== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110749_507841_CEECB864 X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use dev_err_probe() to avoid dmesg flood on actual defer. This makes the code also simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/phy/ti/phy-gmii-sel.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c index b30bf740e2e0..103b266fec77 100644 --- a/drivers/phy/ti/phy-gmii-sel.c +++ b/drivers/phy/ti/phy-gmii-sel.c @@ -468,11 +468,9 @@ static int phy_gmii_sel_probe(struct platform_device *pdev) priv->regmap = syscon_node_to_regmap(node->parent); if (IS_ERR(priv->regmap)) { priv->regmap = device_node_to_regmap(node); - if (IS_ERR(priv->regmap)) { - ret = PTR_ERR(priv->regmap); - dev_err(dev, "Failed to get syscon %d\n", ret); - return ret; - } + if (IS_ERR(priv->regmap)) + return dev_err_probe(dev, PTR_ERR(priv->regmap), + "Failed to get syscon\n"); priv->no_offset = true; } @@ -485,11 +483,9 @@ static int phy_gmii_sel_probe(struct platform_device *pdev) priv->phy_provider = devm_of_phy_provider_register(dev, phy_gmii_sel_of_xlate); - if (IS_ERR(priv->phy_provider)) { - ret = PTR_ERR(priv->phy_provider); - dev_err(dev, "Failed to create phy provider %d\n", ret); - return ret; - } + if (IS_ERR(priv->phy_provider)) + return dev_err_probe(dev, PTR_ERR(priv->phy_provider), + "Failed to create phy provider\n"); return 0; } From patchwork Mon Aug 26 10:07:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777612 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88342C5321D for ; Mon, 26 Aug 2024 10:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yaF6QgfmysOfNqqYP+GDxy50eaU5ex1zhyz/GA1ShuE=; b=hsOPA0KqtFqfckpeURHF2b+/Et YwDLvqRNkbmxhad0/ZJrs+9QLCfwSmOQ/Vkfh15DNU1T9wlkJ3AiqRanT8nhLP6jkuHUC/JNPhri6 IHuC8V6DEbpa7itIpRB/SQUxpoN2mt2PcDUul4+L1FVyzRRxy/4cR7iS2RFIZhbk0GiK/W/g5kMI6 co2iqUXES3vvZzlTmSLFq7qeIOn4oCXTsqKElHmO8umgXh7uPTM3RKRIcEnxk1Uvrm9gn4XEdFeH2 qfaFe3rpXFPMd4qoFBnszQ4oWoToDuGZ8OqlBBcTw0MJpgxtpVrG51cUl7g1NZw0KRLWctbasd8yp QnB8YZpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWqi-00000006uUT-2HGz; Mon, 26 Aug 2024 10:21:24 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdd-00000006qkt-2U58 for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=yaF6QgfmysOfNqqYP+GDxy50eaU5ex1zhyz/GA1ShuE=; b=HTKScFL4A9uGmhvG2Oc/+Kp1d6 fbUmC8cvSZyrRFIQofoacwVC5U57h7Xxs9Bae1Y7aYMMq64AQTjooDY3wJzdOG4nec6ssolfaGQ5r I06PQ6MNH5OHRF3KwD2c0U8Wq00uUeVhJJOjqBSA3pFGtjOqrNzonGCN1wzMnqLcRSJ+PuZzVWaDG zdB6Imm47O9+PQI0rgQrYmKMhvvGXscqV+oYIiex/vK1Z9gnzI9hdM/S8nWNOI0mD9aQaPfFgEm7T iO1Qimk+d+vpVNm7W816s2Hc5Q8Lqb6wtyxNNlBzbFPNFjbtaPqkUYKxKmYVeyeUgSjylwbL/EKQ8 swywNfDg==; Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdZ-0000000AdCB-3GnW for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:52 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-428098e2b3bso4585895e9.3 for ; Mon, 26 Aug 2024 03:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666867; x=1725271667; darn=lists.infradead.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=yaF6QgfmysOfNqqYP+GDxy50eaU5ex1zhyz/GA1ShuE=; b=AA7GOgAx4ZOTMbZbQ/HqHr4N2RvSJt4A68+rDCnQjaaNvyAIvVQiEQs5e6Akib8UOp KFtNEr7IBpoaUV2gZmMVoMGnGaNDCYcoFoSMGGczsMvlfNxT3yQxFnS7aJg23GPJyYwI 2H4b+obMi6z9vp6GVdWtZFE9BVY79VqzHA+LVfBaPVXAEivDbCVnRGhipdZl/J/n8ol5 r+uvUJj/X/A5q8Q36qfTPiYuIy1cT3ydAP6JQDKBU+sdFZrRlFcnNfd//NL0rCjdWQT/ 4Ul3BhvOWMbZFsVZmuQcuUk140VAYRunUkzThWCVHSPCss1M+KspLHAdS1FCRJeRnpy1 zg2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666867; x=1725271667; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yaF6QgfmysOfNqqYP+GDxy50eaU5ex1zhyz/GA1ShuE=; b=hUQsetGPK9GRw6O07n9C/lSmwKnmagrWWirH7h0bfcIApcBSzIEqhEFFpLWLlXn5sd rJi5UvU7q5tqHF9Vj/bDQo47lNqZFMNwZFA7uP53/o8AdZhWlbwPfoRbQ4ZKlVgmNpG+ oUibydGj2n8OXWNQk9czQmvZZegktR2C18oVaKcRip/xXSC3A3ubx8CkVQb4AXjY5s8/ M1LF1tuS1KLfOcmSdEzx8+fG0AVyGu4ZKV1u9qCJa9AcTrhXXhgEGJmAUxv9TUNpwIfL ZnyREwU0uAd2k6B+JlGlIC9DUq16yAnZ/aWKEwgQSLzVitydBaeeBglVhtnvF31xFYAa Asdg== X-Forwarded-Encrypted: i=1; AJvYcCW820QxBglG5D7UY554r3H8Ul21iyDk6lt8eKMMgMuqa71WReVrwpokUAxIBI3FgnVV6adOs7VP1/PC4qyjeVlt@lists.infradead.org X-Gm-Message-State: AOJu0YwmtxUzhhU8vOuzRtl5+8m8gSUIfI+W7l2SkoWWWB5yVuWekFVB TKPiWLrsoNTMS0S6y5dwsPjYBTxk5wP/EmPTSHrv53nFtBrAAt7668KnfUitRYFz7RKOTW+A+5Q K X-Google-Smtp-Source: AGHT+IGDefyzo8TsCXur56zPbKTgs1i3KNs13szZdv7eh34y9pnC9KoDGsSP7j4E6LCU4dV5ibI1VQ== X-Received: by 2002:a5d:5f8b:0:b0:36d:1d66:554f with SMTP id ffacd0b85a97d-3731185d6camr3670405f8f.3.1724666867264; Mon, 26 Aug 2024 03:07:47 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:46 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:26 +0200 Subject: [PATCH 10/11] phy: ti: j721e-wiz: Drop OF node reference earlier for simpler code MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-10-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1418; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=CGi3eChPu6bG3w6Fr69D9qqrpc9tkyPX1aqBhqlWnMU=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPhm3oloo7An+9It60VuGZ15r9nzj27gw1sL o+oziWrijOJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT4QAKCRDBN2bmhouD 118PEACOxoXjL+n59/jWzY3jIoc47J0kYcJAz7/l0WpzV8SwV//9ZGWaY3j9nMj4+KlF8m83BYR /d0i3XgYzbe4JM5lTAyPt+JpgZOHFe1xBngHAbYEmqxkzIxdbbt0HTUf3yoQO3Gl83y3hJReJus 1Zf4et4qDhqK1TALW+ssqeI7HQ1NmEz+kXDHs5vg5Zh6Ckap3OgX0pBBIcmOd/Vk4UJZtW8V07P eAMZRFjmHfZMERh+ZLLdSuC+zmhMRSjPkgmYYLKUqeBlJxrPXnBXmuc6NmogmtSB3FBEo6tKYre 9MnI03e22jWdETGojV2nKsIza98/EJY46aJO6bw7tLLdpoYbf1Plnau+Q/gKqu0r+hUFoJZCNPG vjHlwymMO+fGbK3/eb6MZdYm83S+4LJWrw4Q7HUJ3vUpCqXaJorZ90sezTGLBjj27xDN3ZTCYIv nXPxjRph97i0JkBpObEXsprCqFtyzJ08U+aivTVc+yLbCRHYaJDn7ADj02vRe0IDLPhz4hOs3A8 007ysTXKxr6urRswGzhWU/Rvrqil0rbl1Ncc6MxpSKVj35tgMfXfAZScXYcJTHeieRxgTSoRT38 lckyAklBZe8SbXTt5GKDUC3KrYjlik33r9bTXo7ft514cU5IUKBz1dnKj+daq2MbTTasQ4cR692 Tkb6i7/a0aURvFA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110750_046078_B2E24CAC X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Drop OF node reference immediately after using it in syscon_node_to_regmap(), which is both simpler and typical/expected code pattern. Signed-off-by: Krzysztof Kozlowski --- drivers/phy/ti/phy-j721e-wiz.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index bb16fdfe63df..d0f3ead3fc80 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -1179,14 +1179,13 @@ static int wiz_clock_probe(struct wiz *wiz, struct device_node *node) ret = wiz_mux_of_clk_register(wiz, clk_node, wiz->mux_sel_field[i], clk_mux_sel[i].table); + of_node_put(clk_node); if (ret) { dev_err_probe(dev, ret, "Failed to register %s clock\n", node_name); - of_node_put(clk_node); goto err; } - of_node_put(clk_node); } for (i = 0; i < wiz->clk_div_sel_num; i++) { @@ -1199,14 +1198,12 @@ static int wiz_clock_probe(struct wiz *wiz, struct device_node *node) ret = wiz_div_clk_register(wiz, clk_node, wiz->div_sel_field[i], clk_div_sel[i].table); + of_node_put(clk_node); if (ret) { dev_err_probe(dev, ret, "Failed to register %s clock\n", node_name); - of_node_put(clk_node); goto err; } - - of_node_put(clk_node); } return 0; From patchwork Mon Aug 26 10:07:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13777613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9A34C5321D for ; Mon, 26 Aug 2024 10:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wKZlzL2NZbeJxSHQJB09JnhRjfM+R/bIijlH4cu5cME=; b=NgL/cQ5CnxEurpJ69AAFBXIubD 7TwzcLlKWbicsKU9HAmYJaaK6Ky0HS/9MbZSnXEblkus9qhw+sED3oswqpD5+B3M79d4ajH6XdL/F zlzFdh9zBeavfCYQIhDKMQDIFV6o//hzhdpDHjFDmP5Q+iatuq3I5IQL2hN7NIifNlUJDCf6mHpM7 hxt3zpBeyHVUvhl2nIEbFToNff8a0Rj3dt74GvwQwLPWCfrFfLva3korfh9vOUBzkVhwz7ROQN0vr +ELlsoAW+9j4FkyUK3XSM4l3kRXV1w+IcvmY7ertMwWDFMeHe1sUsVT9KdAV7LkCq0Ps/Tf9Qybfk VmvH1JUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWrT-00000006udj-1ls6; Mon, 26 Aug 2024 10:22:11 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdf-00000006qlR-2yZi for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Aug 2024 10:07:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=wKZlzL2NZbeJxSHQJB09JnhRjfM+R/bIijlH4cu5cME=; b=qUgwnYwRo1VR81A+4IRmWwWEFK GT9Lurcltk2e1lgsDW6Hy2UHIW2jGrFurDqFConGJEb3KFwJVuCn9IH73y3t5zL2qGP6ign789T5b q4jWpogpCV7nl0EEXCcZFGjzE20ARX9WM43FKbCQgMb8GqM7/RLK/bZBUOPE2d8BfFba2hbGgRF2Q R7Hd2R4H51RXkcVqHWS4EjerldJ1GprD8pju1pY790BpjuiCz9O6olMKNrFMYoOshZ4OVpHafmm9a OZGu6rLJfTm14x3+icI/fevtsaBSAeRuwOlxx2osO3NDtGTFRa4K2n2poRO8nfO6dS9dtI4Qvg4DF wxZ9D8Hw==; Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWdc-0000000AdDM-308F for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:07:54 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4280772333eso6336175e9.0 for ; Mon, 26 Aug 2024 03:07:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724666869; x=1725271669; darn=lists.infradead.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=wKZlzL2NZbeJxSHQJB09JnhRjfM+R/bIijlH4cu5cME=; b=aohZYMsn/HDlhvs8xBRlzv0GcR/Cp7MUJkJtvoArevol4ePbIpGJq6i2bL6N88x+tg B8BAsSFeqozrLqma4+3GcmT3Tsm4aS5fKX5urc8/EJs1QJUAxi0kNoyQ2KupDW9QrFrn A1EPKN9UYSW6Oq+45oUaUacC6T7VYCP07hpO5U+OtHO5zmqPdbAe8vFtJbAG5D4O3Zjo uNLmFeN4/SE3RhrIVFts2WPz3GLAvXFbGk4PbfQkO5fXrf9srYBK3RytVLoq3UT4JdGo vUeKXpBHsGve4XeyBoIpb8zI/NdJlbKaK3vgtNNNsKLl+hKyd2WUx1s9SjMrCfRlURhg ItDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724666869; x=1725271669; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wKZlzL2NZbeJxSHQJB09JnhRjfM+R/bIijlH4cu5cME=; b=t8rujCgra01EL6FBCC0tAwwDXq45z0NIkFn966qb+ISacq42fnSTM8kXkgfb/Fyh8Y vWsuOIYXceEwuNS8nCORqxhtIkszoUWR32ocmq+bT8UHCGqLXhEZDL2VG+YltsXIm+tf DDFt53emdyFNbQssSUqvqlmgtzsMnfZQXNDLLhGAJDBQr82ODy/Qcp2MRcX+S9pl7y1H J/WpjM5G6JmN7xcs95L+dgdW++8Sv44nQ0rk1FYcxbM7MfAQZUC3o8fDODnlI/zzOa3g ZUUoRF4Ec3R4jlKAIRJ9JL7YvoSR/2EG6/KXEcFL4SVwmfXyk3oLfJGqRvR2WlUkxRNi yPtg== X-Forwarded-Encrypted: i=1; AJvYcCXn9cSNFXWJCIhq7RlwCpHK6szb68SCbW3ptlnaw84N/DRgxxehb5u1iuV9C2WubRRGcSTrefes1y8f74zzo6Rg@lists.infradead.org X-Gm-Message-State: AOJu0YzMZtGEfy0kdWfL55vNbhsKk592+cCAH325efnO0iq9llGXpfnC 7euGHHQWivxW+Ni7M1JLHlwzJ89Tf+/AfAcI7D+TeuIwrRc3uUG50/bjxze9qHVuk19dIgzGYNv Q X-Google-Smtp-Source: AGHT+IHpsbxr2jatXOo5ggzUHc4AhIIKQUY/zOn1ZCBV5PQBOfgESp9ARtTvX8s+q9//U0p353spAQ== X-Received: by 2002:a5d:6481:0:b0:360:872b:7e03 with SMTP id ffacd0b85a97d-373117ba829mr3896712f8f.0.1724666868800; Mon, 26 Aug 2024 03:07:48 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37308110009sm10324821f8f.18.2024.08.26.03.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 03:07:48 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 26 Aug 2024 12:07:27 +0200 Subject: [PATCH 11/11] phy: ti: j721e-wiz: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240826-phy-of-node-scope-v1-11-5b4d82582644@linaro.org> References: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> In-Reply-To: <20240826-phy-of-node-scope-v1-0-5b4d82582644@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Chunfeng Yun , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1369; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=w0e0ayjuNxyXuvAWm5UI9oSMx8HCNPzhkU4MAGzlhMQ=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmzFPiG/KFFJ/l+/AwfobhDy9BkMVA4hidPlmBJ BxVdEXyoG+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsxT4gAKCRDBN2bmhouD 14gOD/4gnPbwGuH5BNBzq+9rK8+/r4dwG7A1IcyXYdYsWfau5R0tw2zv23PLPhzCYNA50n6txqT C4oU6FGzQV4QlgWI1kYnfzSqQc7rg4Nbfz7nqCcF3C/fDdThpmB+v3jVhkB1y9gGVsyYA0zOBYt iVU9WqZPPrtIfMWHBnMxl0/Sh26CUVyzVG5ZPow20y9RExDuAPrlJvqePRWEBPx+vPRvAccLzHB BeEfmlJPUx/fowwJgvDdGBVWbEUexJJ7JqOr2GM870FVsgCuH4/gkQrmcL5XT5FvZt+i8/yDGVn P3MN2mJLs7+gzgLsOGkre8R6zBEO5q95XUix1+S2pQyAp9oDk618h2nK06X87jmXPfm0c8Wsg4Y iRQ9GqsZh45L3QI4hsGT2nIlOYshaS1/9UQ3n2dnRVUaLgV5PG1IzZA2itCWcC+HFgvqaqIrYBI rlAS4yWLacWX1JmJ7AKfX4zwwkeZDvspdoqTZ5NS7anNEMA9TSw5PHj0iNvRr/ardFTQx/kt9Rt Uy1Yfn/QQWQCIZWYwWVopcjVmB01bpBhRV9iVoBnAWXao7pnQa4SmaZeNNupsIO/Z1wFPV7Bqjb PqeKkzw1ByOii2k+UDDiHn+jkwVSkOC/G+itzuyQ/ojBpWAgMS7kpNDOS/AeogFPFk9jrG9p/CG 8Y6+jVZpDl7Mm8w== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_110752_919947_B207CAD8 X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/phy/ti/phy-j721e-wiz.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index d0f3ead3fc80..a6c0c5607ffd 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -1404,7 +1404,7 @@ MODULE_DEVICE_TABLE(of, wiz_id_table); static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz) { - struct device_node *serdes, *subnode; + struct device_node *serdes; serdes = of_get_child_by_name(dev->of_node, "serdes"); if (!serdes) { @@ -1412,7 +1412,7 @@ static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz) return -EINVAL; } - for_each_child_of_node(serdes, subnode) { + for_each_child_of_node_scoped(serdes, subnode) { u32 reg, num_lanes = 1, phy_type = PHY_NONE; int ret, i; @@ -1422,7 +1422,6 @@ static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz) ret = of_property_read_u32(subnode, "reg", ®); if (ret) { - of_node_put(subnode); dev_err(dev, "%s: Reading \"reg\" from \"%s\" failed: %d\n", __func__, subnode->name, ret);