[SCSI] qla2xxx: Correct locking during NVRAM manipulation.
[pandora-kernel.git] / drivers / scsi / a4000t.c
index e1c6eda..d4bda20 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/platform_device.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <asm/amigahw.h>
 #include <asm/amigaints.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_transport_spi.h>
@@ -36,7 +37,7 @@ static struct platform_device *a4000t_scsi_device;
 
 static int __devinit a4000t_probe(struct device *dev)
 {
-       struct Scsi_Host * host = NULL;
+       struct Scsi_Host *host;
        struct NCR_700_Host_Parameters *hostdata;
 
        if (!(MACH_IS_AMIGA && AMIGAHW_PRESENT(A4000_SCSI)))
@@ -46,12 +47,11 @@ static int __devinit a4000t_probe(struct device *dev)
                                "A4000T builtin SCSI"))
                goto out;
 
-       hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
-       if (hostdata == NULL) {
+       hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
+       if (!hostdata) {
                printk(KERN_ERR "a4000t-scsi: Failed to allocate host data\n");
                goto out_release;
        }
-       memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));
 
        /* Fill in the required pieces of hostdata */
        hostdata->base = (void __iomem *)ZTWO_VADDR(A4000T_SCSI_ADDR);
@@ -78,6 +78,7 @@ static int __devinit a4000t_probe(struct device *dev)
                goto out_put_host;
        }
 
+       dev_set_drvdata(dev, host);
        scsi_scan_host(host);
 
        return 0;
@@ -94,7 +95,7 @@ static int __devinit a4000t_probe(struct device *dev)
 
 static __devexit int a4000t_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 = shost_priv(host);
 
        scsi_remove_host(host);