From patchwork Mon Mar 27 18:43:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 75631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1729665vqo; Mon, 27 Mar 2023 12:08:32 -0700 (PDT) X-Google-Smtp-Source: AK7set+vT8qxNycnZNJY7k63o1qEYGgwHqFJa3llC3epb8UktUsgGOfAEMHHt8E6GIE7JHj9J72c X-Received: by 2002:a05:6a20:1326:b0:cd:91bc:a9af with SMTP id g38-20020a056a20132600b000cd91bca9afmr9500057pzh.58.1679944111715; Mon, 27 Mar 2023 12:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679944111; cv=none; d=google.com; s=arc-20160816; b=VumicLLMlkEnj5TmcROXMdnCp5uK/nFgcQHhr8XsUDLGBX6+9xFY/hmCePnhlWpIqX NdkTcq6T7nzb8iJZMVv5p+E7TvnZnlMy3u/sH8Jr5kuErimcldjX3YL4vq3Bd508/moV GvAE51wmrXieUwLA8ry56luYfmg2ZrS+D5hHwJryzXmV4Aa90Xgke6qM631D6OGvv1QA phUHCj2euQ2nEiP87x5dSzo9dBoXXRr8WjFzfcIahkqoU5nT8t6V6UGdczgIdvllNqKt 5s7eboedeod7sBJa1wBoV6Gojsxlzg5KFnPp7k6FzSVPXp0iaeerxr2ghfrpHnCh8kz1 GoBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=kEGgZynpOWxMMcgnhx5oPKpn1kXWJspMTBnhIlRJRTE=; b=AmfjpFBr+9mBcZna1nhMkiad/Fm6j49nXTzuXn7SLSMc28RwMnWe4KjcxyPl+QLR9d Kb3pf3tusci3WPnp8sCXxaYE/rvJV08HrqsWL8jMfQi1qAlX826k5UgrMOCOPvr4jLDP xV04zNu5ZFXtwLqRDv4jCQ9tZi3nQdX7nncPetYfVNOuHbDTKBSbmN/1ME9dgyJWV5ci GzT/qPP31wrAxgT+qbXqHGKoz1WGPHc0Z6eH0y/DTZxa9/ihlfgqV4hKWZjVDJvBrmyo W7cloGQITl01VhPwXomsPqZDKGQFrn10NbXcH61XqiVu62KxBJ3sZzgdeEBUy4PvRcrE /7mA== ARC-Authentication-Results: i=1; mx.google.com; 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 h23-20020a632117000000b004fba312c233si27130215pgh.413.2023.03.27.12.08.18; Mon, 27 Mar 2023 12:08:31 -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; 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 S232625AbjC0Snp (ORCPT + 99 others); Mon, 27 Mar 2023 14:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232755AbjC0Snb (ORCPT ); Mon, 27 Mar 2023 14:43:31 -0400 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9FF83AB1; Mon, 27 Mar 2023 11:43:24 -0700 (PDT) Received: by mail-oi1-f180.google.com with SMTP id w133so7123214oib.1; Mon, 27 Mar 2023 11:43:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679942604; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kEGgZynpOWxMMcgnhx5oPKpn1kXWJspMTBnhIlRJRTE=; b=S4kJ4C3v6vQmSKRETD46OhwWPgU4Bf2zEnniGtxAO45xVzcsTHiQkFo3UU/ohZFBRz Tk4qZkyt/pzlEebpGDNNZcbtcuQAn+rabfVywUd5iFO3Y1PcV/GcVecCXvc+t5vTFsDp XwSAlbUop39S1g6ALB4AjdpYMUXpgHTPCbE6ODAsi0r+5LoPp865PZrJSqKAo0PfoGBd KIFAQJ2fAH9Lpc66SGf3efMI3uiqUv/ixKHB5l97F0rVNXc90K2YPtBqqh7J9MRIOLNB dMnDtvkCW0QTqxgb+KcIikWxO7hlfEVOj7B2ONmgVlCcIIEoYVgoJrATcV92Q62z8IcC upYA== X-Gm-Message-State: AO0yUKWk60iS5N5WOZ0vJKIFlIbVQkZb1WTZGnSJVQ72m383YI6f6YQu dIe0/j+VtyRvwEGD9qC3BsP3WHGBOQ== X-Received: by 2002:a05:6808:1389:b0:37f:936d:b5d9 with SMTP id c9-20020a056808138900b0037f936db5d9mr7045261oiw.12.1679942603966; Mon, 27 Mar 2023 11:43:23 -0700 (PDT) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id s9-20020a4a9689000000b005255e556399sm11758101ooi.43.2023.03.27.11.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 11:43:23 -0700 (PDT) Received: (nullmailer pid 250777 invoked by uid 1000); Mon, 27 Mar 2023 18:43:19 -0000 From: Rob Herring Date: Mon, 27 Mar 2023 13:43:18 -0500 Subject: [PATCH 1/3] MAINTAINERS: Add Marvell mvebu clock drivers MIME-Version: 1.0 Message-Id: <20230327-mvebu-clk-fixes-v1-1-438de1026efd@kernel.org> References: <20230327-mvebu-clk-fixes-v1-0-438de1026efd@kernel.org> In-Reply-To: <20230327-mvebu-clk-fixes-v1-0-438de1026efd@kernel.org> To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Michael Turquette , Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org X-Mailer: b4 0.13-dev X-Spam-Status: No, score=0.8 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1761549077292613160?= X-GMAIL-MSGID: =?utf-8?q?1761549077292613160?= drivers/clk/mvebu/ is missing a maintainers entry. Add it to the existing entry for the Marvell mvebu platforms. Signed-off-by: Rob Herring Reviewed-by: Andrew Lunn --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 8d5bc223f305..b9d04f781524 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2356,6 +2356,7 @@ F: arch/arm/configs/mvebu_*_defconfig F: arch/arm/mach-mvebu/ F: arch/arm64/boot/dts/marvell/armada* F: arch/arm64/boot/dts/marvell/cn913* +F: drivers/clk/mvebu/ F: drivers/cpufreq/armada-37xx-cpufreq.c F: drivers/cpufreq/armada-8k-cpufreq.c F: drivers/cpufreq/mvebu-cpufreq.c From patchwork Mon Mar 27 18:43:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 75635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1730863vqo; Mon, 27 Mar 2023 12:10:53 -0700 (PDT) X-Google-Smtp-Source: AKy350YGIBpghBhhKJiEtdS5pHZzCpl2nI5Xj8AVLIWFKQxDhy/WSHfmZ9v2j170S7/t3eH4K9q3 X-Received: by 2002:a17:903:2409:b0:1a0:5671:42a6 with SMTP id e9-20020a170903240900b001a0567142a6mr14305216plo.31.1679944253486; Mon, 27 Mar 2023 12:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679944253; cv=none; d=google.com; s=arc-20160816; b=P0y9uz4gscvwOtUgI+WvehUrFZCG2d0US68arWdvOzEmGNpl5UUCyJNm/FcuDc+3x4 vEXZ/gbBJOf+W21RRLANmxGVaNQ6iZkz4TIvpMynxJI4r1XuuMHQOQM0tFLS6OjX82AD ARpgGszKnXmIpAZtNb9xmBtpj+kPkMTEIyHUrmmgV1WGBeMBK7bPXGxWjzltMMkUbkSk 6YyBSvUnteFsd4Skpi8d3lVz2qMnXrR6PpPcpS6J+rfiNFnzfwgvPYly6SwFUJTe9S3I wDy0LjSoYmC4N6A4TUyZuqAkHCpko7CppXkJoJ9aGwh1+Lo0shbVFO4JKL1yiYGM6NVS 9bug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=7mYF/p73swKVMGgtJSK6eBueBgSxph1TeoNqsitRFwA=; b=fFVpREjj4mc7GKsH5AXJJJE3ianhK7dw+6QJXzlEYfKwSLZMlbJPSADRjxGyb8WQJu XfCXKye+Qsps4PtHjZEkk1cOJdJZvNCZ/OPy/xqLQh9815lZ7Cb6K/vdg2tufrwzL5pj 9f+uAbP/oMBsQA6jN06VaYLDSJqYB2UyIfY0rSxlbf2TU7fhgT2QDzVh7p6PGGTr1Z2u RE1ohWV7L/Hal/N4j1PP7UP8/dZd2m573OuUUXA+0Z29cr9edGqiSUDACgr/Vt6vT5LS 5y/uYXtRA3qFIgqF6pwYv4t/8DuYT/LeZ4DfRsjMMDzRREF5n20kUmM0Xs6/I9yR6z6t AxSw== ARC-Authentication-Results: i=1; mx.google.com; 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 h23-20020a632117000000b004fba312c233si27130215pgh.413.2023.03.27.12.10.40; Mon, 27 Mar 2023 12:10: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; 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 S232717AbjC0Snj (ORCPT + 99 others); Mon, 27 Mar 2023 14:43:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232707AbjC0Sn3 (ORCPT ); Mon, 27 Mar 2023 14:43:29 -0400 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8D635BC; Mon, 27 Mar 2023 11:43:22 -0700 (PDT) Received: by mail-oo1-f54.google.com with SMTP id p2-20020a056820044200b0053e5914a50fso229890oou.2; Mon, 27 Mar 2023 11:43:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679942601; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7mYF/p73swKVMGgtJSK6eBueBgSxph1TeoNqsitRFwA=; b=XjRttvbJRCUx82ASH1d5wEA5halSg15OyoYCZ9w3v3R75MM/Xh6VZWRDx3dNSpoe+E SoYDHw+kIeuMIdEdNYb0FXHHa3rhO/f/mQNfPD56F9NGctjcUQOE+6Rx+ArpQohLNdhB Oyeq9DCt/+bbL95Aqx3KogLfatZM34D2Xwcal0PAPEkzqdQCsuEP9F1KNLaMIls0HB/G G5ZsDXRBon4VOaFOGBHKeWXM+oXCnDlCZoMZRTPUkGwTbLr92AvTFTZUpdEWbqLbWSbR XMJU95fXd8S3Ud7uVtvPfus/b7U8aUD+nfrxkrCtxhcdVdndfuQf0urNzqPsXqUplPWc ajMQ== X-Gm-Message-State: AO0yUKV7id96TJFijdZvZBRHL/t92VeQ7vE4gxs7F7pkg6e0XEtdA+6O UMPoNCT3/IiMacefM745yg== X-Received: by 2002:a4a:2c86:0:b0:525:2b54:d6a4 with SMTP id o128-20020a4a2c86000000b005252b54d6a4mr5858648ooo.0.1679942601498; Mon, 27 Mar 2023 11:43:21 -0700 (PDT) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id u63-20020a4a5742000000b0051aa196ac82sm11759997ooa.14.2023.03.27.11.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 11:43:21 -0700 (PDT) Received: (nullmailer pid 250779 invoked by uid 1000); Mon, 27 Mar 2023 18:43:19 -0000 From: Rob Herring Date: Mon, 27 Mar 2023 13:43:19 -0500 Subject: [PATCH 2/3] clk: mvebu: Use of_get_cpu_hwid() to read CPU ID MIME-Version: 1.0 Message-Id: <20230327-mvebu-clk-fixes-v1-2-438de1026efd@kernel.org> References: <20230327-mvebu-clk-fixes-v1-0-438de1026efd@kernel.org> In-Reply-To: <20230327-mvebu-clk-fixes-v1-0-438de1026efd@kernel.org> To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Michael Turquette , Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org X-Mailer: b4 0.13-dev X-Spam-Status: No, score=0.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no 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?1761549225528223183?= X-GMAIL-MSGID: =?utf-8?q?1761549225528223183?= Use of_get_cpu_hwid() rather than the open coded reading of the CPU nodes "reg" property. The existing code is in fact wrong as the "reg" address cells size is 2 cells for arm64. The existing code happens to work because the DTS files are wrong as well. Signed-off-by: Rob Herring --- Note this should be marked for stable so that if/when the DTS files are fixed, then at least stable kernels will work. This is untested, so I didn't mark for stable. --- drivers/clk/mvebu/ap-cpu-clk.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/clk/mvebu/ap-cpu-clk.c b/drivers/clk/mvebu/ap-cpu-clk.c index 71bdd7c3ff03..d8a7a4c90d54 100644 --- a/drivers/clk/mvebu/ap-cpu-clk.c +++ b/drivers/clk/mvebu/ap-cpu-clk.c @@ -253,12 +253,12 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) */ nclusters = 1; for_each_of_cpu_node(dn) { - int cpu, err; + u64 cpu; - err = of_property_read_u32(dn, "reg", &cpu); - if (WARN_ON(err)) { + cpu = of_get_cpu_hwid(dn, 0); + if (WARN_ON(cpu == OF_BAD_ADDR)) { of_node_put(dn); - return err; + return -EINVAL; } /* If cpu2 or cpu3 is enabled */ @@ -288,12 +288,12 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) struct clk_init_data init; const char *parent_name; struct clk *parent; - int cpu, err; + u64 cpu; - err = of_property_read_u32(dn, "reg", &cpu); - if (WARN_ON(err)) { + cpu = of_get_cpu_hwid(dn, 0); + if (WARN_ON(cpu == OF_BAD_ADDR)) { of_node_put(dn); - return err; + return -EINVAL; } cluster_index = cpu & APN806_CLUSTER_NUM_MASK; From patchwork Mon Mar 27 18:43:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 75624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1722737vqo; Mon, 27 Mar 2023 11:56:50 -0700 (PDT) X-Google-Smtp-Source: AKy350aBDv3OzGAwBorhdsLxTwRpEAa0gk3rpYNE1HJpeZub2tebK9xtKytim9HaeGJUxPfKJ2Yk X-Received: by 2002:a62:604:0:b0:624:9bdc:f255 with SMTP id 4-20020a620604000000b006249bdcf255mr11621801pfg.21.1679943410599; Mon, 27 Mar 2023 11:56:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679943410; cv=none; d=google.com; s=arc-20160816; b=jtjqgoLvD48yXwcrvqPld8gSv/qAoOK3VgBKew360/L696r/xqZAiu0NbSO0ErkGeR FwVdSxUwa7NJRt3V+IED86qk7zyU1RVM65Ir0S9A3qW8XH5aWM+ZuAefRnsdRx/gWl3W 1aKWfXclf9PDfOduViK0UBfhcS+G7iIVSb8demxgOZTn6qm1g/ACy3LxcdmzP5RykY// TSRJOqmcklmn0OMucGi7XwYWpwje90gas6yNXI/nFHXGXZULyxZHXKz9mg8l04fYssPb lcMHi0VUPP+UuZvnLMppAIPFruKIunf8M2JJTG6AdEA3+20BJAiaETMQG376ox6boCPd EAog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=pE6BrZSZEIfHJZnlEnBPUpJidRJVROMBg6S+6nxssKs=; b=RvRlZ8baJF678uw4BfckZ7pLcnKbx/AbMGtpT4rXfjzklGOh0CZboJDk1r1Q/f9Ie7 m9L7GDa1bWIppne4thyGgwKJ/XO+AmAgn7JUn8N4hDWxHZPrfuNyQdKQM//yFihbrAsj 1HXPlzEtYmo/OuRliRVGgUNkdsljz/qSjbbKwZtLRurt3YNzbBpmlfQFxo+0uki1abWg Mvy+TABp1sOwX/h6iqT9c5aL1IXB0UwZiYXWdv+FGih4zpnGCjhzhuZF3xQ2iN+nofKn VswhrOH7+F6pvJD/++7Y7heh5LjC1ZVeX60cWoiB7uax2ProN4wujLZTaUeqjdw87qy1 mQIw== ARC-Authentication-Results: i=1; mx.google.com; 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 e33-20020a630f21000000b004ce76fa9ebdsi28301356pgl.387.2023.03.27.11.56.38; Mon, 27 Mar 2023 11:56:50 -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; 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 S232786AbjC0Snm (ORCPT + 99 others); Mon, 27 Mar 2023 14:43:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232715AbjC0Sn3 (ORCPT ); Mon, 27 Mar 2023 14:43:29 -0400 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB564233; Mon, 27 Mar 2023 11:43:23 -0700 (PDT) Received: by mail-oi1-f175.google.com with SMTP id bk5so7113435oib.6; Mon, 27 Mar 2023 11:43:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679942603; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pE6BrZSZEIfHJZnlEnBPUpJidRJVROMBg6S+6nxssKs=; b=ZACpH1ZMacEp/TxE9cfU6Laq6ZIhQrEM923Er/7LuS2OO8lj84a0fDCFzAvl+H3INl dl0LdhLJcdymjCJbAILUAU01b0i+6Sc+MFI6Zb/smco1l4O8NbvVXLLI45dK7JQ8jMAD Dt61h3hZT+WrP6a3DR23FRwWZRbh6lEUN9mmRJk6Qd/6Yz3MIfL5BHK6LBlAmnVR16Ic IWPO0VAOyX52S1k/M58Nc4pBu45z1khk2dE6dHzzNF5/nhiVpzkKh0aVxw43gFCtlguL h+0AY9hfNlwddx1LBDpi2+pJPL7DZFNU7bdnzcT6PqK/XcBRIeWCB13ltFNjuoUXoN3w 1ovw== X-Gm-Message-State: AAQBX9dauqxDY5yHUM+6pUiEF6Svg6BD/7uVzSj0kj9UvuTB7/4YcNUo Zv3/r/yOhODKEBx1DrXvwQ== X-Received: by 2002:aca:919:0:b0:388:f3b6:edb0 with SMTP id 25-20020aca0919000000b00388f3b6edb0mr3671558oij.51.1679942602755; Mon, 27 Mar 2023 11:43:22 -0700 (PDT) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id q204-20020a4a33d5000000b0053853156b5csm11154922ooq.8.2023.03.27.11.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 11:43:22 -0700 (PDT) Received: (nullmailer pid 250781 invoked by uid 1000); Mon, 27 Mar 2023 18:43:19 -0000 From: Rob Herring Date: Mon, 27 Mar 2023 13:43:20 -0500 Subject: [PATCH 3/3] clk: mvebu: Iterate over possible CPUs instead of DT CPU nodes MIME-Version: 1.0 Message-Id: <20230327-mvebu-clk-fixes-v1-3-438de1026efd@kernel.org> References: <20230327-mvebu-clk-fixes-v1-0-438de1026efd@kernel.org> In-Reply-To: <20230327-mvebu-clk-fixes-v1-0-438de1026efd@kernel.org> To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Michael Turquette , Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org X-Mailer: b4 0.13-dev X-Spam-Status: No, score=0.8 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1761548341778040883?= X-GMAIL-MSGID: =?utf-8?q?1761548341778040883?= Rework iterating over DT CPU nodes to iterate over possible CPUs instead. There's no need to walk the DT CPU nodes again. Possible CPUs is equal to the number of CPUs defined in the DT. Using the "reg" value for an array index is fragile as it assumes "reg" is 0-N which often is not the case. Signed-off-by: Rob Herring --- drivers/clk/mvebu/clk-cpu.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c index c2af3395cf13..db2b38c21304 100644 --- a/drivers/clk/mvebu/clk-cpu.c +++ b/drivers/clk/mvebu/clk-cpu.c @@ -168,8 +168,8 @@ static void __init of_cpu_clk_setup(struct device_node *node) struct cpu_clk *cpuclk; void __iomem *clock_complex_base = of_iomap(node, 0); void __iomem *pmu_dfs_base = of_iomap(node, 1); - int ncpus = 0; - struct device_node *dn; + int ncpus = num_possible_cpus(); + int cpu; if (clock_complex_base == NULL) { pr_err("%s: clock-complex base register not set\n", @@ -181,9 +181,6 @@ static void __init of_cpu_clk_setup(struct device_node *node) pr_warn("%s: pmu-dfs base register not set, dynamic frequency scaling not available\n", __func__); - for_each_of_cpu_node(dn) - ncpus++; - cpuclk = kcalloc(ncpus, sizeof(*cpuclk), GFP_KERNEL); if (WARN_ON(!cpuclk)) goto cpuclk_out; @@ -192,19 +189,14 @@ static void __init of_cpu_clk_setup(struct device_node *node) if (WARN_ON(!clks)) goto clks_out; - for_each_of_cpu_node(dn) { + for_each_possible_cpu(cpu) { struct clk_init_data init; struct clk *clk; char *clk_name = kzalloc(5, GFP_KERNEL); - int cpu, err; if (WARN_ON(!clk_name)) goto bail_out; - err = of_property_read_u32(dn, "reg", &cpu); - if (WARN_ON(err)) - goto bail_out; - sprintf(clk_name, "cpu%d", cpu); cpuclk[cpu].parent_name = of_clk_get_parent_name(node, 0);