LKML Archive on
help / color / mirror / Atom feed
From: Colin King <>
To: Jaroslav Kysela <>, Takashi Iwai <>,
Subject: [PATCH][V2] ALSA: usb-audio: make array static const, makes object smaller
Date: Tue,  3 Aug 2021 13:28:39 +0100	[thread overview]
Message-ID: <> (raw)

From: Colin Ian King <>

Don't populate array names_to_check on the stack but instead it
static.  Makes the object code smaller by 56 bytes.  Also clean
up checkpatch warning by adding extra const for names_to_check
and pointer s.

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

    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 <>

V2: Clean up checkpatch warning on const-ness for names_to_check.
    Add extra const to clean up build warning on pointer s.
 sound/usb/mixer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index db7cb6b6dc4e..43bc59575a6e 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1572,9 +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[] = {
+	static const char * const names_to_check[] = {
 		"Headset", "headset", "Headphone", "headphone", NULL};
-	const char **s;
+	const char * const *s;
 	bool found = false;
 	if (strcmp("Speaker", kctl->

             reply	other threads:[~2021-08-03 12:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 12:28 Colin King [this message]
2021-08-03 14: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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \
    --subject='Re: [PATCH][V2] ALSA: usb-audio: make array static const, makes object smaller' \

* 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
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).