From patchwork Fri Oct 28 16:04:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp915949wru; Fri, 28 Oct 2022 09:10:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6THtkq075+YEdmfqsB1GXTgXintXjPt/MMfIOAMc69BtrpQGpBY4y/alkTcUwWDd31oEfQ X-Received: by 2002:a17:90b:3646:b0:213:812c:7c62 with SMTP id nh6-20020a17090b364600b00213812c7c62mr7725077pjb.194.1666973411015; Fri, 28 Oct 2022 09:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666973411; cv=none; d=google.com; s=arc-20160816; b=HzQayQOWf/G15fJm0vfIJy1/+BEmo4hVdzw38uAba8bnoMl5bps2ja0FpanvWgV3/g 33PXsa9TqjzHqbHakZfkjGhLXt0KxRLtS7lASYWFKfQqbB8/fHu1qazTbGor8qvqMDX5 s3kc9cJp5Jxeuui1r41jv+Msd3CklZjKoWlPU3J70PVpIB2ZMhIYwnHD7Im/VDeHiOE6 X6vj+Nb6RxzcWGQORWVr5kotDmBEfFxxR7EuRXn9aDSJUXJAgsNz6/MyMLk4Kqxmtwh5 2CDZDAK4VhZg4KUF8SHRnCbyTIcUwUHjRc+abyt2wvnF4l4NQp/9ppeyXJusUamJWmQM 2kSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xpled+vXPYaoX7d0+Exk+MMdEy3pj8D4XFa+4WIjetY=; b=dr006M4yKPO6YTjVWnPQiKqFLNz9ut6cxUOFDaqmhh58dhdYjLDGUXXfRJXeL92YGc RAX04i0Nn7RMBPHhxEBBAQ3d9KGalHMDo7dYfFTBtlO9g/obXwDDelJyqnHTHHlaK/a4 MrK71NeSAkz2Qd+UWbTMfZturBMtcO8EekJngq7Y/VHRMUq4aeK91vX93TldgS4/GGmj bcSNbTFIkz15t/LzULbAFlZ79QaQwglBwoVoO06bbMjjYk+Gchhk0vgoTUg9SwgydR23 Zwik8Bis38LQcBTx11Avm1sKXMNYikYn/FC8AKbvCX78kpZ4P2FLWKOucFVZIAan36Ha T76Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uEFdQegN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx17-20020a17090b4b1100b002131d14d06dsi6688671pjb.159.2022.10.28.09.09.57; Fri, 28 Oct 2022 09:10:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uEFdQegN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231147AbiJ1QHr (ORCPT + 99 others); Fri, 28 Oct 2022 12:07:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230316AbiJ1QF7 (ORCPT ); Fri, 28 Oct 2022 12:05:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4163F33871; Fri, 28 Oct 2022 09:05:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C0BC3B82AEF; Fri, 28 Oct 2022 16:05:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E40C9C4315A; Fri, 28 Oct 2022 16:05:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666973110; bh=LoebmK+dBQqJvUZEDYtP9VtGUiwSzpQBi7HG41jq64s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uEFdQegNekDVNoBvxNAA/j3yJVs3rXqU9GUeLNo9tntOKCIbZo2ed+yn+CgCaOMdO 4b7tXb+ft6bSG7DenmkD7JkQTs8jYz3iAUKplRTJlLMb2weipsxCFdJSK+7Moe/6XB Ou4e0xKioSBjpahYk0a7ieWlHzMwHvsi1z+W/hlqger3da7XU6maxTn014MQOVUthS XiXorbt7ncgnCJQ41V9QadYx1gEXslF7q2+///I3+mjRx156sWjpBGnJaVcokPSs3u 5PbCmA24daiSU7HAx98Vuu9+yoEVIi2GNAhwfs5WpX7DLGYq2Y0fNCRt7lnPLaAzyj sOZxkljI7MZag== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ooRqq-00071g-7a; Fri, 28 Oct 2022 18:04:56 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH RESEND v2 06/13] phy: qcom-qmp-usb: clean up device-tree parsing Date: Fri, 28 Oct 2022 18:04:28 +0200 Message-Id: <20221028160435.26948-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221028160435.26948-1-johan+linaro@kernel.org> References: <20221028160435.26948-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747948311328612801?= X-GMAIL-MSGID: =?utf-8?q?1747948311328612801?= Since the QMP driver split there will be at most a single child node so drop the obsolete iteration construct. While at it, drop the verbose error logging that would have been printed also on probe deferrals. Note that there's no need to check if there are additional child nodes (the kernel is not a devicetree validator), but let's return an error if there are no child nodes at all for now. Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 40 ++++++++----------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index e009d63260e7..ccb834a08d5b 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2471,7 +2471,6 @@ static int qmp_usb_probe(struct platform_device *pdev) void __iomem *serdes; const struct qmp_phy_cfg *cfg = NULL; struct qmp_usb *qmp; - int num, id; int ret; qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); @@ -2507,44 +2506,29 @@ static int qmp_usb_probe(struct platform_device *pdev) if (ret) return ret; - num = of_get_available_child_count(dev->of_node); - /* do we have a rogue child node ? */ - if (num > 1) + child = of_get_next_available_child(dev->of_node, NULL); + if (!child) return -EINVAL; pm_runtime_set_active(dev); ret = devm_pm_runtime_enable(dev); if (ret) - return ret; + goto err_node_put; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. */ pm_runtime_forbid(dev); - id = 0; - for_each_available_child_of_node(dev->of_node, child) { - /* Create per-lane phy */ - ret = qmp_usb_create(dev, child, serdes, cfg); - if (ret) { - dev_err(dev, "failed to create lane%d phy, %d\n", - id, ret); - goto err_node_put; - } - - /* - * Register the pipe clock provided by phy. - * See function description to see details of this pipe clock. - */ - ret = phy_pipe_clk_register(qmp, child); - if (ret) { - dev_err(qmp->dev, - "failed to register pipe clock source\n"); - goto err_node_put; - } - - id++; - } + ret = qmp_usb_create(dev, child, serdes, cfg); + if (ret) + goto err_node_put; + + ret = phy_pipe_clk_register(qmp, child); + if (ret) + goto err_node_put; + + of_node_put(child); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);