Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296894
b: refs/heads/master
c: f01b1f9
h: refs/heads/master
v: v3
  • Loading branch information
Benoit Cousson authored and Samuel Ortiz committed Mar 22, 2012
1 parent fb99ddb commit e417684
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 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: 78518ffa08fceee42d61359303c58bdd0a82033f
refs/heads/master: f01b1f90bf46ddaf2a68215a9489364c974e5689
3 changes: 2 additions & 1 deletion trunk/drivers/gpio/gpio-twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev)
"can't dispatch IRQs from modules\n");
goto no_irqs;
}
ret = twl4030_sih_setup(TWL4030_MODULE_GPIO);
ret = twl4030_sih_setup(&pdev->dev, TWL4030_MODULE_GPIO,
pdata->irq_base);
if (ret < 0)
return ret;
WARN_ON(ret != pdata->irq_base);
Expand Down
23 changes: 6 additions & 17 deletions trunk/drivers/mfd/twl4030-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,28 +629,21 @@ static irqreturn_t handle_twl4030_sih(int irq, void *data)
return IRQ_HANDLED;
}

static unsigned twl4030_irq_next;

/* returns the first IRQ used by this SIH bank, or negative errno */
int twl4030_sih_setup(int module)
int twl4030_sih_setup(struct device *dev, int module, int irq_base)
{
int sih_mod;
const struct sih *sih = NULL;
struct sih_agent *agent;
int i, irq;
int status = -EINVAL;
unsigned irq_base = twl4030_irq_next;

/* only support modules with standard clear-on-read for now */
for (sih_mod = 0, sih = sih_modules;
sih_mod < nr_sih_modules;
sih_mod++, sih++) {
if (sih->module == module && sih->set_cor) {
if (!WARN((irq_base + sih->bits) > NR_IRQS,
"irq %d for %s too big\n",
irq_base + sih->bits,
sih->name))
status = 0;
status = 0;
break;
}
}
Expand All @@ -661,8 +654,6 @@ int twl4030_sih_setup(int module)
if (!agent)
return -ENOMEM;

status = 0;

agent->irq_base = irq_base;
agent->sih = sih;
agent->imr = ~0;
Expand All @@ -678,8 +669,6 @@ int twl4030_sih_setup(int module)
activate_irq(irq);
}

twl4030_irq_next += i;

/* replace generic PIH handler (handle_simple_irq) */
irq = sih_mod + twl4030_irq_base;
irq_set_handler_data(irq, agent);
Expand All @@ -688,7 +677,7 @@ int twl4030_sih_setup(int module)
agent->irq_name ?: sih->name, NULL);

pr_info("twl4030: %s (irq %d) chaining IRQs %d..%d\n", sih->name,
irq, irq_base, twl4030_irq_next - 1);
irq, irq_base, irq_base + i - 1);

return status < 0 ? status : irq_base;
}
Expand Down Expand Up @@ -752,12 +741,12 @@ int twl4030_init_irq(struct device *dev, int irq_num)
irq_set_nested_thread(i, 1);
activate_irq(i);
}
twl4030_irq_next = i;

pr_info("twl4030: %s (irq %d) chaining IRQs %d..%d\n", "PIH",
irq_num, irq_base, twl4030_irq_next - 1);
irq_num, irq_base, irq_end);

/* ... and the PWR_INT module ... */
status = twl4030_sih_setup(TWL4030_MODULE_INT);
status = twl4030_sih_setup(dev, TWL4030_MODULE_INT, irq_end);
if (status < 0) {
pr_err("twl4030: sih_setup PWR INT --> %d\n", status);
goto fail;
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/i2c/twl.h
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ struct twl4030_platform_data {

/*----------------------------------------------------------------------*/

int twl4030_sih_setup(int module);
int twl4030_sih_setup(struct device *dev, int module, int irq_base);

/* Offsets to Power Registers */
#define TWL4030_VDAC_DEV_GRP 0x3B
Expand Down

0 comments on commit e417684

Please sign in to comment.