Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2524293pxy; Tue, 3 Aug 2021 08:24:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/tyYKrazhCYbflZZcfdPOIo+Pp4gjQapRSPs+4YPWesBs5QWbRzvIrYZYK2Ta8Wm0GvZa X-Received: by 2002:a05:6e02:1c2d:: with SMTP id m13mr1224709ilh.137.1628004286109; Tue, 03 Aug 2021 08:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628004286; cv=none; d=google.com; s=arc-20160816; b=Y/jIm8wJ+IGHsUnWg0RSeQgCdzRGPCJaLNCQSOAawdSZ6sDE+VSZBusBb+CNORw0hN /j2SBPj8cZ2st1urDz+YMsO2j1UdqGosOc2Hh0NKzeZg7cgU78ce03dL+2J4fQbX8zDK HeHxplS9dOPZVoOzXMI3N6diigFe9uERYuqzGA1D1iUMAxfCulHCI/x0isChRvGbDQRf 24eNzMIx5ZRzEVgi0k8pMbyUy23XkghjIax3APVCCdCjVhTI0Y4KXDioWGP3sKkmzkly G1e+fgFwefdO2Rr69vPnXZCNxUt5xmKNTTGj+UgPNkKkQ8eyowSeglfuuu1m5r81NGNS Oq6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=ZZN/0pRTJcTR9Yf2CINkldD0EJxe3JITOquJiQepHyc=; b=B+SefpuzEqrL/w8w3XlWvhKpRsFTG0JX1h0bI3zfGYTKvVn6jG83A7oSB//cdXgrEP 27RSkKsd/C6130p26bNkTA/yBIqOP8k+8+7PZe6WgRQjlubYhkaLSJBaihFzp4yL+Awu 716m8/ezA05Wz44joszI8g54nJr+a3SI0CNkgk/zL93x1DJpdOehV4f1kQTpKtaIHbvq zEzcERmTHOX1AXk3DOkxnWWOPvlrFKVXjtS5hun1wyXPAAileXAtOa9XWmn7M6bXvEVZ ueXAJtE4rNvPjg8H5TqQBsldfivHxZxeK+zpuD1M7CzgO+C24K7nRzh3uqzLeUkRRbzr iUhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p16si15288146ilj.162.2021.08.03.08.24.34; Tue, 03 Aug 2021 08:24:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236733AbhHCPYI (ORCPT + 99 others); Tue, 3 Aug 2021 11:24:08 -0400 Received: from smtprelay0095.hostedemail.com ([216.40.44.95]:46410 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236145AbhHCPYH (ORCPT ); Tue, 3 Aug 2021 11:24:07 -0400 Received: from omf11.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 8D66218225E1F; Tue, 3 Aug 2021 15:23:54 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA id EAF2D20A29C; Tue, 3 Aug 2021 15:23:52 +0000 (UTC) Message-ID: Subject: Re: [PATCH 2/3][V2] rtlwifi: rtl8192de: make arrays static const, makes object smaller From: Joe Perches To: Colin Ian 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:23:51 -0700 In-Reply-To: <4e1d8a60-0af8-97d5-b95c-7d91502825e5@canonical.com> References: <20210803144949.79433-1-colin.king@canonical.com> <20210803144949.79433-2-colin.king@canonical.com> <4e1d8a60-0af8-97d5-b95c-7d91502825e5@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: rspamout05 X-Rspamd-Queue-Id: EAF2D20A29C X-Spam-Status: No, score=0.11 X-Stat-Signature: b9y4z9jye3c6ejeoj3inmzicfsiu3fwk X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX18WLi5dSNuPqYskUZU1WA/ZcFH30DvAWhI= X-HE-Tag: 1628004232-471034 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, 2021-08-03 at 16:15 +0100, Colin Ian King wrote: > On 03/08/2021 16:09, Joe Perches wrote: > > 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. > > I was reluctant to remove this as I supposed the original had it in for > a purpose, e.g. to ensure that the array was not populated with more > data than intended. Does it make much of a difference? > > > > > > + 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 > > > +}; Dunno. Maybe not, but I did have to count the elements to see if it really was 59 or the compiler was adding trailing 0's. OK I really did a grep to count the commas and added 1...