ChangeSet 1.2181.22.12, 2005/03/20 21:05:57-06:00, [EMAIL PROTECTED](none)

        53c700: Alter interrupt assignment
        
        This change makes interrupt assignment the job of the
        glue driver.  The upshot being that the glue driver can
        now set the name of the interrupt and, in the case of
        the NCR_D700 driver, make the interrupt routing more efficient.
        
        Signed-off-by: James Bottomley <[EMAIL PROTECTED]>



 53c700.c   |   21 +++------------------
 53c700.h   |    3 +--
 NCR_D700.c |   41 ++++++++++++++++++++++++++++++++---------
 lasi700.c  |   11 +++++++++--
 sim710.c   |   12 ++++++++++--
 5 files changed, 55 insertions(+), 33 deletions(-)


diff -Nru a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
--- a/drivers/scsi/53c700.c     2005-03-30 16:08:56 -08:00
+++ b/drivers/scsi/53c700.c     2005-03-30 16:08:56 -08:00
@@ -296,8 +296,7 @@
 
 struct Scsi_Host *
 NCR_700_detect(struct scsi_host_template *tpnt,
-              struct NCR_700_Host_Parameters *hostdata, struct device *dev,
-              unsigned long irq, u8 scsi_id)
+              struct NCR_700_Host_Parameters *hostdata, struct device *dev)
 {
        dma_addr_t pScript, pSlots;
        __u8 *memory;
@@ -393,8 +392,6 @@
        host->unique_id = hostdata->base;
        host->base = hostdata->base;
        hostdata->eh_complete = NULL;
-       host->irq = irq;
-       host->this_id = scsi_id;
        host->hostdata[0] = (unsigned long)hostdata;
        /* kick the chip */
        NCR_700_writeb(0xff, host, CTEST9_REG);
@@ -415,28 +412,16 @@
        /* reset the chip */
        NCR_700_chip_reset(host);
 
-       if (request_irq(irq, NCR_700_intr, SA_SHIRQ, dev->bus_id, host)) {
-               dev_printk(KERN_ERR, dev, "53c700: irq %lu request failed\n ",
-                          irq);
-               goto out_put_host;
-       }
-
        if (scsi_add_host(host, dev)) {
                dev_printk(KERN_ERR, dev, "53c700: scsi_add_host failed\n");
-               goto out_release_irq;
+               scsi_host_put(host);
+               return NULL;
        }
 
        spi_signalling(host) = hostdata->differential ? SPI_SIGNAL_HVD :
                SPI_SIGNAL_SE;
 
        return host;
-
- out_release_irq:
-       free_irq(irq, host);
- out_put_host:
-       scsi_host_put(host);
-
-       return NULL;
 }
 
 int
diff -Nru a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
--- a/drivers/scsi/53c700.h     2005-03-30 16:08:56 -08:00
+++ b/drivers/scsi/53c700.h     2005-03-30 16:08:56 -08:00
@@ -60,8 +60,7 @@
 
 /* These are the externally used routines */
 struct Scsi_Host *NCR_700_detect(struct scsi_host_template *,
-               struct NCR_700_Host_Parameters *, struct device *,
-               unsigned long, u8);
+               struct NCR_700_Host_Parameters *, struct device *);
 int NCR_700_release(struct Scsi_Host *host);
 irqreturn_t NCR_700_intr(int, void *, struct pt_regs *);
 
diff -Nru a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c
--- a/drivers/scsi/NCR_D700.c   2005-03-30 16:08:56 -08:00
+++ b/drivers/scsi/NCR_D700.c   2005-03-30 16:08:56 -08:00
@@ -97,6 +97,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mca.h>
+#include <linux/interrupt.h>
 #include <asm/io.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_device.h>
@@ -168,11 +169,13 @@
 struct NCR_D700_private {
        struct device           *dev;
        struct Scsi_Host        *hosts[2];
+       char                    name[30];
+       char                    pad;
 };
 
 static int 
-NCR_D700_probe_one(struct NCR_D700_private *p, int siop,
-               int irq, int slot, u32 region, int differential)
+NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq,
+                  int slot, u32 region, int differential)
 {
        struct NCR_700_Host_Parameters *hostdata;
        struct Scsi_Host *host;
@@ -201,18 +204,18 @@
        NCR_700_set_io_mapped(hostdata);
 
        /* and register the siop */
-       host = NCR_700_detect(&NCR_D700_driver_template, hostdata,
-                             p->dev, irq,
-                             /* FIXME: read this from SUS */
-                             id_array[slot * 2 + siop]);
+       host = NCR_700_detect(&NCR_D700_driver_template, hostdata, p->dev);
        if (!host) {
                ret = -ENOMEM;
                goto detect_failed;
        }
 
+       p->hosts[siop] = host;
+       /* FIXME: read this from SUS */
+       host->this_id = id_array[slot * 2 + siop];
+       host->irq = irq;
        scsi_scan_host(host);
 
-       p->hosts[siop] = host;
        return 0;
 
  detect_failed:
@@ -223,6 +226,20 @@
        return ret;
 }
 
+static int
+NCR_D700_intr(int irq, void *data, struct pt_regs *regs)
+{
+       struct NCR_D700_private *p = (struct NCR_D700_private *)data;
+       int i, found = 0;
+
+       for (i = 0; i < 2; i++)
+               if (p->hosts[i] &&
+                   NCR_700_intr(irq, p->hosts[i], regs) == IRQ_HANDLED)
+                       found++;
+
+       return found ? IRQ_HANDLED : IRQ_NONE;
+}
+
 /* Detect a D700 card.  Note, because of the setup --- the chips are
  * essentially connectecd to the MCA bus independently, it is easier
  * to set them up as two separate host adapters, rather than one
@@ -301,13 +318,19 @@
        p = kmalloc(sizeof(*p), GFP_KERNEL);
        if (!p)
                return -ENOMEM;
+       memset(p, '\0', sizeof(*p));
        p->dev = dev;
-
+       snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id);
+       if (request_irq(irq, NCR_D700_intr, SA_SHIRQ, p->name, p)) {
+               printk(KERN_ERR "D700: request_irq failed\n");
+               kfree(p);
+               return -EBUSY;
+       }
        /* plumb in both 700 chips */
        for (i = 0; i < 2; i++) {
                int err;
 
-               if ((err = NCR_D700_probe_one(p, i, irq, slot,
+               if ((err = NCR_D700_probe_one(p, i, slot, irq,
                                              offset_addr + (0x80 * i),
                                              differential)) != 0)
                        printk("D700: SIOP%d: probe failed, error = %d\n",
diff -Nru a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c
--- a/drivers/scsi/lasi700.c    2005-03-30 16:08:56 -08:00
+++ b/drivers/scsi/lasi700.c    2005-03-30 16:08:56 -08:00
@@ -127,16 +127,23 @@
 
        NCR_700_set_mem_mapped(hostdata);
 
-       host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev,
-                             dev->irq, 7);
+       host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev);
        if (!host)
                goto out_kfree;
+       host->this_id = 7;
+       host->irq = dev->irq;
+       if(request_irq(dev->irq, NCR_700_intr, SA_SHIRQ, "lasi700", host)) {
+               printk(KERN_ERR "lasi700: request_irq failed!\n");
+               goto out_put_host;
+       }
 
        dev_set_drvdata(&dev->dev, host);
        scsi_scan_host(host);
 
        return 0;
 
+ out_put_host:
+       scsi_host_put(host);
  out_kfree:
        iounmap(hostdata->base);
        kfree(hostdata);
diff -Nru a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c
--- a/drivers/scsi/sim710.c     2005-03-30 16:08:56 -08:00
+++ b/drivers/scsi/sim710.c     2005-03-30 16:08:56 -08:00
@@ -127,16 +127,24 @@
        NCR_700_set_io_mapped(hostdata);
 
        /* and register the chip */
-       if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev, irq,
-                                 scsi_id)) == NULL) {
+       if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev))
+          == NULL) {
                printk(KERN_ERR "sim710: No host detected; card configuration 
problem?\n");
                goto out_release;
        }
+       host->this_id = scsi_id;
+       host->irq = irq;
+       if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "sim710", host)) {
+               printk(KERN_ERR "sim710: request_irq failed\n");
+               goto out_put_host;
+       }
 
        scsi_scan_host(host);
 
        return 0;
 
+ out_put_host:
+       scsi_host_put(host);
  out_release:
        release_region(host->base, 64);
  out_free:
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to