Path: csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod From: Viresh Kumar Newsgroups: linux.kernel Subject: Re: [PATCH] cpufreq: speedstep: remove unnecessary static in speedstep_detect_chipset() Date: Wed, 05 Jul 2017 06:00:01 +0200 Message-ID: References: X-Original-To: "Gustavo A. R. Silva" , linux@dominikbrodowski.net Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NY2pV4PprybNcSMn90AX0e8bS1+Op+EuJENsTymYKGs=; b=Lhy1c0NcVDrE8Ed4AS98mv5x05c03Hx7BAKs7r3WduMo3jx1xnblJcStQc5RJ5o/X1 zw5m3OztcJ53rMfjYVWMDWIlcw+pJaL0GNm7YoTRREBMT9oUjL9ZkdLO+V8SMid+nvnE mE8xHrE+ra2lgCdXeSYFXQQgrbCKwFBWzSSu8= X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NY2pV4PprybNcSMn90AX0e8bS1+Op+EuJENsTymYKGs=; b=PmJra/HIosTGFzPjqB6P05dxAFzU6HQAIf/pucjcVx3CSiw+aonPStIoCKXIwAcBZr b9t7VjLg4McnBdVXwS/d+i7vhOt51fqZVmjuOxx2z26WoIYU8Ijxy4YJf6s+yZ61EVLU ofGFIl1QVMG7taVqbKSYQft7RdaBKNHS7ZEgpeFsxphwdsmBcNzThnWAARLSQSwELMKZ bA0BUAVAxfiXn5kcRveo9UB2ZrLB6d3GZPVvG3ZZY5zEL5x3g6iR/lMaRuQvoLMNFipO Sd+3TjEBd2TYlgcqAj48KLgES2iFLMdEoVWSGd6ei9VKiGOHzCwYQinsZWUs4GCbk4o3 /Njw== X-Gm-Message-State: AIVw11102ThxZqfz1tYrGn+FOZ16T5nbqpa/TRWR92YXjujWNJN+kZJS kxPHqhN6rBI3zOlrITw9SQ== X-Received: by 10.98.20.21 with SMTP id 21mr18440931pfu.29.1499226827957; Tue, 04 Jul 2017 20:53:47 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 74 Organization: linux.* mail to news gateway X-Original-Cc: "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org X-Original-Date: Wed, 5 Jul 2017 09:23:44 +0530 X-Original-Message-ID: <20170705035344.GI3532@vireshk-i7> X-Original-References: <20170705030921.GA18166@embeddedgus> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1681259 + Dominic, On 04-07-17, 22:09, Gustavo A. R. Silva wrote: > Remove unnecessary static on local variable hostbridge. > Such variable is initialized before being used, > on every execution path throughout the function. > The static has no benefit and, removing it reduces > the code size. > > This issue was detected using Coccinelle and the following semantic patch: > > @bad exists@ > position p; > identifier x; > type T; > @@ > > static T x@p; > ... > x = <+...x...+> > > @@ > identifier x; > expression e; > type T; > position p != bad.p; > @@ > > -static > T x@p; > ... when != x > when strict > ?x = e; > > In the following log you can see the difference in the code size. Also, > there is a significant difference in the bss segment. This log is the > output of the size command, before and after the code change: > > before: > text data bss dec hex filename > 5084 3392 256 8732 221c drivers/cpufreq/speedstep-ich.o > > after: > text data bss dec hex filename > 5062 3304 192 8558 216e drivers/cpufreq/speedstep-ich.o > > Signed-off-by: Gustavo A. R. Silva > --- > drivers/cpufreq/speedstep-ich.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/speedstep-ich.c b/drivers/cpufreq/speedstep-ich.c > index b86953a..0412a24 100644 > --- a/drivers/cpufreq/speedstep-ich.c > +++ b/drivers/cpufreq/speedstep-ich.c > @@ -207,7 +207,7 @@ static unsigned int speedstep_detect_chipset(void) > * 8100 which use a pretty old revision of the 82815 > * host bridge. Abort on these systems. > */ > - static struct pci_dev *hostbridge; > + struct pci_dev *hostbridge; This was added way back Sep'02 by Dominic (@Dominic: I hope you are the same Dominic with a different email id) and I don't think we need it to be static here. Anyway, Dominic can respond on that. commit 1673f3b404bd ("[PATCH] CPUfreq i386 drivers update") (Note: You can find it in history kernel git repo, not the current one). Acked-by: Viresh Kumar -- viresh