From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH 2/4] ASoC: soc-cache: Add support for flat register caching
Date: Fri, 05 Nov 2010 13:59:51 +0000 [thread overview]
Message-ID: <1288965591.8256.40.camel@dplaptop> (raw)
In-Reply-To: <20101105133143.GH13709@opensource.wolfsonmicro.com>
On Fri, 2010-11-05 at 09:31 -0400, Mark Brown wrote:
> On Fri, Nov 05, 2010 at 09:34:37AM +0000, Dimitris Papastamos wrote:
> > On Thu, 2010-11-04 at 14:31 -0400, Mark Brown wrote:
>
> > > > + mutex_init(&cache_rw_mutex);
> > > > +
>
> > > I'd kind of expect this to be with the other cache setup?
>
> > Do you mean that the mutex should also be used with the other caching
> > techniques? That is not needed because we currently lock at a higher
> > level, in the function that delegates the calls to the implementation
> > functions.
>
> I'd expect this to be with the rest of the initialisation for the
> structure that it's embedded in - having this be initialised in this
> place separately to anything else feels wrong. Of course at the minute
> it's not in a structure (which I raised as an issue as well IIRC) which
> means that we'll have an issue with multiple initialisation if two
> devices are registered.
Aw yes, I've made the mutex to be per codec, so its initialized in
snd_soc_cache_init() for each codec that's registered.
>
> > Any CODEC driver that calls snd_soc_register_codec() and has provided
> > reg_cache_size and reg_word_size will have soc-core setting up its cache
> > accordingly. By default the provided snd_soc_codec_driver is zero-ed
> > out, so its compress_type will default to the flat compression type.
>
> Are you absolutely positive that every user of the code is using a
> register cache initialised using that method?
If people don't want to use our caching API, then if they need so they
will have to manage that locally somewhere in the driver code. In that
scenario, they will not call snd_soc_codec_set_cache_io() and they will
have to set the codec->read() and codec->write() to point to their own
implementation. They should also not set reg_cache_size and
reg_word_size.
The previous caching code had the same issue. If someone called
snd_soc_codec_set_cache_io() and they had not provided a valid
reg_cache_size and reg_word_size (both of them were zero), the
underlying codec->reg_cache would have been NULL and therefore any
read()/write() operations going through soc-cache.c would result
in an invalid access.
Thanks,
Dimitrios
next prev parent reply other threads:[~2010-11-05 13:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-04 14:22 [PATCH 0/4] ASoC: Introduce the new caching API Dimitris Papastamos
2010-11-04 14:22 ` [PATCH 1/4] ASoC: soc.h: Add new caching API prototypes and hooks Dimitris Papastamos
2010-11-04 18:20 ` Mark Brown
2010-11-04 14:22 ` [PATCH 2/4] ASoC: soc-cache: Add support for flat register caching Dimitris Papastamos
2010-11-04 18:31 ` Mark Brown
2010-11-05 9:34 ` Dimitris Papastamos
2010-11-05 13:31 ` Mark Brown
2010-11-05 13:59 ` Dimitris Papastamos [this message]
2010-11-05 14:07 ` Mark Brown
2010-11-05 14:12 ` Dimitris Papastamos
2010-11-05 15:25 ` Mark Brown
2010-11-05 11:45 ` Dimitris Papastamos
2010-11-04 14:22 ` [PATCH 3/4] ASoC: soc-cache: Add support for LZO " Dimitris Papastamos
2010-11-04 22:45 ` Mark Brown
2010-11-05 10:22 ` Dimitris Papastamos
2010-11-05 13:33 ` Mark Brown
2010-11-04 14:22 ` [PATCH 4/4] ASoC: soc-cache: Add support for rbtree based " Dimitris Papastamos
2010-11-04 18:49 ` Mark Brown
2010-11-04 18:50 ` Mark Brown
2010-11-05 9:38 ` Dimitris Papastamos
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=1288965591.8256.40.camel@dplaptop \
--to=dp@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@slimlogic.co.uk \
--cc=patches@opensource.wolfsonmicro.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 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.