Staging: ipack/bridges/tpci200: More cleanups.

Rename __tpci_request_irq() to tpci_enable_irq() and __tpci_free_irq()
to tpci_disable_irq().  Change their second argument, move them above
tpci200_interrupt(), and use tpci_disable_irq() in the latter

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jens Taprogge 2012-09-12 14:55:36 +02:00 committed by Greg Kroah-Hartman
parent ab0deffcb9
commit 877adc406c

View File

@ -100,6 +100,22 @@ static void tpci200_unregister(struct tpci200_board *tpci200)
} }
} }
static void tpci200_enable_irq(struct tpci200_board *tpci200,
int islot)
{
tpci200_set_mask(tpci200,
&tpci200->info->interface_regs->control[islot],
TPCI200_INT0_EN | TPCI200_INT1_EN);
}
static void tpci200_disable_irq(struct tpci200_board *tpci200,
int islot)
{
tpci200_clear_mask(tpci200,
&tpci200->info->interface_regs->control[islot],
TPCI200_INT0_EN | TPCI200_INT1_EN);
}
static irqreturn_t tpci200_slot_irq(struct slot_irq *slot_irq) static irqreturn_t tpci200_slot_irq(struct slot_irq *slot_irq)
{ {
irqreturn_t ret; irqreturn_t ret;
@ -141,9 +157,7 @@ static irqreturn_t tpci200_interrupt(int irq, void *dev_id)
dev_info(&tpci200->info->pdev->dev, dev_info(&tpci200->info->pdev->dev,
"No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n", "No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n",
tpci200->number, i); tpci200->number, i);
tpci200_clear_mask(tpci200, tpci200_disable_irq(tpci200, i);
&tpci200->info->interface_regs->control[i],
TPCI200_INT0_EN | TPCI200_INT1_EN);
} }
} }
rcu_read_unlock(); rcu_read_unlock();
@ -269,23 +283,6 @@ static int tpci200_register(struct tpci200_board *tpci200)
return res; return res;
} }
static int __tpci200_request_irq(struct tpci200_board *tpci200,
struct ipack_device *dev)
{
tpci200_set_mask(tpci200,
&tpci200->info->interface_regs->control[dev->slot],
TPCI200_INT0_EN | TPCI200_INT1_EN);
return 0;
}
static void __tpci200_free_irq(struct tpci200_board *tpci200,
struct ipack_device *dev)
{
tpci200_clear_mask(tpci200,
&tpci200->info->interface_regs->control[dev->slot],
TPCI200_INT0_EN | TPCI200_INT1_EN);
}
static int tpci200_free_irq(struct ipack_device *dev) static int tpci200_free_irq(struct ipack_device *dev)
{ {
struct slot_irq *slot_irq; struct slot_irq *slot_irq;
@ -303,8 +300,9 @@ static int tpci200_free_irq(struct ipack_device *dev)
return -EINVAL; return -EINVAL;
} }
__tpci200_free_irq(tpci200, dev); tpci200_disable_irq(tpci200, dev->slot);
slot_irq = tpci200->slots[dev->slot].irq; slot_irq = tpci200->slots[dev->slot].irq;
/* uninstall handler */
RCU_INIT_POINTER(tpci200->slots[dev->slot].irq, NULL); RCU_INIT_POINTER(tpci200->slots[dev->slot].irq, NULL);
synchronize_rcu(); synchronize_rcu();
kfree(slot_irq); kfree(slot_irq);
@ -453,7 +451,7 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
static int tpci200_request_irq(struct ipack_device *dev, int vector, static int tpci200_request_irq(struct ipack_device *dev, int vector,
int (*handler)(void *), void *arg) int (*handler)(void *), void *arg)
{ {
int res; int res = 0;
struct slot_irq *slot_irq; struct slot_irq *slot_irq;
struct tpci200_board *tpci200; struct tpci200_board *tpci200;
@ -493,7 +491,7 @@ static int tpci200_request_irq(struct ipack_device *dev, int vector,
slot_irq->holder = dev; slot_irq->holder = dev;
rcu_assign_pointer(tpci200->slots[dev->slot].irq, slot_irq); rcu_assign_pointer(tpci200->slots[dev->slot].irq, slot_irq);
res = __tpci200_request_irq(tpci200, dev); tpci200_enable_irq(tpci200, dev->slot);
out_unlock: out_unlock:
mutex_unlock(&tpci200->mutex); mutex_unlock(&tpci200->mutex);