Skip to contentSkip to conversation

ASoC: Push snd_soc_write() and snd_soc_read() into the source file

PATCH In review Mark Brown 2 participants 3 messages Nov 1, 2010 – Nov 3, 2010

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: Push snd_soc_write() and snd_soc_read() into the source file

Facilitating adding trace type stuff. For a first pass add some dev_dbg() statements into them.

---
 include/sound/soc.h  |   14 +++-----------
 sound/soc/soc-core.c |   19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 11 deletions(-)
include/sound/soc.h +3 -11
index 5c3bce8..aaf34d7 100644
@@ -639,17 +639,9 @@ struct soc_enum {
 };
 
 /* codec IO */
-static inline unsigned int snd_soc_read(struct snd_soc_codec *codec,
-					unsigned int reg)
-{
-	return codec->driver->read(codec, reg);
-}
-
-static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
-					 unsigned int reg, unsigned int val)
-{
-	return codec->driver->write(codec, reg, val);
-}
+unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
+unsigned int snd_soc_write(struct snd_soc_codec *codec,
+			   unsigned int reg, unsigned int val);
 
 /* device driver data */
 
sound/soc/soc-core.c +19 -0
index 805343f..6d93d44 100644
@@ -1876,6 +1876,25 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec)
 }
 EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec);
 
+unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg)
+{
+	unsigned int ret;
+
+	ret = codec->driver->read(codec, reg);
+	dev_dbg(codec->dev, "read %x => %x\n", reg, ret);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(snd_soc_read);
+
+unsigned int snd_soc_write(struct snd_soc_codec *codec,
+			   unsigned int reg, unsigned int val)
+{
+	dev_dbg(codec->dev, "write %x = %x\n", reg, val);
+	return codec->driver->write(codec, reg, val);
+}
+EXPORT_SYMBOL_GPL(snd_soc_write);
+
 /**
  * snd_soc_update_bits - update codec register bits
  * @codec: audio codec
Signature · 1 line
1.7.1
#1 lore raw

sound/soc/soc-core.c void snd_soc_free_ac97_codec(struct snd_soc_codec *codec) · line 1896

Quoted 7 lines · Mark Brown
sound/soc/soc-core.c +7 -0
+unsigned int snd_soc_write(struct snd_soc_codec *codec,
+			   unsigned int reg, unsigned int val)
+{
+	dev_dbg(codec->dev, "write %x = %x\n", reg, val);
+	return codec->driver->write(codec, reg, val);
+}
+EXPORT_SYMBOL_GPL(snd_soc_write);

This sort of debugging output is already present in soc-cache.c. I guess it should be removed from soc-cache.c since it is duplicated across all different write() I/O types.

Thanks,
Dimitrios

author
#2 lore raw
Quoted 12 lines · Dimitris Papastamos

sound/soc/soc-core.c void snd_soc_free_ac97_codec(struct snd_soc_codec *codec) · line 1896

Quoted 7 lines · Mark Brown
sound/soc/soc-core.c +7 -0
+unsigned int snd_soc_write(struct snd_soc_codec *codec,
+			   unsigned int reg, unsigned int val)
+{
+	dev_dbg(codec->dev, "write %x = %x\n", reg, val);
+	return codec->driver->write(codec, reg, val);
+}
+EXPORT_SYMBOL_GPL(snd_soc_write);

This sort of debugging output is already present in soc-cache.c. I guess it should be removed from soc-cache.c since it is duplicated across all different write() I/O types.

That's the idea; this is much fewer lines of code and also covers all the MFDs and whatnot that can't use the soc-cache code for whatever reasons.