Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325240
b: refs/heads/master
c: ab0deff
h: refs/heads/master
v: v3
  • Loading branch information
Jens Taprogge authored and Greg Kroah-Hartman committed Sep 12, 2012
1 parent 281df4b commit 02df008
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 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: 88ff8480d39da6b2961444f0c28b5b0d194d2de6
refs/heads/master: ab0deffcb957d1e0bf8c7e1d6373b4e1587b8192
58 changes: 31 additions & 27 deletions trunk/drivers/staging/ipack/bridges/tpci200.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ static void tpci200_unregister(struct tpci200_board *tpci200)

static irqreturn_t tpci200_slot_irq(struct slot_irq *slot_irq)
{
irqreturn_t ret = slot_irq->handler(slot_irq->arg);
irqreturn_t ret;

/* Dummy reads */
if (!slot_irq)
return -ENODEV;
ret = slot_irq->handler(slot_irq->arg);

/* Clear the IPack device interrupt */
readw(slot_irq->holder->io_space.address + 0xC0);
readw(slot_irq->holder->io_space.address + 0xC2);

Expand All @@ -114,37 +118,37 @@ static irqreturn_t tpci200_slot_irq(struct slot_irq *slot_irq)
static irqreturn_t tpci200_interrupt(int irq, void *dev_id)
{
struct tpci200_board *tpci200 = (struct tpci200_board *) dev_id;
int i;
unsigned short status_reg;
struct slot_irq *slot_irq;
irqreturn_t ret;
u16 status_reg;
int i;

/* Read status register */
status_reg = readw(&tpci200->info->interface_regs->status);

if (status_reg & TPCI200_SLOT_INT_MASK) {
/* callback to the IRQ handler for the corresponding slot */
rcu_read_lock();
for (i = 0; i < TPCI200_NB_SLOT; i++) {
if (!(status_reg & ((TPCI200_A_INT0 | TPCI200_A_INT1) << (2*i))))
continue;
slot_irq = rcu_dereference(tpci200->slots[i].irq);
if (slot_irq) {
tpci200_slot_irq(slot_irq);
} else {
dev_info(&tpci200->info->pdev->dev,
"No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n",
tpci200->number, i);
tpci200_clear_mask(tpci200,
&tpci200->info->interface_regs->control[i],
TPCI200_INT0_EN | TPCI200_INT1_EN);
}
}
rcu_read_unlock();
status_reg = ioread16(&tpci200->info->interface_regs->status);

return IRQ_HANDLED;
} else {
/* Did we cause the interrupt? */
if (!(status_reg & TPCI200_SLOT_INT_MASK))
return IRQ_NONE;

/* callback to the IRQ handler for the corresponding slot */
rcu_read_lock();
for (i = 0; i < TPCI200_NB_SLOT; i++) {
if (!(status_reg & ((TPCI200_A_INT0 | TPCI200_A_INT1) << (2 * i))))
continue;
slot_irq = rcu_dereference(tpci200->slots[i].irq);
ret = tpci200_slot_irq(slot_irq);
if (ret == -ENODEV) {
dev_info(&tpci200->info->pdev->dev,
"No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n",
tpci200->number, i);
tpci200_clear_mask(tpci200,
&tpci200->info->interface_regs->control[i],
TPCI200_INT0_EN | TPCI200_INT1_EN);
}
}
rcu_read_unlock();

return IRQ_HANDLED;
}

static int tpci200_register(struct tpci200_board *tpci200)
Expand Down

0 comments on commit 02df008

Please sign in to comment.