From patchwork Mon Oct 24 11:28:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417070wru; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6l5DHYF1bbxHxNXa3lfw2WQCYy0vm4p+gHSgi50ZZ00dl3dZmUhAiO1vHLUUH9rENxNDuL X-Received: by 2002:a05:6402:5114:b0:45d:b850:a4e2 with SMTP id m20-20020a056402511400b0045db850a4e2mr29782125edd.316.1666613554788; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613554; cv=none; d=google.com; s=arc-20160816; b=H1/lkwiWrdYgnRlX7LjQ4DscOrU/btbA2BB5Aenvg7VO3rTvN56KH2RnMUM6WIlGjF WFb62sRAJOguOYDnxl5O+nFLOJ2VLN2nDEqNkcPgi5WBJIXaFjFnBSg4uC+ycUVXr6Ok sKNYHHEEz9s8YtsOwDsx1TWb/+xyc/cylvYitbHVmlndPb6f/ci/EkVt1Pz6FCMFcnfu HBSOYCHuD9o8S7aHQ+UUGCHfeBmEI2B66AUXWdp07oUU9LlccDvjSUzOc2EpRtpaEnf8 SHJT5+sfzSIi3mD/9RkEAhfBfukZzyDhnRbonSZXQOeN5J4G9KFyZicvcCrwKtmOLs9m BVFg== 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=EyKsbCRXhvavq8CHsNqJMK8wL0swR13JtvgRNc+jgC8=; b=H0ZcEnYRcfscN6pqj/BXx5AnT27znjRS3IriMImkCCv1T/pGkEM3s/sg9cZL9FWXGG x/uINZmhlNtP/BQRl5wmRm+20dQA/07KKtzxJ82NLfd+zJDHfdH1hoELOOjUZmbPrwMN SFKKlFJALKWZtrD/LHV2EwzEQe+1cjtT8LCvaTB8qbLucFclYt6QGPS0oK0qsoLTenbN onMOKhWncnHQRF6C50tmD/63DxA5bUNfqEbGGjs+OzRrHFWnMK+WaIczS4A8gLRMExAr YY5i7XyXUhXWCKbtAGX4m6mUDqYm23BoQNfhw/TsQMP2vRfGQuRAqoOAxhgqouLSQgmz P3Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WLFP1AGU; 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 b18-20020a056402279200b00457137b2571si31011324ede.346.2022.10.24.05.12.10; Mon, 24 Oct 2022 05:12:34 -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=WLFP1AGU; 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 S232461AbiJXMBF (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232460AbiJXL7A (ORCPT ); Mon, 24 Oct 2022 07:59:00 -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 6045E76477; Mon, 24 Oct 2022 04:47:55 -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 4B7C36125D; Mon, 24 Oct 2022 11:46:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F193C433D6; Mon, 24 Oct 2022 11:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611964; bh=d/xpHVEVIyaWlHQDxxHGdkYh53L4gC3suwuiCWj92YY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLFP1AGUIeqYbA8FqVUSNEcQJ7VXAAcyznCbFo+t/NAK43zCieaduUM0zHECn+iQa zqCbQNURiOc4Pw1GFogXgGesH+GZC/elhv/+EG5vP00MqgaD3Dhl/+1jsSNqZqxJ/7 8ZGgqu3t5KI1jCv1yyLEwxfBC5TSKA6tiy5oO5Aw= 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.14 019/210] clk: iproc: Do not rely on node name for correct PLL setup Date: Mon, 24 Oct 2022 13:28:56 +0200 Message-Id: <20221024112957.581294171@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747570975151974388?= X-GMAIL-MSGID: =?utf-8?q?1747570975151974388?= 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 0e858dbf2505..2e59314522dd 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -621,6 +621,7 @@ void 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 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 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);