/* Install interrupt handler, enable irq on card. If irq is -1, choose next free irq, else irq is given explicitly.  */
int act2000_isa_config_irq(act2000_card *card, short irq)
/* Install interrupt handler, enable irq on card. If irq is -1, choose next free irq, else irq is given explicitly.  */
int act2000_isa_config_irq(act2000_card *card, short irq)
{
	int old_irq;
        if (card->flags & ACT2000_FLAGS_IVALID) {
                free_irq(card->irq, card);
        }
        card->flags &= ~ACT2000_FLAGS_IVALID;
        outb(ISA_COR_IRQOFF, ISA_PORT_COR);
        if (!irq)
                return 0;
	old_irq = card->irq;
	card->irq = irq;
	if (request_irq(irq, &act2000_isa_interrupt, 0, card->regname, card)) {
		card->irq = old_irq;
		card->flags |= ACT2000_FLAGS_IVALID;
                printk(KERN_WARNING
                       "act2000: Could not request irq %d\n",irq);
                return -EBUSY;
        } else {
		act2000_isa_select_irq(card);
                outb(0, ISA_PORT_SIS);
                outb(0, ISA_PORT_SOS);
        }
        return 0;
}