From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] ALSA: Warn when control names are truncated Date: Wed, 29 Oct 2008 15:46:58 +0100 Message-ID: References: <1225291230-17812-1-git-send-email-broonie@opensource.wolfsonmicro.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id C8AE024440 for ; Wed, 29 Oct 2008 15:46:58 +0100 (CET) In-Reply-To: <1225291230-17812-1-git-send-email-broonie@opensource.wolfsonmicro.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Wed, 29 Oct 2008 14:40:30 +0000, Mark Brown wrote: > > This is likely to confuse user interfaces since the end of the control > name is interpreted (eg, "Volume", "Switch"). > > Signed-off-by: Mark Brown Thanks, applied now. Takashi > --- > sound/core/control.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/sound/core/control.c b/sound/core/control.c > index 6d71f9a..b0bf426 100644 > --- a/sound/core/control.c > +++ b/sound/core/control.c > @@ -225,8 +225,13 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, > kctl.id.iface = ncontrol->iface; > kctl.id.device = ncontrol->device; > kctl.id.subdevice = ncontrol->subdevice; > - if (ncontrol->name) > + if (ncontrol->name) { > strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name)); > + if (strcmp(ncontrol->name, kctl.id.name) != 0) > + snd_printk(KERN_WARNING > + "Control name '%s' truncated to '%s'\n", > + ncontrol->name, kctl.id.name); > + } > kctl.id.index = ncontrol->index; > kctl.count = ncontrol->count ? ncontrol->count : 1; > access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : > -- > 1.5.6.5 >