From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: alsa-devel@alsa-project.org,
Colin King <colin.king@canonical.com>,
Jaroslav Kysela <perex@perex.cz>,
wharms@bfs.de, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: drivers: make array 'names' const, reduces object code size
Date: Mon, 27 Nov 2017 19:51:20 +0000 [thread overview]
Message-ID: <s5h7eubmrev.wl-tiwai@suse.de> (raw)
In-Reply-To: <11bbcc13-2ff9-68ed-6331-f65c2247b4db@sakamocchi.jp>
On Mon, 27 Nov 2017 18:34:17 +0100,
Takashi Sakamoto wrote:
>
> Hi,
>
> On Nov 27 2017 21:58, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > Don't populate array 'names' on the stack but instead make them static.
> > Makes the object code smaller by 50 bytes:
> >
> > Before:
> > text data bss dec hex filename
> > 21237 9192 1120 31549 7b3d linux/sound/drivers/dummy.o
> >
> > After:
> > text data bss dec hex filename
> > 21095 9280 1120 31495 7b07 linux/sound/drivers/dummy.o
> >
> > (gcc version 7.2.0 x86_64)
> >
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> > sound/drivers/dummy.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
> > index 7b2b1f766b00..69db45bc0197 100644
> > --- a/sound/drivers/dummy.c
> > +++ b/sound/drivers/dummy.c
> > @@ -830,7 +830,7 @@ static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
> > static int snd_dummy_iobox_info(struct snd_kcontrol *kcontrol,
> > struct snd_ctl_elem_info *info)
> > {
> > - const char *const names[] = { "None", "CD Player" };
> > + static const char *const names[] = { "None", "CD Player" };
> > return snd_ctl_enum_info(info, 1, 2, names);
> > }
>
> Total size of snd-dummy.ko increases but this patch has an advantage
> to have the symbol in read-only section.
The total size decreases :)
Takashi
next prev parent reply other threads:[~2017-11-27 19:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 12:58 [PATCH] ALSA: drivers: make array 'names' const, reduces object code size Colin King
2017-11-27 14:55 ` walter harms
2017-11-27 15:40 ` Joe Perches
2017-11-27 16:00 ` walter harms
2017-11-27 17:34 ` Takashi Sakamoto
2017-11-27 19:51 ` Takashi Iwai [this message]
2017-11-28 10:39 ` Takashi Sakamoto
2017-11-27 19:51 ` 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=s5h7eubmrev.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=colin.king@canonical.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=o-takashi@sakamocchi.jp \
--cc=perex@perex.cz \
--cc=wharms@bfs.de \
/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