hisi_sas: Add hisi_hba workqueue
authorJohn Garry <john.garry@huawei.com>
Tue, 17 Nov 2015 16:50:40 +0000 (00:50 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 26 Nov 2015 03:12:56 +0000 (22:12 -0500)
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas.h
drivers/scsi/hisi_sas/hisi_sas_main.c

index c50384f60be693d598754a85af38a3bc9cb61c90..62bc6f32b73442e95cfb20df751e1e21000943c6 100644 (file)
@@ -72,6 +72,7 @@ struct hisi_hba {
 
        int n_phy;
 
+       struct workqueue_struct *wq;
 
        int slot_index_count;
        unsigned long *slot_index_tags;
index d7d9516385a7f931849865dedd332d552ab8512d..7f32c6b76d0553e8b3a6d6497eab8517f6e4b61e 100644 (file)
@@ -150,6 +150,12 @@ static int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost)
 
        hisi_sas_slot_index_init(hisi_hba);
 
+       hisi_hba->wq = create_singlethread_workqueue(dev_name(dev));
+       if (!hisi_hba->wq) {
+               dev_err(dev, "sas_alloc: failed to create workqueue\n");
+               goto err_out;
+       }
+
        return 0;
 err_out:
        return -ENOMEM;
@@ -207,6 +213,8 @@ static void hisi_sas_free(struct hisi_hba *hisi_hba)
                                  hisi_hba->sata_breakpoint,
                                  hisi_hba->sata_breakpoint_dma);
 
+       if (hisi_hba->wq)
+               destroy_workqueue(hisi_hba->wq);
 }
 
 static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,