[PATCH 8/8] regmap: Ensure we scream if we enable cache bypass/only at the same time

Dimitris Papastamos
2011-09-29T09:39:26Z

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
drivers/base/regmap/regcache.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index eaa2e20..82e619e 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -280,6 +280,7 @@ EXPORT_SYMBOL_GPL(regcache_sync);
*/
void regcache_cache_only(struct regmap *map, bool enable)
{
+ BUG_ON(map->cache_bypass && enable);
mutex_lock(&map->lock);
map->cache_only = enable;
mutex_unlock(&map->lock);
@@ -299,6 +300,7 @@ EXPORT_SYMBOL_GPL(regcache_cache_only);
*/
void regcache_cache_bypass(struct regmap *map, bool enable)
{
+ BUG_ON(map->cache_only && enable);
mutex_lock(&map->lock);
map->cache_bypass = enable;
mutex_unlock(&map->lock);
--
1.7.6.4