All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: Make the DAI ops constant in the DAI structure
@ 2010-12-02 17:05 Mark Brown
  2010-12-02 17:05 ` [PATCH 2/2] ASoC: Move active copy of CODEC read and write into runtime structure Mark Brown
  2010-12-03 10:21 ` [PATCH 1/2] ASoC: Make the DAI ops constant in the DAI structure Liam Girdwood
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Brown @ 2010-12-02 17:05 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Neither drivers nor the core should be fiddling with the actual ops
structure at runtime.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 include/sound/soc-dai.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 0195b7e..1bafe95 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -203,7 +203,7 @@ struct snd_soc_dai_driver {
 	int (*resume)(struct snd_soc_dai *dai);
 
 	/* ops */
-	struct snd_soc_dai_ops *ops;
+	const struct snd_soc_dai_ops *ops;
 
 	/* DAI capabilities */
 	struct snd_soc_pcm_stream capture;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ASoC: Move active copy of CODEC read and write into runtime structure
  2010-12-02 17:05 [PATCH 1/2] ASoC: Make the DAI ops constant in the DAI structure Mark Brown
@ 2010-12-02 17:05 ` Mark Brown
  2010-12-03 10:21 ` [PATCH 1/2] ASoC: Make the DAI ops constant in the DAI structure Liam Girdwood
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-12-02 17:05 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

We shouldn't be assigning to the driver structure (which really ought
to be const, further patch to follow) though there's unlikely to be any
actual problem except in the unlikely case that two devices with the
same driver but different bus types appear in the same system.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 include/sound/soc.h   |    2 ++
 sound/soc/soc-cache.c |    4 ++--
 sound/soc/soc-core.c  |    6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4a9195c..714a704 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -476,6 +476,8 @@ struct snd_soc_codec {
 	void *control_data; /* codec control (i2c/3wire) data */
 	hw_write_t hw_write;
 	unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
+	unsigned int (*read)(struct snd_soc_codec *, unsigned int);
+	int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
 	void *reg_cache;
 	const struct snd_soc_cache_ops *cache_ops;
 	struct mutex cache_rw_mutex;
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 5143984..78b25e8 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -728,8 +728,8 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
 		return -EINVAL;
 	}
 
-	codec->driver->write = io_types[i].write;
-	codec->driver->read = io_types[i].read;
+	codec->write = io_types[i].write;
+	codec->read = io_types[i].read;
 
 	switch (control) {
 	case SND_SOC_CUSTOM:
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 20dcc97..5720dbc 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2077,7 +2077,7 @@ unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg)
 {
 	unsigned int ret;
 
-	ret = codec->driver->read(codec, reg);
+	ret = codec->read(codec, reg);
 	dev_dbg(codec->dev, "read %x => %x\n", reg, ret);
 	trace_snd_soc_reg_read(codec, reg, ret);
 
@@ -2090,7 +2090,7 @@ unsigned int snd_soc_write(struct snd_soc_codec *codec,
 {
 	dev_dbg(codec->dev, "write %x = %x\n", reg, val);
 	trace_snd_soc_reg_write(codec, reg, val);
-	return codec->driver->write(codec, reg, val);
+	return codec->write(codec, reg, val);
 }
 EXPORT_SYMBOL_GPL(snd_soc_write);
 
@@ -3448,6 +3448,8 @@ int snd_soc_register_codec(struct device *dev,
 
 	INIT_LIST_HEAD(&codec->dapm.widgets);
 	INIT_LIST_HEAD(&codec->dapm.paths);
+	codec->write = codec_drv->write;
+	codec->read = codec_drv->read;
 	codec->dapm.bias_level = SND_SOC_BIAS_OFF;
 	codec->dapm.dev = dev;
 	codec->dapm.codec = codec;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] ASoC: Make the DAI ops constant in the DAI structure
  2010-12-02 17:05 [PATCH 1/2] ASoC: Make the DAI ops constant in the DAI structure Mark Brown
  2010-12-02 17:05 ` [PATCH 2/2] ASoC: Move active copy of CODEC read and write into runtime structure Mark Brown
@ 2010-12-03 10:21 ` Liam Girdwood
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-12-03 10:21 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches

On Thu, 2010-12-02 at 17:05 +0000, Mark Brown wrote:
> Neither drivers nor the core should be fiddling with the actual ops
> structure at runtime.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---

Both

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-03 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-02 17:05 [PATCH 1/2] ASoC: Make the DAI ops constant in the DAI structure Mark Brown
2010-12-02 17:05 ` [PATCH 2/2] ASoC: Move active copy of CODEC read and write into runtime structure Mark Brown
2010-12-03 10:21 ` [PATCH 1/2] ASoC: Make the DAI ops constant in the DAI structure Liam Girdwood

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.