alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Neil Jones <neiljay@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: Question about ASOC codec drivers
Date: Thu, 20 Jan 2011 20:54:35 +0000	[thread overview]
Message-ID: <20110120205435.GA1815@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <AANLkTinKB1gHgrvk=pfbqqQnGaebne6uuVFFGARdS7+D@mail.gmail.com>

On Thu, Jan 20, 2011 at 04:12:12PM +0000, Neil Jones wrote:
> > ...is exactly what you told the driver to do.  You've told the core
> > there are seven items in the enumeration so it's expecting an array of
> > seven strings.

> DUH! sorry, in my head i read .xmax as .xmask cheers for the spot.

> I still get 'Failed to add route Line Input->Input Mux' though ?

You've probably typoed one of the strings.  Look at the code to see why
it's detecting this error.

> @@ -761,6 +761,8 @@ typedef int __bitwise snd_ctl_elem_iface_t;
>  #define SNDRV_CTL_POWER_D3hot          (SNDRV_CTL_POWER_D3|0x0000)
>  /* Off, with power */
>  #define SNDRV_CTL_POWER_D3cold         (SNDRV_CTL_POWER_D3|0x0001)
>  /* Off, without power */
> 
> +#define SNDRV_CTL_ELEMENT_INFO_NAME_LENGTH 64
> +
>  struct snd_ctl_elem_id {
>         unsigned int numid;             /* numeric identifier, zero = invalid */
>         snd_ctl_elem_iface_t iface;     /* interface identifier */
> @@ -799,7 +801,8 @@ struct snd_ctl_elem_info {
>                 struct {
>                         unsigned int items;     /* R: number of items */
>                         unsigned int item;      /* W: item number */
> -                       char name[64];          /* R: value name */
> +                       /* R: value name */
> +                       char name[SNDRV_CTL_ELEMENT_INFO_NAME_LENGTH];
>                 } enumerated;
>                 unsigned char reserved[128];
>         } value;

This I'd submit separately to Takashi.

> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -2056,8 +2056,9 @@ int snd_soc_info_enum_double(struct snd_kcontrol
> *kcontrol,
> 
>         if (uinfo->value.enumerated.item > e->max - 1)
>                 uinfo->value.enumerated.item = e->max - 1;
> -       strcpy(uinfo->value.enumerated.name,
> -               e->texts[uinfo->value.enumerated.item]);
> +       strncpy(uinfo->value.enumerated.name,
> +               e->texts[uinfo->value.enumerated.item],
> +               SNDRV_CTL_ELEMENT_INFO_NAME_LENGTH);
>         return 0;

ARRAY_SIZE() would do just as well here but this does look reasonable.

      reply	other threads:[~2011-01-20 20:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18 17:35 Question about ASOC codec drivers Neil Jones
2011-01-18 19:19 ` Mark Brown
2011-01-20 16:12   ` Neil Jones
2011-01-20 20:54     ` Mark Brown [this message]

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=20110120205435.GA1815@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=neiljay@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).