Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2522509rwb; Mon, 3 Oct 2022 01:53:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oo/r3wIHd1ENF8NQo2aomhcY4+YtJkSr4W52ynmcO3j1Tfti6pFEn9Qy6YQi59Yf299QU X-Received: by 2002:a63:2745:0:b0:44a:9b14:1454 with SMTP id n66-20020a632745000000b0044a9b141454mr7486369pgn.111.1664787233628; Mon, 03 Oct 2022 01:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664787233; cv=none; d=google.com; s=arc-20160816; b=S1ALAeuXGtO+TuCESLXK4K3x6haOxee/JNpWZ+HV18WU5I+SxITymailko6VsOcQZd wqCaxg2dvpt4jBWMwPrVyxwECIs2WdwyPUQwV0CbPhJ0OFWWv/6aqDb3UvcEMZD0vRTq FnVnE23jYOanzgjoTJ6MeSpujuUI9mM9Mj0jZ3tuAlqWMpVdCEDRuc0Grh/sPVnKeh6e Msa9RRhQJYEFV6FJcfX9kUOSD0AS2mPupwmLlDooaFmLkgMotL5XJopj53cpecUKCTvi 515E2o3JmoQ937Div/3zBQZ2Uw0NBgMBhjCnwK5uNRuYlFuz7JXasJJjTGx/88tv6vSW vOFg== 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=dwYm0RUbFK368M2+H1zlqiHJtlsW3tbwdGBiFSK4iEI=; b=Kq6BDPnWDrRQhrYEjtEcLrntGitvhRpeCG5PBjjKad7KPL4yjqyIRz0hxoyl4pbQ6D G2Icc6GY4gGpKpWGeT6/P4js80fKBrkLxm+ZXw7YvxsZES+Jbjwzslzl1pwmzfSb00BF dyY7eWfocimNi5nCnJ93XN/VPugq/EKtCSTymWnuqrihUJUlOew9FZIflfHbtbJJ68vH qxHTzFt3JJHGiYXHCuQNsDcRxonfYSPkLKkZo4Xlq7JyQ9MJgd+9yvpu8vSWMBCrkhZw BW9xT407HhEPoH/1vGki89XSZzsgmOiTSBwVGDLtOoRGV5Jy3FHQMszXfM351E/dC5Cy u9OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oFE5llWg; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j8-20020a655588000000b00434b739a66bsi10837597pgs.276.2022.10.03.01.53.42; Mon, 03 Oct 2022 01:53:53 -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=oFE5llWg; 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 S231937AbiJCH4M (ORCPT + 99 others); Mon, 3 Oct 2022 03:56:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231327AbiJCHzm (ORCPT ); Mon, 3 Oct 2022 03:55:42 -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 C2E1D4E613; Mon, 3 Oct 2022 00:32:42 -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 7CD8960FA4; Mon, 3 Oct 2022 07:22:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AC3DC433C1; Mon, 3 Oct 2022 07:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781749; bh=7QuY/R7TUa6IcLI0yP2FjJ56tqDnwMl1fXfia1kTBLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oFE5llWgf0ZNbccBBPWu9vsbcJijP13tgQW7jum9uerG0Tmw8VK9/udZ85bgpUvg5 ATDZ/bJTQmAx73nPx2kb0powCrm1Q9bSbdG9jXLXy3RSre3AyVv4oNXH6WmNWEdXYH WbCrI3XNwDsFrwSRTv3ZJvbg85gUtFQ4hwvjYbv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 49/52] clk: iproc: Do not rely on node name for correct PLL setup Date: Mon, 3 Oct 2022 09:11:56 +0200 Message-Id: <20221003070720.182352110@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070718.687440096@linuxfoundation.org> References: <20221003070718.687440096@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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 274441e2ddb2..8f0619f362e3 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -736,6 +736,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; @@ -783,7 +784,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); @@ -803,13 +809,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); -- 2.35.1