From patchwork Mon Oct 24 10:06:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358090wru; Mon, 24 Oct 2022 03:07:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qYI8PV/3fcIv3Z7i9iqybWptvU5J7U88pGDL6tq9txbTr2SqqzQPqVGIzc/NzjwZI64cM X-Received: by 2002:a05:6a00:1810:b0:56b:f29d:cc8e with SMTP id y16-20020a056a00181000b0056bf29dcc8emr1761516pfa.33.1666606072682; Mon, 24 Oct 2022 03:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606072; cv=none; d=google.com; s=arc-20160816; b=FFbMPjmIGTK2h81e8OgG47nLyoJD6Cn3hqjHGkVbwaym6kdYnTFzhd20uApbXOxyxC Ni39gAW6GSWLP/N6dXfR5ZQxU6lAe3lCtDPuGUL8fp3yjLHTeCeRmRpDwTD1AwdE37CQ HUG0hgfSt6+AjGwhhcxML9HKyjZ59i75Lsb8xucomvBVzghsW9gkf+AGvfVLPH+Awj/2 IkWggvlar1dQe8U/NnjhhDdAERlpKxrOnM1a7u4QL2kPnha1uKk248WFCr6TjcMJJMCi /oDUq9uaTrgH0YYd6rYxz4Ky26+mMECF2cfdFNquI+wx+Jlt+zIEtXmPIr9gILwcFzfx 6mmg== 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=faB9CZdL8RZ2VIntSoJV4V1o33EjKs7bwnXwYHjM8UA=; b=TZEGmbgS2uQAO+XpqP1rZt6wjvmjfyr+V1pbFkOqJKmmx7fj6LuX2OWgHY+z3Cyc8B Tr6l4KCG0KZS3/a3t08t6JDiQC6RtyhzKsKRuSL3c73fTh2YLnXCbHcVoGGHtJbVs+AJ 9HmrSA/X73yuu3dTrCUMcKhyS3I+mlaFUjxkyR42ZG56POqJOlFUIlh0CEw2YkYZDhcq DoXGCz0WsMIfw5Nq9eni8qLfNt+bLTYfbwLuMTs/Lbc8jHKWMqA7e0q6sWn5Hkuf4Naa /aETtUDRWJje87mbminuC+j/eYomjeW4599tNhWJzqsxv1Z5RUGt1Bud0/oqckwKfUQO prSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fZOzXIUk; 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 pt1-20020a17090b3d0100b002131d141ff5si1703500pjb.117.2022.10.24.03.07.39; Mon, 24 Oct 2022 03:07:52 -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=fZOzXIUk; 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 S230455AbiJXKHR (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229730AbiJXKHJ (ORCPT ); Mon, 24 Oct 2022 06:07:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E631E33E08; Mon, 24 Oct 2022 03:07:04 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 75E79611B3; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 538C9C4347C; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=PEit2jIpLlK9bUU+cJjrQ+dNfgmnYX9dhRSclH2YI4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZOzXIUkJ1DGrg56weHIwToQSxV84wnvlQoYIcee6JGfsA8tNIlh81YZYIAxgihTb /8gdvrJUgPgM4BW4uLNpgprFw1c0PtRCwL+ems5nP1z71FD9VO+0jA4ZtdZE1HMyHw sl7B5ZQVJrb+7VsPIlNgWpkZnDeJO6k57TGvqttN1CZ8KAWGMP5L0ZDuqoBftxOf/U ltIhNQrqjdy6BqGVSPvTHP4D8QwIdg0mjbh9S74ih3KCO2KVZInaBV49IVOzscC9h9 1n1/rC2oEPwXKxw3PNl99FQ5SdFte3bTbgQUnbNaaZIztRcGToqxxYgbpBfuPH7LLd Xhz+tSIHoZvFA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005MJ-5h; Mon, 24 Oct 2022 12:06:47 +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 06/13] phy: qcom-qmp-usb: clean up device-tree parsing Date: Mon, 24 Oct 2022 12:06:25 +0200 Message-Id: <20221024100632.20549-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-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?1747563129100603983?= X-GMAIL-MSGID: =?utf-8?q?1747563129100603983?= 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. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- 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);