Commit 580d4e31 authored by Sreekanth Reddy's avatar Sreekanth Reddy Committed by James Bottomley

mpt3sas: Remove redundancy code while freeing the controller resources.

Signed-off-by: default avatarSreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
parent e4bc7f5c
...@@ -1812,6 +1812,36 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) ...@@ -1812,6 +1812,36 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
return r; return r;
} }
/**
* mpt3sas_base_unmap_resources - free controller resources
* @ioc: per adapter object
*/
void
mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc)
{
struct pci_dev *pdev = ioc->pdev;
dexitprintk(ioc, printk(MPT3SAS_FMT "%s\n",
ioc->name, __func__));
_base_free_irq(ioc);
_base_disable_msix(ioc);
if (ioc->msix96_vector)
kfree(ioc->replyPostRegisterIndex);
if (ioc->chip_phys) {
iounmap(ioc->chip);
ioc->chip_phys = 0;
}
if (pci_is_enabled(pdev)) {
pci_release_selected_regions(ioc->pdev, ioc->bars);
pci_disable_pcie_error_reporting(pdev);
pci_disable_device(pdev);
}
}
/** /**
* mpt3sas_base_map_resources - map in controller resources (io/irq/memap) * mpt3sas_base_map_resources - map in controller resources (io/irq/memap)
* @ioc: per adapter object * @ioc: per adapter object
...@@ -1947,14 +1977,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) ...@@ -1947,14 +1977,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
return 0; return 0;
out_fail: out_fail:
if (ioc->chip_phys) mpt3sas_base_unmap_resources(ioc);
iounmap(ioc->chip);
ioc->chip_phys = 0;
pci_release_selected_regions(ioc->pdev, ioc->bars);
pci_disable_pcie_error_reporting(pdev);
pci_disable_device(pdev);
if (ioc->msix96_vector)
kfree(ioc->replyPostRegisterIndex);
return r; return r;
} }
...@@ -4691,8 +4714,6 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc, int sleep_flag) ...@@ -4691,8 +4714,6 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
void void
mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc) mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc)
{ {
struct pci_dev *pdev = ioc->pdev;
dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
__func__)); __func__));
...@@ -4703,21 +4724,7 @@ mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc) ...@@ -4703,21 +4724,7 @@ mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc)
ioc->shost_recovery = 0; ioc->shost_recovery = 0;
} }
_base_free_irq(ioc); mpt3sas_base_unmap_resources(ioc);
_base_disable_msix(ioc);
if (ioc->msix96_vector)
kfree(ioc->replyPostRegisterIndex);
if (ioc->chip_phys && ioc->chip)
iounmap(ioc->chip);
ioc->chip_phys = 0;
if (pci_is_enabled(pdev)) {
pci_release_selected_regions(ioc->pdev, ioc->bars);
pci_disable_pcie_error_reporting(pdev);
pci_disable_device(pdev);
}
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment