regmap: Add a config option for hwspinlock
Unlike other lock types hwspinlocks are optional and can be built modular so we can't use them unconditionally in regmap so add a config option that drivers that want to use hwspinlocks with regmap can select which will ensure that hwspinlock is built in. Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
8698b93647
commit
f25637a6b8
2 changed files with 11 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
||||||
config REGMAP
|
config REGMAP
|
||||||
default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
|
default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
|
||||||
select IRQ_DOMAIN if REGMAP_IRQ
|
select IRQ_DOMAIN if REGMAP_IRQ
|
||||||
|
select HWSPINLOCK if REGMAP_HWSPINLOCK
|
||||||
bool
|
bool
|
||||||
|
|
||||||
config REGCACHE_COMPRESSED
|
config REGCACHE_COMPRESSED
|
||||||
|
@ -36,3 +37,6 @@ config REGMAP_MMIO
|
||||||
|
|
||||||
config REGMAP_IRQ
|
config REGMAP_IRQ
|
||||||
bool
|
bool
|
||||||
|
|
||||||
|
config REGMAP_HWSPINLOCK
|
||||||
|
bool
|
||||||
|
|
|
@ -414,6 +414,7 @@ static unsigned int regmap_parse_64_native(const void *buf)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef REGMAP_HWSPINLOCK
|
||||||
static void regmap_lock_hwlock(void *__map)
|
static void regmap_lock_hwlock(void *__map)
|
||||||
{
|
{
|
||||||
struct regmap *map = __map;
|
struct regmap *map = __map;
|
||||||
|
@ -456,6 +457,7 @@ static void regmap_unlock_hwlock_irqrestore(void *__map)
|
||||||
|
|
||||||
hwspin_unlock_irqrestore(map->hwlock, &map->spinlock_flags);
|
hwspin_unlock_irqrestore(map->hwlock, &map->spinlock_flags);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void regmap_lock_mutex(void *__map)
|
static void regmap_lock_mutex(void *__map)
|
||||||
{
|
{
|
||||||
|
@ -672,6 +674,7 @@ struct regmap *__regmap_init(struct device *dev,
|
||||||
map->unlock = config->unlock;
|
map->unlock = config->unlock;
|
||||||
map->lock_arg = config->lock_arg;
|
map->lock_arg = config->lock_arg;
|
||||||
} else if (config->hwlock_id) {
|
} else if (config->hwlock_id) {
|
||||||
|
#ifdef REGMAP_HWSPINLOCK
|
||||||
map->hwlock = hwspin_lock_request_specific(config->hwlock_id);
|
map->hwlock = hwspin_lock_request_specific(config->hwlock_id);
|
||||||
if (!map->hwlock) {
|
if (!map->hwlock) {
|
||||||
ret = -ENXIO;
|
ret = -ENXIO;
|
||||||
|
@ -694,6 +697,10 @@ struct regmap *__regmap_init(struct device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
map->lock_arg = map;
|
map->lock_arg = map;
|
||||||
|
#else
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto err;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if ((bus && bus->fast_io) ||
|
if ((bus && bus->fast_io) ||
|
||||||
config->fast_io) {
|
config->fast_io) {
|
||||||
|
|
Loading…
Reference in a new issue