From: Joe Perches <joe@perches.com>
To: Colin Ian King <colin.king@canonical.com>,
Ping-Ke Shih <pkshih@realtek.com>,
Kalle Valo <kvalo@codeaurora.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3][V2] rtlwifi: rtl8192de: make arrays static const, makes object smaller
Date: Tue, 03 Aug 2021 08:23:51 -0700 [thread overview]
Message-ID: <ea10a82bfca380bf22856a99bcc695b3fae84152.camel@perches.com> (raw)
In-Reply-To: <4e1d8a60-0af8-97d5-b95c-7d91502825e5@canonical.com>
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...
next prev parent reply other threads:[~2021-08-03 15:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 14:49 [PATCH 1/3][RESEND] rtlwifi: rtl8192de: Remove redundant variable initializations Colin King
2021-08-03 14:49 ` [PATCH 2/3][V2] rtlwifi: rtl8192de: make arrays static const, makes object smaller Colin King
2021-08-03 15:09 ` Joe Perches
2021-08-03 15:15 ` Colin Ian King
2021-08-03 15:23 ` Joe Perches [this message]
2021-08-03 14:49 ` [PATCH 3/3] rtlwifi: rtl8192de: fix array size limit in for-loop Colin King
2021-08-03 18:11 ` Joe Perches
2021-08-03 18:12 ` Colin Ian King
2021-08-21 17:31 ` Kalle Valo
2021-08-21 17:33 ` [PATCH 1/3][RESEND] rtlwifi: rtl8192de: Remove redundant variable initializations Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea10a82bfca380bf22856a99bcc695b3fae84152.camel@perches.com \
--to=joe@perches.com \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pkshih@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).