LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ALSA: usb-audio: make array static const, makes object smaller
Date: Sun,  1 Aug 2021 07:25:48 +0100	[thread overview]
Message-ID: <20210801062548.137770-1-colin.king@canonical.com> (raw)

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

Don't populate array names_to_check on the stack but instead it
static.  Makes the object code smaller by 56 bytes.

Before:
   text    data     bss     dec     hex filename
 103512   34380       0  137892   21aa4 ./sound/usb/mixer.o

After:
   text    data     bss     dec     hex filename
 103264   34572       0  137836   21a6c ./sound/usb/mixer.o

gcc version 10.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/usb/mixer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index f4cdaf1ba44a..aec2499284a5 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1572,8 +1572,9 @@ static size_t append_ctl_name(struct snd_kcontrol *kctl, const char *str)
 static void check_no_speaker_on_headset(struct snd_kcontrol *kctl,
 					struct snd_card *card)
 {
-	const char *names_to_check[] = {
-		"Headset", "headset", "Headphone", "headphone", NULL};
+	static const char *names_to_check[] = {
+		"Headset", "headset", "Headphone", "headphone", NULL
+	};
 	const char **s;
 	bool found = false;
 
-- 
2.31.1


             reply	other threads:[~2021-08-01  6:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-01  6:25 Colin King [this message]
2021-08-01  8:05 ` Takashi Iwai

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=20210801062548.137770-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --subject='Re: [PATCH] ALSA: usb-audio: make array static const, makes object smaller' \
    /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

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox