* [PATCH] ALSA: usb-audio: make array static const, makes object smaller
@ 2021-08-01 6:25 Colin King
2021-08-01 8:05 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-08-01 6:25 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, alsa-devel; +Cc: kernel-janitors, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: usb-audio: make array static const, makes object smaller
2021-08-01 6:25 [PATCH] ALSA: usb-audio: make array static const, makes object smaller Colin King
@ 2021-08-01 8:05 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-08-01 8:05 UTC (permalink / raw)
To: Colin King
Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, kernel-janitors, linux-kernel
On Sun, 01 Aug 2021 08:25:48 +0200,
Colin King wrote:
>
> 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
> + };
checkpatch complains like:
WARNING: static const char * array should probably be static const
char * const
Could you check and resubmit if it's right?
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-01 8:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-01 6:25 [PATCH] ALSA: usb-audio: make array static const, makes object smaller Colin King
2021-08-01 8:05 ` Takashi Iwai
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).