From c7b87f3d5037a35b5c7bb916ffc826be3fcb208d Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 10 May 2007 16:46:13 +0100 Subject: [ARM] ecard: add helper function for setting ecard irq ops Rather than having every driver fiddle about setting its private IRQ operations and data, provide a helper function to contain this functionality in one place. Arrange to remove the driver-private IRQ operations and data when the device is removed from the driver, and remove the driver private code to do this. This fixes potential problems caused by drivers forgetting to remove these hooks. Signed-off-by: Russell King --- drivers/ata/pata_icside.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'drivers/ata') diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c index dbc8ee2adcf..d7621a39ed0 100644 --- a/drivers/ata/pata_icside.c +++ b/drivers/ata/pata_icside.c @@ -434,8 +434,8 @@ pata_icside_register_v5(struct ata_probe_ent *ae, struct expansion_card *ec) ec->irqaddr = base + ICS_ARCIN_V5_INTRSTAT; ec->irqmask = 1; - ec->irq_data = state; - ec->ops = &pata_icside_ops_arcin_v5; + + ecard_setirq(ec, &pata_icside_ops_arcin_v5, state); /* * Be on the safe side - disable interrupts @@ -480,8 +480,7 @@ pata_icside_register_v6(struct ata_probe_ent *ae, struct expansion_card *ec) writeb(sel, ioc_base); - ec->irq_data = state; - ec->ops = &pata_icside_ops_arcin_v6; + ecard_setirq(ec, &pata_icside_ops_arcin_v6, state); state->irq_port = easi_base; state->ioc_base = ioc_base; @@ -609,8 +608,7 @@ static void pata_icside_shutdown(struct expansion_card *ec) * this register via that region. */ local_irq_save(flags); - if (ec->ops) - ec->ops->irqdisable(ec, ec->irq); + ec->ops->irqdisable(ec, ec->irq); local_irq_restore(flags); /* @@ -638,9 +636,6 @@ static void __devexit pata_icside_remove(struct expansion_card *ec) * don't NULL out the drvdata - devres/libata wants it * to free the ata_host structure. */ - ec->ops = NULL; - ec->irq_data = NULL; - if (state->dma != NO_DMA) free_dma(state->dma); if (state->ioc_base) -- cgit v1.2.3