Skip to content

Commit

Permalink
[SCSI] be2iscsi: Adding a shutdown Routine
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jayamohan Kallickal authored and James Bottomley committed Aug 29, 2011
1 parent 8fcfb21 commit 25602c9
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions drivers/scsi/be2iscsi/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4119,22 +4119,15 @@ static int beiscsi_task_xmit(struct iscsi_task *task)
return beiscsi_iotask(task, sg, num_sg, xferlen, writedir);
}

static void beiscsi_remove(struct pci_dev *pcidev)
static void beiscsi_quiesce(struct beiscsi_hba *phba)
{
struct beiscsi_hba *phba = NULL;
struct hwi_controller *phwi_ctrlr;
struct hwi_context_memory *phwi_context;
struct be_eq_obj *pbe_eq;
unsigned int i, msix_vec;
u8 *real_offset = 0;
u32 value = 0;

phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev);
if (!phba) {
dev_err(&pcidev->dev, "beiscsi_remove called with no phba\n");
return;
}

phwi_ctrlr = phba->phwi_ctrlr;
phwi_context = phwi_ctrlr->phwi_ctxt;
hwi_disable_intr(phba);
Expand Down Expand Up @@ -4170,12 +4163,40 @@ static void beiscsi_remove(struct pci_dev *pcidev)
phba->ctrl.mbox_mem_alloced.size,
phba->ctrl.mbox_mem_alloced.va,
phba->ctrl.mbox_mem_alloced.dma);
}

static void beiscsi_remove(struct pci_dev *pcidev)
{

struct beiscsi_hba *phba = NULL;

phba = pci_get_drvdata(pcidev);
if (!phba) {
dev_err(&pcidev->dev, "beiscsi_remove called with no phba\n");
return;
}

beiscsi_quiesce(phba);
iscsi_boot_destroy_kset(phba->boot_kset);
iscsi_host_remove(phba->shost);
pci_dev_put(phba->pcidev);
iscsi_host_free(phba->shost);
}

static void beiscsi_shutdown(struct pci_dev *pcidev)
{

struct beiscsi_hba *phba = NULL;

phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev);
if (!phba) {
dev_err(&pcidev->dev, "beiscsi_shutdown called with no phba\n");
return;
}

beiscsi_quiesce(phba);
}

static void beiscsi_msix_enable(struct beiscsi_hba *phba)
{
int i, status;
Expand Down Expand Up @@ -4411,6 +4432,7 @@ static struct pci_driver beiscsi_pci_driver = {
.name = DRV_NAME,
.probe = beiscsi_dev_probe,
.remove = beiscsi_remove,
.shutdown = beiscsi_shutdown,
.id_table = beiscsi_pci_id_table
};

Expand Down

0 comments on commit 25602c9

Please sign in to comment.