Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751891AbdIVHUN (ORCPT ); Fri, 22 Sep 2017 03:20:13 -0400 Received: from mga06.intel.com ([134.134.136.31]:28867 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751795AbdIVHUL (ORCPT ); Fri, 22 Sep 2017 03:20:11 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,427,1500966000"; d="scan'208";a="902827357" Subject: Re: [PATCH] i2c: designware: make const array supported_speeds static to shink object code size To: Colin King , Andy Shevchenko , Mika Westerberg , Wolfram Sang , linux-i2c@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20170921223007.21081-1-colin.king@canonical.com> From: Jarkko Nikula Message-ID: Date: Fri, 22 Sep 2017 10:10:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170921223007.21081-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1373 Lines: 37 On 09/22/2017 01:30 AM, Colin King wrote: > From: Colin Ian King > > Don't populate const array supported_speeds on the stack, instead > make it static. Makes the object code smaller by 150 bytes: > > Before: > text data bss dec hex filename > 8474 1440 0 9914 26ba i2c-designware-platdrv.o > > After: > text data bss dec hex filename > 8324 1440 0 9764 2624 i2c-designware-platdrv.o > > (gcc version 7.2.0 x86_64) > > Signed-off-by: Colin Ian King > --- > drivers/i2c/busses/i2c-designware-platdrv.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c > index 0e65b97842b4..8a7b29b9afbe 100644 > --- a/drivers/i2c/busses/i2c-designware-platdrv.c > +++ b/drivers/i2c/busses/i2c-designware-platdrv.c > @@ -257,7 +257,9 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) > u32 acpi_speed, ht = 0; > struct resource *mem; > int i, irq, ret; > - const int supported_speeds[] = { 0, 100000, 400000, 1000000, 3400000 }; > + static const int supported_speeds[] = { > + 0, 100000, 400000, 1000000, 3400000 > + }; > Oh, this is so easy to forget. Acked-by: Jarkko Nikula