All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"w.sang@pengutronix.de" <w.sang@pengutronix.de>,
	Dong Aisheng-B29396 <B29396@freescale.com>,
	"lrg@ti.com" <lrg@ti.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/1] ASoC: core: cache index fix
Date: Tue, 02 Aug 2011 20:06:23 +0200	[thread overview]
Message-ID: <s5h4o1zsn6o.wl%tiwai@suse.de> (raw)
In-Reply-To: <20110802164005.GI25884@opensource.wolfsonmicro.com>

At Wed, 3 Aug 2011 01:40:06 +0900,
Mark Brown wrote:
> 
> On Tue, Aug 02, 2011 at 06:13:11PM +0200, Takashi Iwai wrote:
> > Mark Brown wrote:
> 
> > > Like I've indicated several times now we should just get rid of the code
> > > or hide it from the rest of the subsystem, it's being too cute for
> > > vanishingly little value.  The register maps for these devices are
> > > usually at most 255 registers so the memory savings are really not
> > > meaningful.  I'm hoping the guys working with this device will find time
> > > to look at fixing things, but if not I'd imagine we'll get to it at some
> > > point in the release cycle.
> 
> > Well, there aren't so many drivers suffering from this bug, so a
> > temporary fix would be easy like below (totally untested).
> 
> If we're going to do something like this I'd preserve the driver
> interface that's there rather than fiddling with their reg_cache_sizes -
> half the trouble here is that the meaning of that has become a bit
> slippery, the current code used to be correct.

I don't mind either way as long as it gets fixed in way applicable
to stable kernel tree.

> > @@ -421,7 +422,9 @@ static int snd_soc_rbtree_cache_init(struct snd_soc_codec *codec)
> >  		return 0;
> >  
> >  	word_size = codec->driver->reg_word_size;
> > -	for (i = 0; i < codec->driver->reg_cache_size; ++i) {
> > +	if (codec->driver->reg_cache_step)
> > +		step = codec->driver->reg_cache_step;
> > +	for (i = 0; i < codec->driver->reg_cache_size; i += step) {
> >  		val = snd_soc_get_cache_val(codec->reg_def_copy, i,
> >  					    word_size);
> >  		if (!val)
> 
> I'm also really unhappy with handling this in the complex caches, I'd be
> much more inclined to just disallow their use with devices with step
> sizes than to add any complexity to them.

Yeah, I find it's ugly, too.  OTOH, reg_cache_step defines the
validity of the register access, so we can't drop it completely.
Accessing the odd number of register index is invalid when step=2, for
example.  So, alternatively, we can put the condition in some generic
filter function like readable/writeble things.


thanks,

Takashi

WARNING: multiple messages have this Message-ID (diff)
From: tiwai@suse.de (Takashi Iwai)
To: linux-arm-kernel@lists.infradead.org
Subject: [alsa-devel] [PATCH 1/1] ASoC: core: cache index fix
Date: Tue, 02 Aug 2011 20:06:23 +0200	[thread overview]
Message-ID: <s5h4o1zsn6o.wl%tiwai@suse.de> (raw)
In-Reply-To: <20110802164005.GI25884@opensource.wolfsonmicro.com>

At Wed, 3 Aug 2011 01:40:06 +0900,
Mark Brown wrote:
> 
> On Tue, Aug 02, 2011 at 06:13:11PM +0200, Takashi Iwai wrote:
> > Mark Brown wrote:
> 
> > > Like I've indicated several times now we should just get rid of the code
> > > or hide it from the rest of the subsystem, it's being too cute for
> > > vanishingly little value.  The register maps for these devices are
> > > usually at most 255 registers so the memory savings are really not
> > > meaningful.  I'm hoping the guys working with this device will find time
> > > to look at fixing things, but if not I'd imagine we'll get to it at some
> > > point in the release cycle.
> 
> > Well, there aren't so many drivers suffering from this bug, so a
> > temporary fix would be easy like below (totally untested).
> 
> If we're going to do something like this I'd preserve the driver
> interface that's there rather than fiddling with their reg_cache_sizes -
> half the trouble here is that the meaning of that has become a bit
> slippery, the current code used to be correct.

I don't mind either way as long as it gets fixed in way applicable
to stable kernel tree.

> > @@ -421,7 +422,9 @@ static int snd_soc_rbtree_cache_init(struct snd_soc_codec *codec)
> >  		return 0;
> >  
> >  	word_size = codec->driver->reg_word_size;
> > -	for (i = 0; i < codec->driver->reg_cache_size; ++i) {
> > +	if (codec->driver->reg_cache_step)
> > +		step = codec->driver->reg_cache_step;
> > +	for (i = 0; i < codec->driver->reg_cache_size; i += step) {
> >  		val = snd_soc_get_cache_val(codec->reg_def_copy, i,
> >  					    word_size);
> >  		if (!val)
> 
> I'm also really unhappy with handling this in the complex caches, I'd be
> much more inclined to just disallow their use with devices with step
> sizes than to add any complexity to them.

Yeah, I find it's ugly, too.  OTOH, reg_cache_step defines the
validity of the register access, so we can't drop it completely.
Accessing the odd number of register index is invalid when step=2, for
example.  So, alternatively, we can put the condition in some generic
filter function like readable/writeble things.


thanks,

Takashi

  reply	other threads:[~2011-08-02 18:06 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 11:38 [PATCH 1/1] ASoC: core: cache index fix Dong Aisheng
2011-08-01 11:38 ` Dong Aisheng
2011-08-01 11:51 ` Mark Brown
2011-08-01 11:51   ` Mark Brown
2011-08-02  8:03   ` Dong Aisheng-B29396
2011-08-02  8:03     ` Dong Aisheng-B29396
2011-08-02  8:38     ` Mark Brown
2011-08-02  8:38       ` Mark Brown
2011-08-02  9:41       ` Dong Aisheng-B29396
2011-08-02  9:41         ` Dong Aisheng-B29396
2011-08-02 10:34         ` Takashi Iwai
2011-08-02 10:34           ` [alsa-devel] " Takashi Iwai
2011-08-02 10:55           ` Dong Aisheng-B29396
2011-08-02 10:55             ` [alsa-devel] " Dong Aisheng-B29396
2011-08-02 11:09             ` Takashi Iwai
2011-08-02 11:09               ` [alsa-devel] " Takashi Iwai
2011-08-02 11:15               ` Dong Aisheng-B29396
2011-08-02 11:15                 ` [alsa-devel] " Dong Aisheng-B29396
2011-08-02 12:10                 ` Takashi Iwai
2011-08-02 12:10                   ` [alsa-devel] " Takashi Iwai
2011-08-02 12:29                   ` Dong Aisheng-B29396
2011-08-02 12:29                     ` [alsa-devel] " Dong Aisheng-B29396
2011-08-02 12:52                     ` Takashi Iwai
2011-08-02 12:52                       ` [alsa-devel] " Takashi Iwai
2011-08-02 15:48                       ` Mark Brown
2011-08-02 15:48                         ` [alsa-devel] " Mark Brown
2011-08-02 16:13                         ` Takashi Iwai
2011-08-02 16:13                           ` [alsa-devel] " Takashi Iwai
2011-08-02 16:40                           ` Mark Brown
2011-08-02 16:40                             ` [alsa-devel] " Mark Brown
2011-08-02 18:06                             ` Takashi Iwai [this message]
2011-08-02 18:06                               ` Takashi Iwai
2011-08-03  5:23                               ` Mark Brown
2011-08-03  5:23                                 ` Mark Brown
2011-08-03  6:20                                 ` Takashi Iwai
2011-08-03  6:20                                   ` Takashi Iwai
2011-08-03  9:00                                   ` Mark Brown
2011-08-03  9:00                                     ` [alsa-devel] " Mark Brown
2011-08-03  7:03                                 ` Dong Aisheng-B29396
2011-08-03  7:03                                   ` [alsa-devel] " Dong Aisheng-B29396
2011-08-03  7:39                             ` Dong Aisheng-B29396
2011-08-03  7:39                               ` [alsa-devel] " Dong Aisheng-B29396
2011-08-03  9:31                               ` Mark Brown
2011-08-03  9:31                                 ` [alsa-devel] " Mark Brown
2011-08-03 11:11                                 ` Dong Aisheng-B29396
2011-08-03 11:11                                   ` [alsa-devel] " Dong Aisheng-B29396
2011-08-06 19:01                         ` preetam
2011-08-07  3:02                           ` Mark Brown
2011-08-07  4:12                             ` preetam
2011-08-07  4:18                               ` preetam
2011-08-07  9:51                                 ` Mark Brown
2011-08-02 12:58           ` Mark Brown
2011-08-02 12:58             ` [alsa-devel] " Mark Brown
2011-08-02 13:17         ` Dong Aisheng-B29396
2011-08-02 13:17           ` Dong Aisheng-B29396
2011-08-02 15:27           ` Mark Brown
2011-08-02 15:27             ` Mark Brown
2011-08-02 16:05         ` Mark Brown
2011-08-02 16:05           ` Mark Brown
2011-08-02  9:51       ` Wolfram Sang
2011-08-02  9:51         ` Wolfram Sang
2011-08-02 10:38         ` Takashi Iwai
2011-08-02 10:38           ` [alsa-devel] " Takashi Iwai
2011-08-02 15:29         ` Mark Brown
2011-08-02 15:29           ` Mark Brown

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=s5h4o1zsn6o.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=B29396@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lrg@ti.com \
    --cc=s.hauer@pengutronix.de \
    --cc=w.sang@pengutronix.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.