diff options
Diffstat (limited to 'drivers/scsi/pm8001/pm8001_init.c')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_init.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index b95285f3383f..002360da01e3 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c | |||
@@ -51,6 +51,8 @@ static int pm8001_id; | |||
51 | 51 | ||
52 | LIST_HEAD(hba_list); | 52 | LIST_HEAD(hba_list); |
53 | 53 | ||
54 | struct workqueue_struct *pm8001_wq; | ||
55 | |||
54 | /** | 56 | /** |
55 | * The main structure which LLDD must register for scsi core. | 57 | * The main structure which LLDD must register for scsi core. |
56 | */ | 58 | */ |
@@ -134,7 +136,6 @@ static void __devinit pm8001_phy_init(struct pm8001_hba_info *pm8001_ha, | |||
134 | static void pm8001_free(struct pm8001_hba_info *pm8001_ha) | 136 | static void pm8001_free(struct pm8001_hba_info *pm8001_ha) |
135 | { | 137 | { |
136 | int i; | 138 | int i; |
137 | struct pm8001_wq *wq; | ||
138 | 139 | ||
139 | if (!pm8001_ha) | 140 | if (!pm8001_ha) |
140 | return; | 141 | return; |
@@ -150,8 +151,7 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha) | |||
150 | PM8001_CHIP_DISP->chip_iounmap(pm8001_ha); | 151 | PM8001_CHIP_DISP->chip_iounmap(pm8001_ha); |
151 | if (pm8001_ha->shost) | 152 | if (pm8001_ha->shost) |
152 | scsi_host_put(pm8001_ha->shost); | 153 | scsi_host_put(pm8001_ha->shost); |
153 | list_for_each_entry(wq, &pm8001_ha->wq_list, entry) | 154 | flush_workqueue(pm8001_wq); |
154 | cancel_delayed_work(&wq->work_q); | ||
155 | kfree(pm8001_ha->tags); | 155 | kfree(pm8001_ha->tags); |
156 | kfree(pm8001_ha); | 156 | kfree(pm8001_ha); |
157 | } | 157 | } |
@@ -381,7 +381,6 @@ pm8001_pci_alloc(struct pci_dev *pdev, u32 chip_id, struct Scsi_Host *shost) | |||
381 | pm8001_ha->sas = sha; | 381 | pm8001_ha->sas = sha; |
382 | pm8001_ha->shost = shost; | 382 | pm8001_ha->shost = shost; |
383 | pm8001_ha->id = pm8001_id++; | 383 | pm8001_ha->id = pm8001_id++; |
384 | INIT_LIST_HEAD(&pm8001_ha->wq_list); | ||
385 | pm8001_ha->logging_level = 0x01; | 384 | pm8001_ha->logging_level = 0x01; |
386 | sprintf(pm8001_ha->name, "%s%d", DRV_NAME, pm8001_ha->id); | 385 | sprintf(pm8001_ha->name, "%s%d", DRV_NAME, pm8001_ha->id); |
387 | #ifdef PM8001_USE_TASKLET | 386 | #ifdef PM8001_USE_TASKLET |
@@ -758,7 +757,7 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
758 | int i , pos; | 757 | int i , pos; |
759 | u32 device_state; | 758 | u32 device_state; |
760 | pm8001_ha = sha->lldd_ha; | 759 | pm8001_ha = sha->lldd_ha; |
761 | flush_scheduled_work(); | 760 | flush_workqueue(pm8001_wq); |
762 | scsi_block_requests(pm8001_ha->shost); | 761 | scsi_block_requests(pm8001_ha->shost); |
763 | pos = pci_find_capability(pdev, PCI_CAP_ID_PM); | 762 | pos = pci_find_capability(pdev, PCI_CAP_ID_PM); |
764 | if (pos == 0) { | 763 | if (pos == 0) { |
@@ -870,17 +869,26 @@ static struct pci_driver pm8001_pci_driver = { | |||
870 | */ | 869 | */ |
871 | static int __init pm8001_init(void) | 870 | static int __init pm8001_init(void) |
872 | { | 871 | { |
873 | int rc; | 872 | int rc = -ENOMEM; |
873 | |||
874 | pm8001_wq = alloc_workqueue("pm8001", 0, 0); | ||
875 | if (!pm8001_wq) | ||
876 | goto err; | ||
877 | |||
874 | pm8001_id = 0; | 878 | pm8001_id = 0; |
875 | pm8001_stt = sas_domain_attach_transport(&pm8001_transport_ops); | 879 | pm8001_stt = sas_domain_attach_transport(&pm8001_transport_ops); |
876 | if (!pm8001_stt) | 880 | if (!pm8001_stt) |
877 | return -ENOMEM; | 881 | goto err_wq; |
878 | rc = pci_register_driver(&pm8001_pci_driver); | 882 | rc = pci_register_driver(&pm8001_pci_driver); |
879 | if (rc) | 883 | if (rc) |
880 | goto err_out; | 884 | goto err_tp; |
881 | return 0; | 885 | return 0; |
882 | err_out: | 886 | |
887 | err_tp: | ||
883 | sas_release_transport(pm8001_stt); | 888 | sas_release_transport(pm8001_stt); |
889 | err_wq: | ||
890 | destroy_workqueue(pm8001_wq); | ||
891 | err: | ||
884 | return rc; | 892 | return rc; |
885 | } | 893 | } |
886 | 894 | ||
@@ -888,6 +896,7 @@ static void __exit pm8001_exit(void) | |||
888 | { | 896 | { |
889 | pci_unregister_driver(&pm8001_pci_driver); | 897 | pci_unregister_driver(&pm8001_pci_driver); |
890 | sas_release_transport(pm8001_stt); | 898 | sas_release_transport(pm8001_stt); |
899 | destroy_workqueue(pm8001_wq); | ||
891 | } | 900 | } |
892 | 901 | ||
893 | module_init(pm8001_init); | 902 | module_init(pm8001_init); |