Message ID | 20221103150431.87598-1-colin.i.king@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp589703wru; Thu, 3 Nov 2022 08:08:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7M6fyMceCAiPopaK7wp7l+HgQyt4Ma6FefFrGSUfTL9qKW6/HSmSYU154gmibte2rv4hkL X-Received: by 2002:a17:906:55d6:b0:7ad:a2ef:54d2 with SMTP id z22-20020a17090655d600b007ada2ef54d2mr29683687ejp.327.1667488124737; Thu, 03 Nov 2022 08:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667488124; cv=none; d=google.com; s=arc-20160816; b=W8LCACF0uybP92uh4yw1BZ39D7WVBiA7jeAOzY/EuirXdAJA061E/7WTV7awErhe13 KE0tPzB1WIsVw6wAqJEZvA3LAcG85gZLFRoVe+5UfGWywUozbjLaRLpkQjLUFsi2tfn0 7NQ+DTVdkvTgq1RX04xT3k8CEvm8T4CmNFkX3/dLVczknYW0l1Ub0xWlMRp4pq7xZIh6 IrK0eiaTXGgvxt0YacYPiViPXWlExlZYRRwxVNRZDFl7CJH8ODoudV30C8f0q0t6h6Df pGxyZFDFiCbLpxBihjDh3Qzl9avpQfLZQrGluP3coQ4HH1GW0YnnPXZSPRQQ99woFnFm bQ9Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=v209CplkpUexHsLlLnwCwseFS2Qb1ruqSsIW0PYiNeA=; b=raAcp8oKhTJPtKQKEAu/t8Hp2HMDsTN9oUwQgesxdEHAiilLuwuVOIx1aT9oSnVec/ 3+wbxUaGPgIQorzeCDPa9QXDvYjgcNqRcOk8J7bQ2t0jDtCS2cpKwBoXEMaSUcPiHavt IH5W4Qwuom3CjNu8zrXtnrqQPwRZT395u39Mf1/luH7FmNWx/4M9H7hSHagebqEwCDR8 pqc/j7ukHDk+MV3jQmGIEm8R2SJgj3/LPPoun9R4WlIgcPLchbkR1n8bZ178RKwCLcW9 RdDSB5Vk6Q6HAJcO/OrCYKznIrg61DS/mf1+P/OfPuHcc9VjjsPLD1xGiH6loDvyCAUd /shA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FnqJS9es; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rn5-20020a170906d92500b007adca5853c4si1171035ejb.279.2022.11.03.08.08.20; Thu, 03 Nov 2022 08:08:44 -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=@gmail.com header.s=20210112 header.b=FnqJS9es; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232046AbiKCPHZ (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Thu, 3 Nov 2022 11:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbiKCPHF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Nov 2022 11:07:05 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD2EB1CFD6; Thu, 3 Nov 2022 08:04:33 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id r186-20020a1c44c3000000b003cf4d389c41so3557231wma.3; Thu, 03 Nov 2022 08:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=v209CplkpUexHsLlLnwCwseFS2Qb1ruqSsIW0PYiNeA=; b=FnqJS9esJc1rzfl3RzJiNomY6iTabfrM6+V56r+OFNSM1+adygP9+qnt7w7/isqrkN MIp0hyS/kh4MzF+lmviuby+wvS6gADHcdfu3RROEKIHiUgvKlcwVQQXbrbq6vOh7jvba i61CtfL5GgEnaPW6B58CGwfmkFhyyZ1JTsU6/eP9Ooed7z7kGoK3tEpzxudSxpxLG2CQ BUqeZQvWc8KhdqPTCvE5v4SW58+bvIeBpMDq8P+6zGhuqefVTbXoiW7RqH8y1EOlbGtx IQK21K+GV0OOV2GsNDyITe6GgDaqSbUdpBNCnAmglNDbo+dRJK2F4b//N+z7zyOQBog8 LZxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v209CplkpUexHsLlLnwCwseFS2Qb1ruqSsIW0PYiNeA=; b=KugtcHhjco2BsrtfjTaIEqxg5hCUn/QCtqYISfAsFFwHVPfIFr5Cj0tBYG8a7AKNjq 9OgIWNBTnnkAe19S+1NDkc3IF7+RyYMV07VCCPHOq0kVVk0I+KQe+vj16toFhPJUJix9 fyPkQ6zkxpBzpQKiNwvhXncY2conKh3RDRf+sK/aotH2Ua2Z/NV56m/hEMJvoCruTQYT qCRgpiAO+ngeALPKAUjiAge5f7odCnF9GZWNRyFf1sEx1QZf+hGI9txa928nrgKfk/kI Cqb7bfNGRRk/7D1lnM5/MqGAC/kuP4AD+yByJ2uJylM7ji9JBQP2YrQCZ2QtWqIcg9Ji hjGQ== X-Gm-Message-State: ACrzQf1JYlibvop25AqyVbG9av69keZcj5hr84GegSd6wenYjxp5Esq7 2HLGO7ZbpTVfYONmBpNXMUA= X-Received: by 2002:a1c:acc5:0:b0:3c6:eebf:feee with SMTP id v188-20020a1cacc5000000b003c6eebffeeemr20120360wme.122.1667487872148; Thu, 03 Nov 2022 08:04:32 -0700 (PDT) Received: from localhost (cpc154979-craw9-2-0-cust193.16-3.cable.virginm.net. [80.193.200.194]) by smtp.gmail.com with ESMTPSA id y6-20020a1c4b06000000b003cf6a55d8e8sm209996wma.7.2022.11.03.08.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 08:04:31 -0700 (PDT) From: Colin Ian King <colin.i.king@gmail.com> To: "Rafael J . Wysocki" <rafael@kernel.org>, Viresh Kumar <viresh.kumar@linaro.org>, linux-pm@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][V2] cpufreq: longhaul: Make array speeds static const Date: Thu, 3 Nov 2022 15:04:31 +0000 Message-Id: <20221103150431.87598-1-colin.i.king@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748482332898824650?= X-GMAIL-MSGID: =?utf-8?q?1748488027612857998?= |
Series |
[V2] cpufreq: longhaul: Make array speeds static const
|
|
Commit Message
Colin Ian King
Nov. 3, 2022, 3:04 p.m. UTC
Don't populate the read-only array speeds on the stack but instead
make it static. Also makes the object code a little smaller. Replace
hard-coded loop array bounds with ARRAY_SIZE.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
V2: replace 4 with ARRAY_SIZE in for-loop as suggested by Joe Perches.
---
drivers/cpufreq/longhaul.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Thu, Nov 3, 2022 at 4:04 PM Colin Ian King <colin.i.king@gmail.com> wrote: > > Don't populate the read-only array speeds on the stack but instead > make it static. Also makes the object code a little smaller. Replace > hard-coded loop array bounds with ARRAY_SIZE. > > Signed-off-by: Colin Ian King <colin.i.king@gmail.com> > --- > V2: replace 4 with ARRAY_SIZE in for-loop as suggested by Joe Perches. > --- > drivers/cpufreq/longhaul.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c > index 3e000e1a75c6..4c57c6725c13 100644 > --- a/drivers/cpufreq/longhaul.c > +++ b/drivers/cpufreq/longhaul.c > @@ -407,10 +407,10 @@ static int guess_fsb(int mult) > { > int speed = cpu_khz / 1000; > int i; > - int speeds[] = { 666, 1000, 1333, 2000 }; > + static const int speeds[] = { 666, 1000, 1333, 2000 }; > int f_max, f_min; > > - for (i = 0; i < 4; i++) { > + for (i = 0; i < ARRAY_SIZE(speeds); i++) { > f_max = ((speeds[i] * mult) + 50) / 100; > f_max += (ROUNDING / 2); > f_min = f_max - ROUNDING; > -- Applied as 6.2 material, thanks!
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 3e000e1a75c6..4c57c6725c13 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -407,10 +407,10 @@ static int guess_fsb(int mult) { int speed = cpu_khz / 1000; int i; - int speeds[] = { 666, 1000, 1333, 2000 }; + static const int speeds[] = { 666, 1000, 1333, 2000 }; int f_max, f_min; - for (i = 0; i < 4; i++) { + for (i = 0; i < ARRAY_SIZE(speeds); i++) { f_max = ((speeds[i] * mult) + 50) / 100; f_max += (ROUNDING / 2); f_min = f_max - ROUNDING;