]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/libsas/sas_init.c
Merge branches 'release' and 'autoload' into release
[linux-2.6-omap-h63xx.git] / drivers / scsi / libsas / sas_init.c
index 90cce34cb6f5e20a671e5b8d1b160dda5cf0cf41..9cd5abe9e714e3f243ffddce6cda0500f3257f92 100644 (file)
@@ -87,6 +87,9 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)
        else if (sas_ha->lldd_queue_size == -1)
                sas_ha->lldd_queue_size = 128; /* Sanity */
 
+       sas_ha->state = SAS_HA_REGISTERED;
+       spin_lock_init(&sas_ha->state_lock);
+
        error = sas_register_phys(sas_ha);
        if (error) {
                printk(KERN_NOTICE "couldn't register sas phys:%d\n", error);
@@ -127,12 +130,22 @@ Undo_phys:
 
 int sas_unregister_ha(struct sas_ha_struct *sas_ha)
 {
+       unsigned long flags;
+
+       /* Set the state to unregistered to avoid further
+        * events to be queued */
+       spin_lock_irqsave(&sas_ha->state_lock, flags);
+       sas_ha->state = SAS_HA_UNREGISTERED;
+       spin_unlock_irqrestore(&sas_ha->state_lock, flags);
+       scsi_flush_work(sas_ha->core.shost);
+
+       sas_unregister_ports(sas_ha);
+
        if (sas_ha->lldd_max_execute_num > 1) {
                sas_shutdown_queue(sas_ha);
+               sas_ha->lldd_max_execute_num = 1;
        }
 
-       sas_unregister_ports(sas_ha);
-
        return 0;
 }
 
@@ -246,6 +259,7 @@ static struct sas_function_template sft = {
        .phy_reset = sas_phy_reset,
        .set_phy_speed = sas_set_phy_speed,
        .get_linkerrors = sas_get_linkerrors,
+       .smp_handler = sas_smp_handler,
 };
 
 struct scsi_transport_template *
@@ -279,7 +293,7 @@ EXPORT_SYMBOL_GPL(sas_domain_release_transport);
 static int __init sas_class_init(void)
 {
        sas_task_cache = kmem_cache_create("sas_task", sizeof(struct sas_task),
-                                          0, SLAB_HWCACHE_ALIGN, NULL, NULL);
+                                          0, SLAB_HWCACHE_ALIGN, NULL);
        if (!sas_task_cache)
                return -ENOMEM;