From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751366AbdGQQbk (ORCPT ); Mon, 17 Jul 2017 12:31:40 -0400 Received: from smtprelay0104.hostedemail.com ([216.40.44.104]:54218 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751284AbdGQQbk (ORCPT ); Mon, 17 Jul 2017 12:31:40 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:4321:4605:5007:6119:7903:8603:9389:10004:10400:10848:11026:11232:11657:11658:11783:11914:12043:12048:12296:12663:12679:12740:12895:13069:13161:13229:13311:13357:13439:13894:14040:14181:14659:14721:21080:21433:21434:21451:21627:30012:30034:30051:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:4,LUA_SUMMARY:none X-HE-Tag: bike89_e33f3bcc941e X-Filterd-Recvd-Size: 2678 Message-ID: <1500309096.25934.11.camel@perches.com> Subject: Re: [PATCH] ASoC: rsnd: remove unnecessary static in rsnd_ssiu_probe() From: Joe Perches To: "Gustavo A. R. Silva" , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Date: Mon, 17 Jul 2017 09:31:36 -0700 In-Reply-To: <20170717153020.GA19704@embeddedgus> References: <20170717153020.GA19704@embeddedgus> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2017-07-17 at 10:30 -0500, Gustavo A. R. Silva wrote: > Remove unnecessary static on local variable ops. > 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. [] > 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 > 3211 680 64 3955 f73 sound/soc/sh/rcar/ssiu.o > > after: > text data bss dec hex filename > 3207 592 0 3799 ed7 sound/soc/sh/rcar/ssiu.o [] > diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c [] > @@ -250,7 +250,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) > { > struct device *dev = rsnd_priv_to_dev(priv); > struct rsnd_ssiu *ssiu; > - static struct rsnd_mod_ops *ops; > + struct rsnd_mod_ops *ops; > int i, nr, ret; > > /* same number to SSI */ I'm not an sh user anymore, but it's curious to me why the static removal has such a large impact on data size. Is this for an allyesconfig with debug symbols? btw: this does compile for x86 and those sizes seem more sensible. $ size sound/soc/sh/rcar/ssiu.o*   text    data     bss     dec     hex filename    1950     248       0    2198     896 sound/soc/sh/rcar/ssiu.o.defconfig.new    1950     248       8    2206     89e sound/soc/sh/rcar/ssiu.o.defconfig.old    2692     248       0    2940     b7c sound/soc/sh/rcar/ssiu.o.allyesconfig.new    2692     248       8    2948     b84 sound/soc/sh/rcar/ssiu.o.allyesconfig.old