]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/scsi/libsas/sas_init.c
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[mv-sheeva.git] / drivers / scsi / libsas / sas_init.c
index 90cce34cb6f5e20a671e5b8d1b160dda5cf0cf41..2dc55343f671f6c7b4fa681278233c85c3db314e 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/device.h>
 #include <linux/spinlock.h>
@@ -87,6 +88,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 +131,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 +260,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 +294,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;