diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2010-12-06 04:51:57 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-12-06 09:13:46 -0500 |
commit | 0d735eaa2c1d80c997fd775b679e36b80b8e85d1 (patch) | |
tree | 7bfcbe748f68808de5e598853c5d893242d5d963 /sound/soc/soc-cache.c | |
parent | 9545cd85a6dd1cce793b309800d2a03af9a886a8 (diff) |
ASoC: soc-cache: Add optional cache name member to snd_soc_cache_ops
Added an optional name member to snd_soc_cache_ops to enable more
sensible diagnostic messages during cache init, exit and sync.
Remove redundant newline in source code.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r-- | sound/soc/soc-cache.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index ff2bc8beddaa..678fd75d4511 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -1533,6 +1533,7 @@ static int snd_soc_flat_cache_init(struct snd_soc_codec *codec) | |||
1533 | static const struct snd_soc_cache_ops cache_types[] = { | 1533 | static const struct snd_soc_cache_ops cache_types[] = { |
1534 | { | 1534 | { |
1535 | .id = SND_SOC_FLAT_COMPRESSION, | 1535 | .id = SND_SOC_FLAT_COMPRESSION, |
1536 | .name = "flat", | ||
1536 | .init = snd_soc_flat_cache_init, | 1537 | .init = snd_soc_flat_cache_init, |
1537 | .exit = snd_soc_flat_cache_exit, | 1538 | .exit = snd_soc_flat_cache_exit, |
1538 | .read = snd_soc_flat_cache_read, | 1539 | .read = snd_soc_flat_cache_read, |
@@ -1541,6 +1542,7 @@ static const struct snd_soc_cache_ops cache_types[] = { | |||
1541 | }, | 1542 | }, |
1542 | { | 1543 | { |
1543 | .id = SND_SOC_LZO_COMPRESSION, | 1544 | .id = SND_SOC_LZO_COMPRESSION, |
1545 | .name = "LZO", | ||
1544 | .init = snd_soc_lzo_cache_init, | 1546 | .init = snd_soc_lzo_cache_init, |
1545 | .exit = snd_soc_lzo_cache_exit, | 1547 | .exit = snd_soc_lzo_cache_exit, |
1546 | .read = snd_soc_lzo_cache_read, | 1548 | .read = snd_soc_lzo_cache_read, |
@@ -1549,6 +1551,7 @@ static const struct snd_soc_cache_ops cache_types[] = { | |||
1549 | }, | 1551 | }, |
1550 | { | 1552 | { |
1551 | .id = SND_SOC_RBTREE_COMPRESSION, | 1553 | .id = SND_SOC_RBTREE_COMPRESSION, |
1554 | .name = "rbtree", | ||
1552 | .init = snd_soc_rbtree_cache_init, | 1555 | .init = snd_soc_rbtree_cache_init, |
1553 | .exit = snd_soc_rbtree_cache_exit, | 1556 | .exit = snd_soc_rbtree_cache_exit, |
1554 | .read = snd_soc_rbtree_cache_read, | 1557 | .read = snd_soc_rbtree_cache_read, |
@@ -1573,8 +1576,12 @@ int snd_soc_cache_init(struct snd_soc_codec *codec) | |||
1573 | mutex_init(&codec->cache_rw_mutex); | 1576 | mutex_init(&codec->cache_rw_mutex); |
1574 | codec->cache_ops = &cache_types[i]; | 1577 | codec->cache_ops = &cache_types[i]; |
1575 | 1578 | ||
1576 | if (codec->cache_ops->init) | 1579 | if (codec->cache_ops->init) { |
1580 | if (codec->cache_ops->name) | ||
1581 | dev_dbg(codec->dev, "Initializing %s cache for %s codec\n", | ||
1582 | codec->cache_ops->name, codec->name); | ||
1577 | return codec->cache_ops->init(codec); | 1583 | return codec->cache_ops->init(codec); |
1584 | } | ||
1578 | return -EINVAL; | 1585 | return -EINVAL; |
1579 | } | 1586 | } |
1580 | 1587 | ||
@@ -1584,8 +1591,12 @@ int snd_soc_cache_init(struct snd_soc_codec *codec) | |||
1584 | */ | 1591 | */ |
1585 | int snd_soc_cache_exit(struct snd_soc_codec *codec) | 1592 | int snd_soc_cache_exit(struct snd_soc_codec *codec) |
1586 | { | 1593 | { |
1587 | if (codec->cache_ops && codec->cache_ops->exit) | 1594 | if (codec->cache_ops && codec->cache_ops->exit) { |
1595 | if (codec->cache_ops->name) | ||
1596 | dev_dbg(codec->dev, "Destroying %s cache for %s codec\n", | ||
1597 | codec->cache_ops->name, codec->name); | ||
1588 | return codec->cache_ops->exit(codec); | 1598 | return codec->cache_ops->exit(codec); |
1599 | } | ||
1589 | return -EINVAL; | 1600 | return -EINVAL; |
1590 | } | 1601 | } |
1591 | 1602 | ||
@@ -1657,6 +1668,9 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec) | |||
1657 | } | 1668 | } |
1658 | 1669 | ||
1659 | if (codec->cache_ops && codec->cache_ops->sync) { | 1670 | if (codec->cache_ops && codec->cache_ops->sync) { |
1671 | if (codec->cache_ops->name) | ||
1672 | dev_dbg(codec->dev, "Syncing %s cache for %s codec\n", | ||
1673 | codec->cache_ops->name, codec->name); | ||
1660 | ret = codec->cache_ops->sync(codec); | 1674 | ret = codec->cache_ops->sync(codec); |
1661 | if (!ret) | 1675 | if (!ret) |
1662 | codec->cache_sync = 0; | 1676 | codec->cache_sync = 0; |