[SCSI] bfa: fix test in bfad_os_fc_host_init()
[safe/jmp/linux-2.6] / drivers / scsi / bvme6000_scsi.c
index cac3540..5799cb5 100644 (file)
@@ -34,21 +34,20 @@ static struct scsi_host_template bvme6000_scsi_driver_template = {
 static struct platform_device *bvme6000_scsi_device;
 
 static __devinit int
-bvme6000_probe(struct device *dev)
+bvme6000_probe(struct platform_device *dev)
 {
-       struct Scsi_Host * host = NULL;
+       struct Scsi_Host *host;
        struct NCR_700_Host_Parameters *hostdata;
 
        if (!MACH_IS_BVME6000)
                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 "bvme6000-scsi: "
                                "Failed to allocate host data\n");
                goto out;
        }
-       memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));
 
        /* Fill in the required pieces of hostdata */
        hostdata->base = (void __iomem *)BVME_NCR53C710_BASE;
@@ -59,7 +58,8 @@ bvme6000_probe(struct device *dev)
        hostdata->ctest7_extra = CTEST7_TT1;
 
        /* and register the chip */
-       host = NCR_700_detect(&bvme6000_scsi_driver_template, hostdata, dev);
+       host = NCR_700_detect(&bvme6000_scsi_driver_template, hostdata,
+                             &dev->dev);
        if (!host) {
                printk(KERN_ERR "bvme6000-scsi: No host detected; "
                                "board configuration problem?\n");
@@ -74,7 +74,7 @@ bvme6000_probe(struct device *dev)
                goto out_put_host;
        }
 
-       dev_set_drvdata(dev, host);
+       platform_set_drvdata(dev, host);
        scsi_scan_host(host);
 
        return 0;
@@ -88,9 +88,9 @@ bvme6000_probe(struct device *dev)
 }
 
 static __devexit int
-bvme6000_device_remove(struct device *dev)
+bvme6000_device_remove(struct platform_device *dev)
 {
-       struct Scsi_Host *host = dev_get_drvdata(dev);
+       struct Scsi_Host *host = platform_get_drvdata(dev);
        struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
 
        scsi_remove_host(host);
@@ -101,25 +101,27 @@ bvme6000_device_remove(struct device *dev)
        return 0;
 }
 
-static struct device_driver bvme6000_scsi_driver = {
-       .name   = "bvme6000-scsi",
-       .bus    = &platform_bus_type,
-       .probe  = bvme6000_probe,
-       .remove = __devexit_p(bvme6000_device_remove),
+static struct platform_driver bvme6000_scsi_driver = {
+       .driver = {
+               .name           = "bvme6000-scsi",
+               .owner          = THIS_MODULE,
+       },
+       .probe          = bvme6000_probe,
+       .remove         = __devexit_p(bvme6000_device_remove),
 };
 
 static int __init bvme6000_scsi_init(void)
 {
        int err;
 
-       err = driver_register(&bvme6000_scsi_driver);
+       err = platform_driver_register(&bvme6000_scsi_driver);
        if (err)
                return err;
 
        bvme6000_scsi_device = platform_device_register_simple("bvme6000-scsi",
                                                               -1, NULL, 0);
        if (IS_ERR(bvme6000_scsi_device)) {
-               driver_unregister(&bvme6000_scsi_driver);
+               platform_driver_unregister(&bvme6000_scsi_driver);
                return PTR_ERR(bvme6000_scsi_device);
        }
 
@@ -129,7 +131,7 @@ static int __init bvme6000_scsi_init(void)
 static void __exit bvme6000_scsi_exit(void)
 {
        platform_device_unregister(bvme6000_scsi_device);
-       driver_unregister(&bvme6000_scsi_driver);
+       platform_driver_unregister(&bvme6000_scsi_driver);
 }
 
 module_init(bvme6000_scsi_init);