Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1676478rwi; Thu, 3 Nov 2022 07:56:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50LhEBEcF0ngG4MPUp9mYWONMa0xsav8NDLc7AtDTtM6BfUPkAf69QypG6lB1KbPBnugMD X-Received: by 2002:a05:6402:528a:b0:454:8613:6560 with SMTP id en10-20020a056402528a00b0045486136560mr31420693edb.252.1667487411598; Thu, 03 Nov 2022 07:56:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667487411; cv=none; d=google.com; s=arc-20160816; b=sceDBzT+l4D1bCmISkPDM8r3mSLfcELchc8EwlK37hkF7+G7B8FlX8rtfDbr4UhzFQ a/SdErdb9gmZd18nFjm4GKPQqPEZgK/EU7hRYdttmu2vMUkfYNfzSDtuqoOmfyzKgKzi TMEE/2e7gIyGe9WdIpbuuz+0U7olWStPRWrY6efOvTQFKPYwESfax7YWofXsTDhXMfqj 5MWU5yMBlJxB3vGjwm25o4wtffzOw9H0m/47zgg91b/1j3riGE89vDpFiYeCBGBZdTa8 F5vZtYf6TxueYAhNohiDVPiGUTdFrEfyit/KFhxtPcx9jRr8KT4vS+tY6i8EjD6aOLUl Rj6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=lBACoTrABcSHWWCkv5Qw2Xy4zyiJ+SvfP16huFjzUQQ=; b=IqhzVhAaizoZxDIbWBMwQcmSEU2sybLtH84quxtNRWhVQp2XlR240MJ93vyo01Jza5 fj/oi0cXo0tWNXs4Ni8/W+PRc9mJIzaKh1XCp3SPyV7CydXoXlG93nKoMets5mJpjUnY JctFXJlV58QO7eOx3OAqB67yFdEQTrol+4U8qpUTerxoEN8gYIGV3ohSPEc0fdtTAJ0a GqsHv35IIF0wgCGWz6lU91r934sMydw9t70rvHfspEVTkd8CMnsSU3mOoU+HAo/0jeJJ 4ymn5GWTuigb7IipFVo/CQWSuE3/YOmyyA0U2Hz6rPIny9+eVpXyPmEW1EI6tERU27Gp GO4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KKpE5P4n; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a056402278800b0045d4015cdaesi1774878ede.372.2022.11.03.07.56.26; Thu, 03 Nov 2022 07:56:51 -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=KKpE5P4n; 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 S231685AbiKCOqb (ORCPT + 97 others); Thu, 3 Nov 2022 10:46:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231620AbiKCOq0 (ORCPT ); Thu, 3 Nov 2022 10:46:26 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D08BB630E; Thu, 3 Nov 2022 07:46:25 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id h9so3187446wrt.0; Thu, 03 Nov 2022 07:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=lBACoTrABcSHWWCkv5Qw2Xy4zyiJ+SvfP16huFjzUQQ=; b=KKpE5P4nXuyH5+NvF9mS7cAYPakam249HcsYaZg3nXRAadkuQGTXxo1+aF/KxHGbCo aGkJxfxMT2UuuujOIRbQ0YhZ6r24M3hMC2JBNEzY4pGdjxuwhPAVh5iDbInxRA3qKSIv 3Eux7yQrpxDJB+I3I0o6sfrfnzXhuN9YpmZFhXBUbxrz0oag876O0by5Kc9fJgxhwIse wcyRmppDSIwkd8J329a35tSxvUwvWi0TqKouZ8jNgwUZ4mmWaRzcHsWM8eU5Jl5PyLyl I42TCBL1ZcMK1MpKWesLhp3b8+8hlb7ShNW1gPfwyBWoE5MraoSHX20pq1lDCnRxRvi4 lqdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lBACoTrABcSHWWCkv5Qw2Xy4zyiJ+SvfP16huFjzUQQ=; b=MjH1i8iYWQcqObP44i91QYkvoXH/GMPwCMAa2tFEUfomVswkpmiaqULVmhdnMzUEL9 DH7wAXhFa1EouZlO0lNUi0gvlR1jCHFgoZQI5SA7/ICQzW8GqW9IkwnJcpi7kKLcOzV6 I143xXX2HfkIIsjBZsJNga4+1pHqbN9VvMyN6Zqrc7h+4c7gkrbYi6mm2S81NaFBqh02 Fpiyweo+mSWziewGugRFmTf1ZJHVTQCL8Pi0HTZ5q4yaWmqo3lQwsNgUOG9Pp+q9PR/i Q0E6FANYvfO6xhaULEoUkwtFgvOmlAulFrlImnZ9oGhJSd8QYt6rXKV+84Y2c35rLa/M tSZg== X-Gm-Message-State: ACrzQf1q+BjfE6EoraEhoCxukcY9wc/rjr3oL/JfDNG1M9cqjqSZfVaC cYhO5knWmYfYvnTzBbL3qp4= X-Received: by 2002:adf:e44f:0:b0:236:59a3:c5a8 with SMTP id t15-20020adfe44f000000b0023659a3c5a8mr19548570wrm.396.1667486784334; Thu, 03 Nov 2022 07:46:24 -0700 (PDT) Received: from [192.168.0.210] (cpc154979-craw9-2-0-cust193.16-3.cable.virginm.net. [80.193.200.194]) by smtp.googlemail.com with ESMTPSA id c5-20020a05600c0a4500b003b4a68645e9sm10992wmq.34.2022.11.03.07.46.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Nov 2022 07:46:23 -0700 (PDT) Message-ID: <4ef07fc6-8faa-7878-2f91-9c9ae90e2f2d@gmail.com> Date: Thu, 3 Nov 2022 14:46:23 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH] cpufreq: longhaul: Make array speeds static const Content-Language: en-US To: Viresh Kumar Cc: "Rafael J . Wysocki" , linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221103132141.79671-1-colin.i.king@gmail.com> <20221103143705.6g3geneixpmguaq5@vireshk-i7> From: "Colin King (gmail)" In-Reply-To: <20221103143705.6g3geneixpmguaq5@vireshk-i7> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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,NICE_REPLY_A, 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: X-Mailing-List: linux-kernel@vger.kernel.org On 03/11/2022 14:37, Viresh Kumar wrote: > On 03-11-22, 13:21, Colin Ian King 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. > > How will that benefit ? I am just looking for a valid answer in commit log. When the array is non-static there will be some executable code to put these values into the array that's on the stack (e.g. at run time). When it is static the array is filled at compile time and there is no executable code required to populate the array at run time. > >> Signed-off-by: Colin Ian King >> --- >> drivers/cpufreq/longhaul.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c >> index 3e000e1a75c6..25f8ef7bac47 100644 >> --- a/drivers/cpufreq/longhaul.c >> +++ b/drivers/cpufreq/longhaul.c >> @@ -407,7 +407,7 @@ 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 }; > > Why not make it global then ? Making it static inside the function limits the scope to the function and so it's not globally visible. We don't like making stuff global unless we really need to. Colin