Merge branch 'for-2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[safe/jmp/linux-2.6] / drivers / scsi / sim710.c
index 9171788..8ac6ce7 100644 (file)
@@ -26,8 +26,8 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 
 #include <linux/blkdev.h>
 #include <linux/device.h>
@@ -75,7 +75,7 @@ param_setup(char *str)
                else if(!strncmp(pos, "id:", 3)) {
                        if(slot == -1) {
                                printk(KERN_WARNING "sim710: Must specify slot for id parameter\n");
-                       } else if(slot > MAX_SLOTS) {
+                       } else if(slot >= MAX_SLOTS) {
                                printk(KERN_WARNING "sim710: Illegal slot %d for id %d\n", slot, val);
                        } else {
                                id_array[slot] = val;
@@ -101,9 +101,9 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
 {
        struct Scsi_Host * host = NULL;
        struct NCR_700_Host_Parameters *hostdata =
-               kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
+               kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
 
-       printk(KERN_NOTICE "sim710: %s\n", dev->bus_id);
+       printk(KERN_NOTICE "sim710: %s\n", dev_name(dev));
        printk(KERN_NOTICE "sim710: irq = %d, clock = %d, base = 0x%lx, scsi_id = %d\n",
               irq, clock, base_addr, scsi_id);
 
@@ -111,7 +111,6 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
                printk(KERN_ERR "sim710: Failed to allocate host data\n");
                goto out;
        }
-       memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));
 
        if(request_region(base_addr, 64, "sim710") == NULL) {
                printk(KERN_ERR "sim710: Failed to reserve IO region 0x%lx\n",
@@ -124,6 +123,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
        hostdata->differential = differential;
        hostdata->clock = clock;
        hostdata->chip710 = 1;
+       hostdata->burst_length = 8;
 
        /* and register the chip */
        if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev))
@@ -134,11 +134,12 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
        host->this_id = scsi_id;
        host->base = base_addr;
        host->irq = irq;
-       if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "sim710", host)) {
+       if (request_irq(irq, NCR_700_intr, IRQF_SHARED, "sim710", host)) {
                printk(KERN_ERR "sim710: request_irq failed\n");
                goto out_put_host;
        }
 
+       dev_set_drvdata(dev, host);
        scsi_scan_host(host);
 
        return 0;
@@ -146,7 +147,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
  out_put_host:
        scsi_host_put(host);
  out_release:
-       release_region(host->base, 64);
+       release_region(base_addr, 64);
  out_free:
        kfree(hostdata);
  out:
@@ -156,7 +157,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
 static __devexit int
 sim710_device_remove(struct device *dev)
 {
-       struct Scsi_Host *host = dev_to_shost(dev);
+       struct Scsi_Host *host = dev_get_drvdata(dev);
        struct NCR_700_Host_Parameters *hostdata =
                (struct NCR_700_Host_Parameters *)host->hostdata[0];
 
@@ -283,6 +284,7 @@ static struct eisa_device_id sim710_eisa_ids[] = {
        { "HWP0C80" },
        { "" }
 };
+MODULE_DEVICE_TABLE(eisa, sim710_eisa_ids);
 
 static __init int
 sim710_eisa_probe(struct device *dev)
@@ -304,7 +306,7 @@ sim710_eisa_probe(struct device *dev)
                scsi_id = ffs(val) - 1;
 
                if(scsi_id > 7 || (val & ~(1<<scsi_id)) != 0) {
-                       printk(KERN_ERR "sim710.c, EISA card %s has incorrect scsi_id, setting to 7\n", dev->bus_id);
+                       printk(KERN_ERR "sim710.c, EISA card %s has incorrect scsi_id, setting to 7\n", dev_name(dev));
                        scsi_id = 7;
                }
        } else {