aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-07-27 15:01:54 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-04 07:13:53 -0400
commit16032624f511b2fac0671cba5e7da40aa7e73a66 (patch)
tree4189c428c8372836bd930841cb406ddf376c33a5 /drivers/base/regmap
parent0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff)
regmap: fix some error messages to take account of irq_reg_stride
A number of places in the code were printing error messages that included the address of a register, but were not calculating the register address in the same way as the access to the register. Use a temporary to solve this. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r--drivers/base/regmap/regmap-irq.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index a89734621e51..c7e5b18f4edc 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -59,6 +59,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
59 struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); 59 struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data);
60 struct regmap *map = d->map; 60 struct regmap *map = d->map;
61 int i, ret; 61 int i, ret;
62 u32 reg;
62 63
63 /* 64 /*
64 * If there's been a change in the mask write it back to the 65 * If there's been a change in the mask write it back to the
@@ -66,13 +67,13 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
66 * suppress pointless writes. 67 * suppress pointless writes.
67 */ 68 */
68 for (i = 0; i < d->chip->num_regs; i++) { 69 for (i = 0; i < d->chip->num_regs; i++) {
69 ret = regmap_update_bits(d->map, d->chip->mask_base + 70 reg = d->chip->mask_base +
70 (i * map->reg_stride * 71 (i * map->reg_stride * d->irq_reg_stride);
71 d->irq_reg_stride), 72 ret = regmap_update_bits(d->map, reg,
72 d->mask_buf_def[i], d->mask_buf[i]); 73 d->mask_buf_def[i], d->mask_buf[i]);
73 if (ret != 0) 74 if (ret != 0)
74 dev_err(d->map->dev, "Failed to sync masks in %x\n", 75 dev_err(d->map->dev, "Failed to sync masks in %x\n",
75 d->chip->mask_base + (i * map->reg_stride)); 76 reg);
76 } 77 }
77 78
78 /* If we've changed our wakeup count propagate it to the parent */ 79 /* If we've changed our wakeup count propagate it to the parent */
@@ -144,6 +145,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
144 struct regmap *map = data->map; 145 struct regmap *map = data->map;
145 int ret, i; 146 int ret, i;
146 bool handled = false; 147 bool handled = false;
148 u32 reg;
147 149
148 /* 150 /*
149 * Ignore masked IRQs and ack if we need to; we ack early so 151 * Ignore masked IRQs and ack if we need to; we ack early so
@@ -166,14 +168,12 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
166 data->status_buf[i] &= ~data->mask_buf[i]; 168 data->status_buf[i] &= ~data->mask_buf[i];
167 169
168 if (data->status_buf[i] && chip->ack_base) { 170 if (data->status_buf[i] && chip->ack_base) {
169 ret = regmap_write(map, chip->ack_base + 171 reg = chip->ack_base +
170 (i * map->reg_stride * 172 (i * map->reg_stride * data->irq_reg_stride);
171 data->irq_reg_stride), 173 ret = regmap_write(map, reg, data->status_buf[i]);
172 data->status_buf[i]);
173 if (ret != 0) 174 if (ret != 0)
174 dev_err(map->dev, "Failed to ack 0x%x: %d\n", 175 dev_err(map->dev, "Failed to ack 0x%x: %d\n",
175 chip->ack_base + (i * map->reg_stride), 176 reg, ret);
176 ret);
177 } 177 }
178 } 178 }
179 179
@@ -238,6 +238,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
238 struct regmap_irq_chip_data *d; 238 struct regmap_irq_chip_data *d;
239 int i; 239 int i;
240 int ret = -ENOMEM; 240 int ret = -ENOMEM;
241 u32 reg;
241 242
242 for (i = 0; i < chip->num_irqs; i++) { 243 for (i = 0; i < chip->num_irqs; i++) {
243 if (chip->irqs[i].reg_offset % map->reg_stride) 244 if (chip->irqs[i].reg_offset % map->reg_stride)
@@ -303,12 +304,12 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
303 /* Mask all the interrupts by default */ 304 /* Mask all the interrupts by default */
304 for (i = 0; i < chip->num_regs; i++) { 305 for (i = 0; i < chip->num_regs; i++) {
305 d->mask_buf[i] = d->mask_buf_def[i]; 306 d->mask_buf[i] = d->mask_buf_def[i];
306 ret = regmap_write(map, chip->mask_base + (i * map->reg_stride 307 reg = chip->mask_base +
307 * d->irq_reg_stride), 308 (i * map->reg_stride * d->irq_reg_stride);
308 d->mask_buf[i]); 309 ret = regmap_write(map, reg, d->mask_buf[i]);
309 if (ret != 0) { 310 if (ret != 0) {
310 dev_err(map->dev, "Failed to set masks in 0x%x: %d\n", 311 dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
311 chip->mask_base + (i * map->reg_stride), ret); 312 reg, ret);
312 goto err_alloc; 313 goto err_alloc;
313 } 314 }
314 } 315 }