DriverDev-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] staging: rtl8188eu: make two arrays static const, makes object smaller
@ 2019-09-06 17:39 Colin King
  2019-09-06 17:50 ` Larry Finger
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-09-06 17:39 UTC (permalink / raw)
  To: Larry Finger, Greg Kroah-Hartman, devel; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate two arrays on the stack but instead make them
static const. Makes the object code smaller by 49 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
  26821	   5616	      0	  32437	   7eb5	rtl8188eu/core/rtw_ieee80211.o

After:
   text	   data	    bss	    dec	    hex	filename
  26612	   5776	      0	  32388	   7e84	rtl8188eu/core/rtw_ieee80211.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 28b3cdd10397..cc1b5438c04c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -59,7 +59,7 @@ static u8 WIFI_OFDMRATES[] = {
 
 int rtw_get_bit_value_from_ieee_value(u8 val)
 {
-	unsigned char dot11_rate_table[] = {
+	static const unsigned char dot11_rate_table[] = {
 		2, 4, 11, 22, 12, 18, 24, 36, 48,
 		72, 96, 108, 0}; /*  last element must be zero!! */
 	int i = 0;
@@ -275,7 +275,7 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, uint *wpa_ie_len, int limit)
 	uint len;
 	u16 val16;
 	__le16 le_tmp;
-	unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01};
+	static const unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01};
 	u8 *pbuf = pie;
 	int limit_new = limit;
 
-- 
2.20.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: rtl8188eu: make two arrays static const, makes object smaller
  2019-09-06 17:39 [PATCH] staging: rtl8188eu: make two arrays static const, makes object smaller Colin King
@ 2019-09-06 17:50 ` Larry Finger
  0 siblings, 0 replies; 2+ messages in thread
From: Larry Finger @ 2019-09-06 17:50 UTC (permalink / raw)
  To: Colin King, Greg Kroah-Hartman, devel; +Cc: kernel-janitors, linux-kernel

On 9/6/19 12:39 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate two arrays on the stack but instead make them
> static const. Makes the object code smaller by 49 bytes.
> 
> Before:
>     text	   data	    bss	    dec	    hex	filename
>    26821	   5616	      0	  32437	   7eb5	rtl8188eu/core/rtw_ieee80211.o
> 
> After:
>     text	   data	    bss	    dec	    hex	filename
>    26612	   5776	      0	  32388	   7e84	rtl8188eu/core/rtw_ieee80211.o
> 
> (gcc version 9.2.1, amd64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Thanks,

Larry
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 17:39 [PATCH] staging: rtl8188eu: make two arrays static const, makes object smaller Colin King
2019-09-06 17:50 ` Larry Finger

DriverDev-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/driverdev-devel/0 driverdev-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 driverdev-devel driverdev-devel/ https://lore.kernel.org/driverdev-devel \
		driverdev-devel@linuxdriverproject.org devel@driverdev.osuosl.org driverdev-devel@archiver.kernel.org
	public-inbox-index driverdev-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxdriverproject.driverdev-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox