]> err.no Git - linux-2.6/blobdiff - drivers/scsi/aic94xx/aic94xx_init.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[linux-2.6] / drivers / scsi / aic94xx / aic94xx_init.c
index 69aa708875302997ca2e57abf5e5d38bc868d58e..99743ca29ca147df75dacd12396be71da90266c9 100644 (file)
@@ -24,7 +24,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -240,10 +239,14 @@ static int __devinit asd_common_setup(struct asd_ha_struct *asd_ha)
        /* All phys are enabled, by default. */
        asd_ha->hw_prof.enabled_phys = 0xFF;
        for (i = 0; i < ASD_MAX_PHYS; i++) {
-               asd_ha->hw_prof.phy_desc[i].max_sas_lrate = PHY_LINKRATE_3;
-               asd_ha->hw_prof.phy_desc[i].min_sas_lrate = PHY_LINKRATE_1_5;
-               asd_ha->hw_prof.phy_desc[i].max_sata_lrate= PHY_LINKRATE_1_5;
-               asd_ha->hw_prof.phy_desc[i].min_sata_lrate= PHY_LINKRATE_1_5;
+               asd_ha->hw_prof.phy_desc[i].max_sas_lrate =
+                       SAS_LINK_RATE_3_0_GBPS;
+               asd_ha->hw_prof.phy_desc[i].min_sas_lrate =
+                       SAS_LINK_RATE_1_5_GBPS;
+               asd_ha->hw_prof.phy_desc[i].max_sata_lrate =
+                       SAS_LINK_RATE_1_5_GBPS;
+               asd_ha->hw_prof.phy_desc[i].min_sata_lrate =
+                       SAS_LINK_RATE_1_5_GBPS;
        }
 
        return 0;
@@ -306,11 +309,29 @@ static ssize_t asd_show_dev_pcba_sn(struct device *dev,
 }
 static DEVICE_ATTR(pcba_sn, S_IRUGO, asd_show_dev_pcba_sn, NULL);
 
-static void asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
+static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
 {
-       device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision);
-       device_create_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
-       device_create_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
+       int err;
+
+       err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision);
+       if (err)
+               return err;
+
+       err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
+       if (err)
+               goto err_rev;
+
+       err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
+       if (err)
+               goto err_biosb;
+
+       return 0;
+
+err_biosb:
+       device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
+err_rev:
+       device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision);
+       return err;
 }
 
 static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha)
@@ -642,7 +663,9 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
        }
        ASD_DPRINTK("escbs posted\n");
 
-       asd_create_dev_attrs(asd_ha);
+       err = asd_create_dev_attrs(asd_ha);
+       if (err)
+               goto Err_dev_attrs;
 
        err = asd_register_sas_ha(asd_ha);
        if (err)
@@ -665,6 +688,7 @@ Err_en_phys:
        asd_unregister_sas_ha(asd_ha);
 Err_reg_sas:
        asd_remove_dev_attrs(asd_ha);
+Err_dev_attrs:
 Err_escbs:
        asd_disable_ints(asd_ha);
        free_irq(dev->irq, asd_ha);
@@ -751,9 +775,9 @@ static ssize_t asd_version_show(struct device_driver *driver, char *buf)
 }
 static DRIVER_ATTR(version, S_IRUGO, asd_version_show, NULL);
 
-static void asd_create_driver_attrs(struct device_driver *driver)
+static int asd_create_driver_attrs(struct device_driver *driver)
 {
-       driver_create_file(driver, &driver_attr_version);
+       return driver_create_file(driver, &driver_attr_version);
 }
 
 static void asd_remove_driver_attrs(struct device_driver *driver)
@@ -824,17 +848,21 @@ static int __init aic94xx_init(void)
 
        aic94xx_transport_template =
                sas_domain_attach_transport(&aic94xx_transport_functions);
-       if (err)
+       if (!aic94xx_transport_template)
                goto out_destroy_caches;
 
        err = pci_register_driver(&aic94xx_pci_driver);
        if (err)
                goto out_release_transport;
 
-       asd_create_driver_attrs(&aic94xx_pci_driver.driver);
+       err = asd_create_driver_attrs(&aic94xx_pci_driver.driver);
+       if (err)
+               goto out_unregister_pcidrv;
 
        return err;
 
+ out_unregister_pcidrv:
+       pci_unregister_driver(&aic94xx_pci_driver);
  out_release_transport:
        sas_release_transport(aic94xx_transport_template);
  out_destroy_caches: