ide: allow host drivers to specify IRQ flags
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:27 +0000 (12:46 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:27 +0000 (12:46 +0100)
* Add ->irq_flags field to struct ide_port_info and struct ide_host.

* Update host drivers and IDE PCI code to use ->irq_flags field.

* Convert init_irq() and ide_intr() to use host->irq_flags.

This fixes handling of shared IRQs for non-PCI hosts
and removes ugly ifdeffery from core IDE code.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
13 files changed:
drivers/ide/buddha.c
drivers/ide/delkin_cb.c
drivers/ide/falconide.c
drivers/ide/gayle.c
drivers/ide/ide-cs.c
drivers/ide/ide-io.c
drivers/ide/ide-probe.c
drivers/ide/macide.c
drivers/ide/q40ide.c
drivers/ide/scc_pata.c
drivers/ide/setup-pci.c
drivers/ide/sgiioc4.c
include/linux/ide.h

index 606c3320fa58f62ab54fe4329553ded9a708de5f..d028f8864bc14f7324f24c25abc02c4258f98bb7 100644 (file)
@@ -145,6 +145,7 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base,
 
 static const struct ide_port_info buddha_port_info = {
        .host_flags             = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
+       .irq_flags              = IRQF_SHARED,
 };
 
     /*
index bacb1194c9c9e5eb9ed4290fd625a457b60c903f..f153b95619bb372e958f7c51c8ca1dcd1ccf043a 100644 (file)
@@ -66,6 +66,7 @@ static const struct ide_port_info delkin_cb_port_info = {
        .port_ops               = &delkin_cb_port_ops,
        .host_flags             = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS |
                                  IDE_HFLAG_NO_DMA,
+       .irq_flags              = IRQF_SHARED,
        .init_chipset           = delkin_cb_init_chipset,
 };
 
index bb0c86e976e4345ddc2dc6429629e89962513735..6085feb1fae8730b4a8ecabf52db1409a6f496e2 100644 (file)
@@ -105,6 +105,7 @@ static const struct ide_port_info falconide_port_info = {
        .tp_ops                 = &falconide_tp_ops,
        .host_flags             = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
                                  IDE_HFLAG_NO_DMA,
+       .irq_flags              = IRQF_SHARED,
 };
 
 static void __init falconide_setup_ports(hw_regs_t *hw)
index dce01765adbc3a17aa67eab39c1bce90627aba43..dc778251cb050b6b188e3a19c9edffa7d512d06f 100644 (file)
@@ -120,6 +120,7 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base,
 static const struct ide_port_info gayle_port_info = {
        .host_flags             = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
                                  IDE_HFLAG_NO_DMA,
+       .irq_flags              = IRQF_SHARED,
 };
 
     /*
index f50210fe558f1cd7ffff023385508be18029d4a1..9e47f3529d5555685bb829b1e92b7b621c15e624 100644 (file)
@@ -154,6 +154,7 @@ static const struct ide_port_ops idecs_port_ops = {
 static const struct ide_port_info idecs_port_info = {
        .port_ops               = &idecs_port_ops,
        .host_flags             = IDE_HFLAG_NO_DMA,
+       .irq_flags              = IRQF_SHARED,
 };
 
 static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
index 030b0ea1a1e1c98f42386149432d1fd820054f86..7007c48e27aecfe3cfdbaa74d2e27340d697c354 100644 (file)
@@ -841,6 +841,7 @@ static void unexpected_intr(int irq, ide_hwif_t *hwif)
 irqreturn_t ide_intr (int irq, void *dev_id)
 {
        ide_hwif_t *hwif = (ide_hwif_t *)dev_id;
+       struct ide_host *host = hwif->host;
        ide_drive_t *uninitialized_var(drive);
        ide_handler_t *handler;
        unsigned long flags;
@@ -848,8 +849,8 @@ irqreturn_t ide_intr (int irq, void *dev_id)
        irqreturn_t irq_ret = IRQ_NONE;
        int plug_device = 0;
 
-       if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) {
-               if (hwif != hwif->host->cur_port)
+       if (host->host_flags & IDE_HFLAG_SERIALIZE) {
+               if (hwif != host->cur_port)
                        goto out_early;
        }
 
@@ -872,27 +873,19 @@ irqreturn_t ide_intr (int irq, void *dev_id)
                 *
                 * For PCI, we cannot tell the difference,
                 * so in that case we just ignore it and hope it goes away.
-                *
-                * FIXME: unexpected_intr should be hwif-> then we can
-                * remove all the ifdef PCI crap
                 */
-#ifdef CONFIG_BLK_DEV_IDEPCI
-               if (hwif->chipset != ide_pci)
-#endif /* CONFIG_BLK_DEV_IDEPCI */
-               {
+               if ((host->irq_flags & IRQF_SHARED) == 0) {
                        /*
                         * Probably not a shared PCI interrupt,
                         * so we can safely try to do something about it:
                         */
                        unexpected_intr(irq, hwif);
-#ifdef CONFIG_BLK_DEV_IDEPCI
                } else {
                        /*
                         * Whack the status register, just in case
                         * we have a leftover pending IRQ.
                         */
                        (void)hwif->tp_ops->read_status(hwif);
-#endif /* CONFIG_BLK_DEV_IDEPCI */
                }
                goto out;
        }
index 4b00945cf7d1ad55ef41ad8a68495c718cec913f..f3a56595eb75bae8521c3a04d4cc72e2fde5e100 100644 (file)
@@ -837,20 +837,13 @@ static int ide_port_setup_devices(ide_hwif_t *hwif)
 static int init_irq (ide_hwif_t *hwif)
 {
        struct ide_io_ports *io_ports = &hwif->io_ports;
-       irq_handler_t irq_handler;
-       int sa = 0;
+       struct ide_host *host = hwif->host;
+       irq_handler_t irq_handler = host->irq_handler;
+       int sa = host->irq_flags;
 
-       irq_handler = hwif->host->irq_handler;
        if (irq_handler == NULL)
                irq_handler = ide_intr;
 
-#if defined(__mc68000__)
-       sa = IRQF_SHARED;
-#endif /* __mc68000__ */
-
-       if (hwif->chipset == ide_pci)
-               sa = IRQF_SHARED;
-
        if (io_ports->ctl_addr)
                hwif->tp_ops->set_irq(hwif, 1);
 
index 56112ee9f5a86356e46053d8052e8fbdf5add4fa..4b1718e832839186c12673f8b589022ba115c55a 100644 (file)
@@ -82,6 +82,7 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base,
 
 static const struct ide_port_info macide_port_info = {
        .host_flags             = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
+       .irq_flags              = IRQF_SHARED,
 };
 
 static const char *mac_ide_name[] =
index ebd576df2d84ff58019ae795b75a34b7836359a4..32f669d656a6d34fb50d3232071575c778409347 100644 (file)
@@ -112,6 +112,7 @@ static const struct ide_tp_ops q40ide_tp_ops = {
 static const struct ide_port_info q40ide_port_info = {
        .tp_ops                 = &q40ide_tp_ops,
        .host_flags             = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
+       .irq_flags              = IRQF_SHARED,
 };
 
 /* 
index 540bc842f3ad3ebd03c38be3ed83cb8f565e5803..ae965da5dde04817a601cb49f634cb2e7c9ab3ba 100644 (file)
@@ -891,6 +891,7 @@ static const struct ide_port_info scc_chipset __devinitdata = {
        .port_ops       = &scc_port_ops,
        .dma_ops        = &scc_dma_ops,
        .host_flags     = IDE_HFLAG_SINGLE,
+       .irq_flags      = IRQF_SHARED,
        .pio_mask       = ATA_PIO4,
 };
 
index 24bc884826fcb1f60da0182c6a1180f80ad47c30..a19dbccd76179cd4a234b168e2d18197bf86b18e 100644 (file)
@@ -558,6 +558,8 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d,
 
        host->host_priv = priv;
 
+       host->irq_flags = IRQF_SHARED;
+
        pci_set_drvdata(dev, host);
 
        ret = do_ide_setup_pci_device(dev, d, 1);
@@ -606,6 +608,8 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
 
        host->host_priv = priv;
 
+       host->irq_flags = IRQF_SHARED;
+
        pci_set_drvdata(pdev[0], host);
        pci_set_drvdata(pdev[1], host);
 
index fdb9d70376949514c567ecd6eadba4a8591a095b..1cffe70f385d3be4a4f7ab53554a2ea60cc3a356 100644 (file)
@@ -557,6 +557,7 @@ static const struct ide_port_info sgiioc4_port_info __devinitconst = {
        .port_ops               = &sgiioc4_port_ops,
        .dma_ops                = &sgiioc4_dma_ops,
        .host_flags             = IDE_HFLAG_MMIO,
+       .irq_flags              = IRQF_SHARED,
        .mwdma_mask             = ATA_MWDMA2_ONLY,
 };
 
index ab8ee4f32f525520d5605f95e6f3709f8d02318f..901d323c7bbe4056af3361ffc1fc3563174b4b95 100644 (file)
@@ -839,6 +839,9 @@ struct ide_host {
        irq_handler_t   irq_handler;
 
        unsigned long   host_flags;
+
+       int             irq_flags;
+
        void            *host_priv;
        ide_hwif_t      *cur_port;      /* for hosts requiring serialization */
 
@@ -1371,6 +1374,9 @@ struct ide_port_info {
        u16                     max_sectors;    /* if < than the default one */
 
        u32                     host_flags;
+
+       int                     irq_flags;
+
        u8                      pio_mask;
        u8                      swdma_mask;
        u8                      mwdma_mask;