aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_main.c
diff options
context:
space:
mode:
authorJayamohan Kallickal <jayamohan.kallickal@emulex.com>2011-08-22 13:08:28 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-08-29 03:16:18 -0400
commit25602c97f50e4b7fea84d2c81326dc5e372ca868 (patch)
tree1c063fce032185e1483b0be828e2b7377ee1b3a9 /drivers/scsi/be2iscsi/be_main.c
parent8fcfb21073ea4f4261c8ee3ccd2fde8e281a4f28 (diff)
[SCSI] be2iscsi: Adding a shutdown Routine
This patch adds a shutdown routine. It fixes a bug where when be2net and be2iscsi are both used be2iscsi was not cleaning up its resources properly causing be2net to fail to get loaded when the system is rebooted. Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_main.c')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 04970eb1975..51cfd4f2911 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4119,9 +4119,8 @@ static int beiscsi_task_xmit(struct iscsi_task *task)
4119 return beiscsi_iotask(task, sg, num_sg, xferlen, writedir); 4119 return beiscsi_iotask(task, sg, num_sg, xferlen, writedir);
4120} 4120}
4121 4121
4122static void beiscsi_remove(struct pci_dev *pcidev) 4122static void beiscsi_quiesce(struct beiscsi_hba *phba)
4123{ 4123{
4124 struct beiscsi_hba *phba = NULL;
4125 struct hwi_controller *phwi_ctrlr; 4124 struct hwi_controller *phwi_ctrlr;
4126 struct hwi_context_memory *phwi_context; 4125 struct hwi_context_memory *phwi_context;
4127 struct be_eq_obj *pbe_eq; 4126 struct be_eq_obj *pbe_eq;
@@ -4129,12 +4128,6 @@ static void beiscsi_remove(struct pci_dev *pcidev)
4129 u8 *real_offset = 0; 4128 u8 *real_offset = 0;
4130 u32 value = 0; 4129 u32 value = 0;
4131 4130
4132 phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev);
4133 if (!phba) {
4134 dev_err(&pcidev->dev, "beiscsi_remove called with no phba\n");
4135 return;
4136 }
4137
4138 phwi_ctrlr = phba->phwi_ctrlr; 4131 phwi_ctrlr = phba->phwi_ctrlr;
4139 phwi_context = phwi_ctrlr->phwi_ctxt; 4132 phwi_context = phwi_ctrlr->phwi_ctxt;
4140 hwi_disable_intr(phba); 4133 hwi_disable_intr(phba);
@@ -4170,12 +4163,40 @@ static void beiscsi_remove(struct pci_dev *pcidev)
4170 phba->ctrl.mbox_mem_alloced.size, 4163 phba->ctrl.mbox_mem_alloced.size,
4171 phba->ctrl.mbox_mem_alloced.va, 4164 phba->ctrl.mbox_mem_alloced.va,
4172 phba->ctrl.mbox_mem_alloced.dma); 4165 phba->ctrl.mbox_mem_alloced.dma);
4166}
4167
4168static void beiscsi_remove(struct pci_dev *pcidev)
4169{
4170
4171 struct beiscsi_hba *phba = NULL;
4172
4173 phba = pci_get_drvdata(pcidev);
4174 if (!phba) {
4175 dev_err(&pcidev->dev, "beiscsi_remove called with no phba\n");
4176 return;
4177 }
4178
4179 beiscsi_quiesce(phba);
4173 iscsi_boot_destroy_kset(phba->boot_kset); 4180 iscsi_boot_destroy_kset(phba->boot_kset);
4174 iscsi_host_remove(phba->shost); 4181 iscsi_host_remove(phba->shost);
4175 pci_dev_put(phba->pcidev); 4182 pci_dev_put(phba->pcidev);
4176 iscsi_host_free(phba->shost); 4183 iscsi_host_free(phba->shost);
4177} 4184}
4178 4185
4186static void beiscsi_shutdown(struct pci_dev *pcidev)
4187{
4188
4189 struct beiscsi_hba *phba = NULL;
4190
4191 phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev);
4192 if (!phba) {
4193 dev_err(&pcidev->dev, "beiscsi_shutdown called with no phba\n");
4194 return;
4195 }
4196
4197 beiscsi_quiesce(phba);
4198}
4199
4179static void beiscsi_msix_enable(struct beiscsi_hba *phba) 4200static void beiscsi_msix_enable(struct beiscsi_hba *phba)
4180{ 4201{
4181 int i, status; 4202 int i, status;
@@ -4411,6 +4432,7 @@ static struct pci_driver beiscsi_pci_driver = {
4411 .name = DRV_NAME, 4432 .name = DRV_NAME,
4412 .probe = beiscsi_dev_probe, 4433 .probe = beiscsi_dev_probe,
4413 .remove = beiscsi_remove, 4434 .remove = beiscsi_remove,
4435 .shutdown = beiscsi_shutdown,
4414 .id_table = beiscsi_pci_id_table 4436 .id_table = beiscsi_pci_id_table
4415}; 4437};
4416 4438