* [PATCH 1/2] ASoC: soc-cache: Fix indentation issues
@ 2011-03-28 10:34 Dimitris Papastamos
2011-03-28 10:34 ` [PATCH 2/2] ASoC: soc-cache: Warn on syncing any non-writable registers Dimitris Papastamos
0 siblings, 1 reply; 3+ messages in thread
From: Dimitris Papastamos @ 2011-03-28 10:34 UTC (permalink / raw)
To: Mark Brown, lrg; +Cc: alsa-devel, patches
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
sound/soc/soc-cache.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 1210a6f..22c0b95 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -93,13 +93,13 @@ static unsigned int do_hw_read(struct snd_soc_codec *codec, unsigned int reg)
}
static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec,
- unsigned int reg)
+ unsigned int reg)
{
return do_hw_read(codec, reg);
}
static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg,
- unsigned int value)
+ unsigned int value)
{
u8 data[2];
@@ -111,7 +111,7 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg,
#if defined(CONFIG_SPI_MASTER)
static int snd_soc_4_12_spi_write(void *control_data, const char *data,
- int len)
+ int len)
{
u8 msg[2];
@@ -209,7 +209,7 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec,
#if defined(CONFIG_SPI_MASTER)
static int snd_soc_8_16_spi_write(void *control_data, const char *data,
- int len)
+ int len)
{
u8 msg[3];
@@ -257,7 +257,7 @@ static unsigned int do_i2c_read(struct snd_soc_codec *codec,
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
static unsigned int snd_soc_8_8_read_i2c(struct snd_soc_codec *codec,
- unsigned int r)
+ unsigned int r)
{
u8 reg = r;
u8 data;
@@ -307,13 +307,13 @@ static unsigned int snd_soc_16_8_read_i2c(struct snd_soc_codec *codec,
#endif
static unsigned int snd_soc_16_8_read(struct snd_soc_codec *codec,
- unsigned int reg)
+ unsigned int reg)
{
return do_hw_read(codec, reg);
}
static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
- unsigned int value)
+ unsigned int value)
{
u8 data[3];
@@ -327,7 +327,7 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
#if defined(CONFIG_SPI_MASTER)
static int snd_soc_16_8_spi_write(void *control_data, const char *data,
- int len)
+ int len)
{
u8 msg[3];
@@ -379,7 +379,7 @@ static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg,
#if defined(CONFIG_SPI_MASTER)
static int snd_soc_16_16_spi_write(void *control_data, const char *data,
- int len)
+ int len)
{
u8 msg[4];
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] ASoC: soc-cache: Warn on syncing any non-writable registers
2011-03-28 10:34 [PATCH 1/2] ASoC: soc-cache: Fix indentation issues Dimitris Papastamos
@ 2011-03-28 10:34 ` Dimitris Papastamos
0 siblings, 0 replies; 3+ messages in thread
From: Dimitris Papastamos @ 2011-03-28 10:34 UTC (permalink / raw)
To: Mark Brown, lrg; +Cc: alsa-devel, patches
When syncing the cache, if the driver has given us a writable_register()
callback, use it to check if we are syncing a non-writable register
and if so warn the user.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
sound/soc/soc-cache.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 22c0b95..94a7ff8 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -661,6 +661,8 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
rbnode = rb_entry(node, struct snd_soc_rbtree_node, node);
if (rbnode->value == rbnode->defval)
continue;
+ WARN_ON(codec->writable_register &&
+ !codec->writable_register(codec, rbnode->reg));
ret = snd_soc_cache_read(codec, rbnode->reg, &val);
if (ret)
return ret;
@@ -921,6 +923,8 @@ static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec)
lzo_blocks = codec->reg_cache;
for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
+ WARN_ON(codec->writable_register &&
+ !codec->writable_register(codec, i));
ret = snd_soc_cache_read(codec, i, &val);
if (ret)
return ret;
@@ -1179,6 +1183,8 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
codec_drv = codec->driver;
for (i = 0; i < codec_drv->reg_cache_size; ++i) {
+ WARN_ON(codec->writable_register &&
+ !codec->writable_register(codec, i));
ret = snd_soc_cache_read(codec, i, &val);
if (ret)
return ret;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/2] ASoC: soc-cache: Fix indentation issues
@ 2011-03-28 10:39 Dimitris Papastamos
2011-03-28 10:39 ` [PATCH 2/2] ASoC: soc-cache: Warn on syncing any non-writable registers Dimitris Papastamos
0 siblings, 1 reply; 3+ messages in thread
From: Dimitris Papastamos @ 2011-03-28 10:39 UTC (permalink / raw)
To: Mark Brown, lrg; +Cc: alsa-devel, patches
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
sound/soc/soc-cache.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 1210a6f..22c0b95 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -93,13 +93,13 @@ static unsigned int do_hw_read(struct snd_soc_codec *codec, unsigned int reg)
}
static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec,
- unsigned int reg)
+ unsigned int reg)
{
return do_hw_read(codec, reg);
}
static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg,
- unsigned int value)
+ unsigned int value)
{
u8 data[2];
@@ -111,7 +111,7 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg,
#if defined(CONFIG_SPI_MASTER)
static int snd_soc_4_12_spi_write(void *control_data, const char *data,
- int len)
+ int len)
{
u8 msg[2];
@@ -209,7 +209,7 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec,
#if defined(CONFIG_SPI_MASTER)
static int snd_soc_8_16_spi_write(void *control_data, const char *data,
- int len)
+ int len)
{
u8 msg[3];
@@ -257,7 +257,7 @@ static unsigned int do_i2c_read(struct snd_soc_codec *codec,
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
static unsigned int snd_soc_8_8_read_i2c(struct snd_soc_codec *codec,
- unsigned int r)
+ unsigned int r)
{
u8 reg = r;
u8 data;
@@ -307,13 +307,13 @@ static unsigned int snd_soc_16_8_read_i2c(struct snd_soc_codec *codec,
#endif
static unsigned int snd_soc_16_8_read(struct snd_soc_codec *codec,
- unsigned int reg)
+ unsigned int reg)
{
return do_hw_read(codec, reg);
}
static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
- unsigned int value)
+ unsigned int value)
{
u8 data[3];
@@ -327,7 +327,7 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
#if defined(CONFIG_SPI_MASTER)
static int snd_soc_16_8_spi_write(void *control_data, const char *data,
- int len)
+ int len)
{
u8 msg[3];
@@ -379,7 +379,7 @@ static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg,
#if defined(CONFIG_SPI_MASTER)
static int snd_soc_16_16_spi_write(void *control_data, const char *data,
- int len)
+ int len)
{
u8 msg[4];
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] ASoC: soc-cache: Warn on syncing any non-writable registers
2011-03-28 10:39 [PATCH 1/2] ASoC: soc-cache: Fix indentation issues Dimitris Papastamos
@ 2011-03-28 10:39 ` Dimitris Papastamos
0 siblings, 0 replies; 3+ messages in thread
From: Dimitris Papastamos @ 2011-03-28 10:39 UTC (permalink / raw)
To: Mark Brown, lrg; +Cc: alsa-devel, patches
When syncing the cache, if the driver has given us a writable_register()
callback, use it to check if we are syncing a non-writable register
and if so warn the user.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
sound/soc/soc-cache.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 22c0b95..22b0990 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -661,6 +661,8 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
rbnode = rb_entry(node, struct snd_soc_rbtree_node, node);
if (rbnode->value == rbnode->defval)
continue;
+ WARN_ON(codec->writable_register &&
+ codec->writable_register(codec, rbnode->reg));
ret = snd_soc_cache_read(codec, rbnode->reg, &val);
if (ret)
return ret;
@@ -921,6 +923,8 @@ static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec)
lzo_blocks = codec->reg_cache;
for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
+ WARN_ON(codec->writable_register &&
+ codec->writable_register(codec, i));
ret = snd_soc_cache_read(codec, i, &val);
if (ret)
return ret;
@@ -1179,6 +1183,8 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
codec_drv = codec->driver;
for (i = 0; i < codec_drv->reg_cache_size; ++i) {
+ WARN_ON(codec->writable_register &&
+ codec->writable_register(codec, i));
ret = snd_soc_cache_read(codec, i, &val);
if (ret)
return ret;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-28 10:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-28 10:34 [PATCH 1/2] ASoC: soc-cache: Fix indentation issues Dimitris Papastamos
2011-03-28 10:34 ` [PATCH 2/2] ASoC: soc-cache: Warn on syncing any non-writable registers Dimitris Papastamos
-- strict thread matches above, loose matches on Subject: below --
2011-03-28 10:39 [PATCH 1/2] ASoC: soc-cache: Fix indentation issues Dimitris Papastamos
2011-03-28 10:39 ` [PATCH 2/2] ASoC: soc-cache: Warn on syncing any non-writable registers Dimitris Papastamos
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).