From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A78BCC432BE for ; Tue, 3 Aug 2021 15:09:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 953F06103C for ; Tue, 3 Aug 2021 15:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236705AbhHCPJr (ORCPT ); Tue, 3 Aug 2021 11:09:47 -0400 Received: from smtprelay0154.hostedemail.com ([216.40.44.154]:55456 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236614AbhHCPJp (ORCPT ); Tue, 3 Aug 2021 11:09:45 -0400 Received: from omf04.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id B31AA182CF66C; Tue, 3 Aug 2021 15:09:32 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf04.hostedemail.com (Postfix) with ESMTPA id 40962D1517; Tue, 3 Aug 2021 15:09:31 +0000 (UTC) Message-ID: Subject: Re: [PATCH 2/3][V2] rtlwifi: rtl8192de: make arrays static const, makes object smaller From: Joe Perches To: Colin King , Ping-Ke Shih , Kalle Valo , "David S . Miller" , Jakub Kicinski , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 03 Aug 2021 08:09:29 -0700 In-Reply-To: <20210803144949.79433-2-colin.king@canonical.com> References: <20210803144949.79433-1-colin.king@canonical.com> <20210803144949.79433-2-colin.king@canonical.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspamout03 X-Rspamd-Queue-Id: 40962D1517 X-Stat-Signature: qfyjgjxee9wo91ryrqsmtk1g8nbwy61c X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/hQZTuO5PJBJ65UX12wm27sQMXQRdEsUQ= X-HE-Tag: 1628003371-423443 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-08-03 at 15:49 +0100, Colin King wrote: > Don't populate arrays the stack but instead make them static const. Replace > array channel_info with channel_all since it contains the same data as > channel_all. Makes object code smaller by 961 bytes. [] > diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c [] > @@ -160,6 +160,15 @@ static u32 targetchnl_2g[TARGET_CHNL_NUM_2G] = { >   25711, 25658, 25606, 25554, 25502, 25451, 25328 >  }; > > +static const u8 channel_all[59] = { I don't believe there is a significant value in sizing the array as 59 instead of letting the compiler count the elements. > + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, > + 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, > + 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, > + 114, 116, 118, 120, 122, 124, 126, 128, 130, > + 132, 134, 136, 138, 140, 149, 151, 153, 155, > + 157, 159, 161, 163, 165 > +};