From patchwork Mon Oct 24 11:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420498wru; Mon, 24 Oct 2022 05:18:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4okPfXr9NHIS8T2Y2XwBgFo0Jd5PxozSbM7vZgWmzRc/HM80iLADDllzaBmEpZwZ57bLpn X-Received: by 2002:a17:903:2285:b0:185:44df:d916 with SMTP id b5-20020a170903228500b0018544dfd916mr33178508plh.120.1666613898763; Mon, 24 Oct 2022 05:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613898; cv=none; d=google.com; s=arc-20160816; b=0jPOrdS5sooqciabUE4jLuKCaHrcyLGBoorWz87W07b4rIKhclALuKmgHOSpfa1XT8 0QXi03Nq1cEsibmxHLIzmVyH+S2iDMIhi8cNutc+2I51LRuZ89pvSfKHoMVgX5XEqHfv MxL+wYQp8rbu9KB83sXEtBMYI7bal/x9TlxUozwo4NQD3MPZsR2MegFXte2Sreimm09M hEk4T40rWYUQxCuJ0NhJmOfXDcGgNVQuI5PaIjS8pOf2Ax/OlI/br1NdoBXlubJrsLM8 IS4PJ46D/2OsCSmyNbfBMjXZAabeznOflwyAxRVYgV7A2Sdf3qCVedxMutxiYvueFLbc LxhQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dHk0QGzyE8tdOa4kNUINhMAOwAeFezv00xydwDHrwdU=; b=o5b2Wc0ZF9uBm/D1XUm81zBMx0kgIDkIixOLH/LJs1PdR0P2tE2CdeOD0aJG7uZxhu 01MPkYupyLoXLuTIwedHgjFM37xAuUBxEreK1BAEw4mKg4fzJN4mI2RIe/uTULi8S/6l Xbp6IWWAYOe0X0r/MdNh3JGkLbp9SbD1y0aUx9EFVzCLmbl1PUArnNEicVsvLuW4DFdA RvUC/BRasImHV2vyihiYR/taf807PdNkRvvd3KnwkxsJoDy4xygb/fDc2LnO02ONUgvT VqoFwVivDjAXfK4suiCzyZuNVJABpiCWxcaPi8dZms7hJRjOtgGEW4u9JUc8oADiZ9u2 gdQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=guIFiKPQ; 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=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y31-20020a056a00181f00b00562a1693523si36053016pfa.20.2022.10.24.05.18.05; Mon, 24 Oct 2022 05:18:18 -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=@linuxfoundation.org header.s=korg header.b=guIFiKPQ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232911AbiJXMLy (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232830AbiJXMLH (ORCPT ); Mon, 24 Oct 2022 08:11:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A78BE33362; Mon, 24 Oct 2022 04:53:38 -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 5679461253; Mon, 24 Oct 2022 11:40:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A7AEC433D6; Mon, 24 Oct 2022 11:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611641; bh=ZEqcaliMDR/EDegFBvq7Wbf6roDmqbNtSYEaefYeYHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=guIFiKPQEim1ju0+ZOtqA9FaZDKSalc1Zbk11dpkXr4OMH+N8Htm+DoFvhKVdscVh DvTelgTG6Xky6BtJSWnsIslFAb1do7j8wlOpgJuc3DaUCyUv1Vv/TS8nomejXmTIGj 2S5bQUHUF6Ru9E+al0VtvwABR3tyY5Gc5drOFiZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Stephen Boyd , Sasha Levin Subject: [PATCH 4.9 015/159] clk: iproc: Do not rely on node name for correct PLL setup Date: Mon, 24 Oct 2022 13:29:29 +0200 Message-Id: <20221024112949.908348716@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 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?1747571335972609429?= X-GMAIL-MSGID: =?utf-8?q?1747571335972609429?= From: Florian Fainelli [ Upstream commit 1b24a132eba7a1c19475ba2510ec1c00af3ff914 ] After commit 31fd9b79dc58 ("ARM: dts: BCM5301X: update CRU block description") a warning from clk-iproc-pll.c was generated due to a duplicate PLL name as well as the console stopped working. Upon closer inspection it became clear that iproc_pll_clk_setup() used the Device Tree node unit name as an unique identifier as well as a parent name to parent all clocks under the PLL. BCM5301X was the first platform on which that got noticed because of the DT node unit name renaming but the same assumptions hold true for any user of the iproc_pll_clk_setup() function. The first 'clock-output-names' property is always guaranteed to be unique as well as providing the actual desired PLL clock name, so we utilize that to register the PLL and as a parent name of all children clock. Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support") Signed-off-by: Florian Fainelli Acked-by: Rafał Miłecki Link: https://lore.kernel.org/r/20220905161504.1526-1-f.fainelli@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/bcm/clk-iproc-pll.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c index 53006f4305f8..d52f2b810a4b 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -621,6 +621,7 @@ void __init iproc_pll_clk_setup(struct device_node *node, const char *parent_name; struct iproc_clk *iclk_array; struct clk_hw_onecell_data *clk_data; + const char *clk_name; if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) return; @@ -669,7 +670,12 @@ void __init iproc_pll_clk_setup(struct device_node *node, iclk = &iclk_array[0]; iclk->pll = pll; - init.name = node->name; + ret = of_property_read_string_index(node, "clock-output-names", + 0, &clk_name); + if (WARN_ON(ret)) + goto err_pll_register; + + init.name = clk_name; init.ops = &iproc_pll_ops; init.flags = 0; parent_name = of_clk_get_parent_name(node, 0); @@ -689,13 +695,11 @@ void __init iproc_pll_clk_setup(struct device_node *node, goto err_pll_register; clk_data->hws[0] = &iclk->hw; + parent_name = clk_name; /* now initialize and register all leaf clocks */ for (i = 1; i < num_clks; i++) { - const char *clk_name; - memset(&init, 0, sizeof(init)); - parent_name = node->name; ret = of_property_read_string_index(node, "clock-output-names", i, &clk_name);