alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Sangsu Park <sangsu@gmail.com>
Cc: sbkim73@samsung.com, alsa-devel@alsa-project.org,
	lars@metafoo.de, lrg@ti.com, sangsu4u.park@samsung.com
Subject: Re: [PATCH] ASoC: Allocate PCM operations dynamically to support multiple DAIs
Date: Tue, 27 Dec 2011 10:40:05 +0000	[thread overview]
Message-ID: <20111227104005.GC2870@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <CANh+=Y-xM6hq6N1umMxR4PATBj-OmKkfHoSpnzR5q2kjt2b79g@mail.gmail.com>

On Tue, Dec 27, 2011 at 05:06:56PM +0900, Sangsu Park wrote:

> +       /* free the ops memory */
> +       if (rtd->ops) kfree(rtd->ops);

We shouldn't be doing a kfree() on the ops at all.

> +++ b/sound/soc/soc-pcm.c
> @@ -641,22 +645,23 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
>         INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);
>         rtd->pcm = pcm;
> +       rtd->ops = soc_pcm_ops;

That *might* work if ops were changed to be a member variable, though
it's racy against two things initializing simultaneously.  

What I'd expect is something like:

        INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);
	rtd->pcm = pcm;
	rtd->pcm_ops = soc_pcm_ops;
	pcm->private_data = rtd;
	if (platform->driver->ops) {
		rtd->pcm_ops.mmap = platform->driver->ops->mmap;
		rtd->pcm_ops.pointer = platform->driver->ops->pointer;


and so on so we start off by taking a copy of the default ops then copy
the new ops in in the same fashion.  

Ideally we should also have an indirection for ioctl() though using it
at all is dodgy.

  reply	other threads:[~2011-12-27 10:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-27  8:06 [PATCH] ASoC: Allocate PCM operations dynamically to support multiple DAIs Sangsu Park
2011-12-27 10:40 ` Mark Brown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-12-27  7:49 Sangsu Park
2011-12-27 10:34 ` Mark Brown
2011-12-23  1:37 Sangbeom Kim
2011-12-23  9:42 ` Liam Girdwood
2011-12-23 10:21   ` Mark Brown
2011-12-23 10:24 ` Mark Brown
2011-12-23  0:26 Sangbeom Kim
2011-12-23 11:36 ` Lars-Peter Clausen

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=20111227104005.GC2870@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lars@metafoo.de \
    --cc=lrg@ti.com \
    --cc=sangsu4u.park@samsung.com \
    --cc=sangsu@gmail.com \
    --cc=sbkim73@samsung.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).