All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lu Guanqun <guanqun.lu@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: ALSA <alsa-devel@alsa-project.org>,
	"clemens@ladisch.de" <clemens@ladisch.de>
Subject: Re: [PATCH 3/3] ALSA: core: set kcontrol's count field correctly
Date: Wed, 24 Aug 2011 14:17:57 +0800	[thread overview]
Message-ID: <20110824061757.GF3551@guanqun-laptop.sh.intel.com> (raw)
In-Reply-To: <s5hy5yjpclx.wl%tiwai@suse.de>

On Wed, Aug 24, 2011 at 02:06:34PM +0800, Takashi Iwai wrote:
> At Wed, 24 Aug 2011 11:12:43 +0800,
> Lu Guanqun wrote:
> > 
> > I don't see how info's owner field relates to kcontrol's count field. It should
> > assign to info's count instead.
> > 
> > Let's assume this scenario:
> > 
> > 1. user reads the control element from kernel (the owner field is set)
> > 2. user changes some values
> > 3. user issues 'SNDRV_CTL_IOCTL_ELEM_REPLACE' ioctl.
> > 
> > With the original code, 'kctl' here gets a large count number due to its
> > non-empty owner field. Therefore it fails on subsequent call snd_ctl_new().
> 
> In IOCTL_ELEM_ADD and REPLACE, count and owner struct fields have
> different meanings from others.  The count contains the array size,
> not the number of identical elements.  And the owner contains the
> number of elements to be created.  So, the current code is correct.

This sounds tricky...

in snd_ctl_elem_info():
	info->owner = pid_vnr(vd->owner->pid);
} else {
	info->owner = -1;

This is where owner of info get assigned, but it's not number of
elements to be created. I'm a bit unclear on this.

> 
> What we need is the documentation of this feature...

So my test case seems to be wrong, but how should I change it? Do I need
to clear the owner field when user space application sends down the
REPLACE ioctl?

-- 
guanqun

  reply	other threads:[~2011-08-24  6:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24  3:12 [PATCH 1/3] ALSA: core: trivial code style fix Lu Guanqun
2011-08-24  3:12 ` [PATCH 2/3] ALSA: core: release the constraint check for replace ops Lu Guanqun
2011-08-24  6:01   ` Takashi Iwai
2011-08-24  6:08     ` Lu Guanqun
2011-08-24  6:45       ` [PATCH v2] " Lu Guanqun
2011-08-24  8:41         ` Takashi Iwai
2011-08-24  3:12 ` [PATCH 3/3] ALSA: core: set kcontrol's count field correctly Lu Guanqun
2011-08-24  6:06   ` Takashi Iwai
2011-08-24  6:17     ` Lu Guanqun [this message]
2011-08-24  6:26       ` Takashi Iwai
2011-08-24  8:42         ` Takashi Iwai
2011-08-24 11:46           ` Lu Guanqun
2011-08-24 12:05             ` Takashi Iwai
2011-08-24 12:46               ` Lu Guanqun
2011-08-24 13:06                 ` Takashi Iwai
2011-08-24  6:18     ` Takashi Iwai
2011-08-24  8:40 ` [PATCH 1/3] ALSA: core: trivial code style fix 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=20110824061757.GF3551@guanqun-laptop.sh.intel.com \
    --to=guanqun.lu@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.