Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323291
b: refs/heads/master
c: 1603262
h: refs/heads/master
i:
  323289: 909dfed
  323287: 3e33666
v: v3
  • Loading branch information
Stephen Warren authored and Mark Brown committed Aug 4, 2012
1 parent 324b344 commit 288de69
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4d879514e73f3e6b27617d9898c83c9939462dda
refs/heads/master: 16032624f511b2fac0671cba5e7da40aa7e73a66
29 changes: 15 additions & 14 deletions trunk/drivers/base/regmap/regmap-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,21 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data);
struct regmap *map = d->map;
int i, ret;
u32 reg;

/*
* If there's been a change in the mask write it back to the
* hardware. We rely on the use of the regmap core cache to
* suppress pointless writes.
*/
for (i = 0; i < d->chip->num_regs; i++) {
ret = regmap_update_bits(d->map, d->chip->mask_base +
(i * map->reg_stride *
d->irq_reg_stride),
reg = d->chip->mask_base +
(i * map->reg_stride * d->irq_reg_stride);
ret = regmap_update_bits(d->map, reg,
d->mask_buf_def[i], d->mask_buf[i]);
if (ret != 0)
dev_err(d->map->dev, "Failed to sync masks in %x\n",
d->chip->mask_base + (i * map->reg_stride));
reg);
}

/* If we've changed our wakeup count propagate it to the parent */
Expand Down Expand Up @@ -144,6 +145,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
struct regmap *map = data->map;
int ret, i;
bool handled = false;
u32 reg;

/*
* Ignore masked IRQs and ack if we need to; we ack early so
Expand All @@ -166,14 +168,12 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
data->status_buf[i] &= ~data->mask_buf[i];

if (data->status_buf[i] && chip->ack_base) {
ret = regmap_write(map, chip->ack_base +
(i * map->reg_stride *
data->irq_reg_stride),
data->status_buf[i]);
reg = chip->ack_base +
(i * map->reg_stride * data->irq_reg_stride);
ret = regmap_write(map, reg, data->status_buf[i]);
if (ret != 0)
dev_err(map->dev, "Failed to ack 0x%x: %d\n",
chip->ack_base + (i * map->reg_stride),
ret);
reg, ret);
}
}

Expand Down Expand Up @@ -238,6 +238,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
struct regmap_irq_chip_data *d;
int i;
int ret = -ENOMEM;
u32 reg;

for (i = 0; i < chip->num_irqs; i++) {
if (chip->irqs[i].reg_offset % map->reg_stride)
Expand Down Expand Up @@ -303,12 +304,12 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
/* Mask all the interrupts by default */
for (i = 0; i < chip->num_regs; i++) {
d->mask_buf[i] = d->mask_buf_def[i];
ret = regmap_write(map, chip->mask_base + (i * map->reg_stride
* d->irq_reg_stride),
d->mask_buf[i]);
reg = chip->mask_base +
(i * map->reg_stride * d->irq_reg_stride);
ret = regmap_write(map, reg, d->mask_buf[i]);
if (ret != 0) {
dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
chip->mask_base + (i * map->reg_stride), ret);
reg, ret);
goto err_alloc;
}
}
Expand Down
13 changes: 9 additions & 4 deletions trunk/drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,12 +659,13 @@ EXPORT_SYMBOL_GPL(devm_regmap_init);
* new cache. This can be used to restore the cache to defaults or to
* update the cache configuration to reflect runtime discovery of the
* hardware.
*
* No explicit locking is done here, the user needs to ensure that
* this function will not race with other calls to regmap.
*/
int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
{
int ret;

map->lock(map);

regcache_exit(map);
regmap_debugfs_exit(map);

Expand All @@ -680,7 +681,11 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
map->cache_bypass = false;
map->cache_only = false;

return regcache_init(map, config);
ret = regcache_init(map, config);

map->unlock(map);

return ret;
}
EXPORT_SYMBOL_GPL(regmap_reinit_cache);

Expand Down

0 comments on commit 288de69

Please sign in to comment.