mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-17 12:34:01 +00:00
scsi: mpi3mr: Free enclosure objects during driver unload
Free the enclosure device objects during driver unload and before rescanning the target devices during controller reset. Link: https://lore.kernel.org/r/20220912135742.11764-7-sreekanth.reddy@broadcom.com Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
bad2f28da6
commit
130fc180a4
3 changed files with 24 additions and 0 deletions
|
@ -1392,4 +1392,5 @@ void mpi3mr_refresh_expanders(struct mpi3mr_ioc *mrioc);
|
|||
void mpi3mr_add_event_wait_for_device_refresh(struct mpi3mr_ioc *mrioc);
|
||||
void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc);
|
||||
void mpi3mr_flush_cmds_for_unrecovered_controller(struct mpi3mr_ioc *mrioc);
|
||||
void mpi3mr_free_enclosure_list(struct mpi3mr_ioc *mrioc);
|
||||
#endif /*MPI3MR_H_INCLUDED*/
|
||||
|
|
|
@ -4250,6 +4250,8 @@ void mpi3mr_free_mem(struct mpi3mr_ioc *mrioc)
|
|||
u16 i;
|
||||
struct mpi3mr_intr_info *intr_info;
|
||||
|
||||
mpi3mr_free_enclosure_list(mrioc);
|
||||
|
||||
if (mrioc->sense_buf_pool) {
|
||||
if (mrioc->sense_buf)
|
||||
dma_pool_free(mrioc->sense_buf_pool, mrioc->sense_buf,
|
||||
|
@ -4897,6 +4899,8 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc,
|
|||
mpi3mr_flush_host_io(mrioc);
|
||||
mpi3mr_cleanup_fwevt_list(mrioc);
|
||||
mpi3mr_invalidate_devhandles(mrioc);
|
||||
mpi3mr_free_enclosure_list(mrioc);
|
||||
|
||||
if (mrioc->prepare_for_reset) {
|
||||
mrioc->prepare_for_reset = 0;
|
||||
mrioc->prepare_for_reset_timeout_counter = 0;
|
||||
|
|
|
@ -1334,6 +1334,25 @@ out:
|
|||
mpi3mr_tgtdev_put(tgtdev);
|
||||
}
|
||||
|
||||
/**
|
||||
* mpi3mr_free_enclosure_list - release enclosures
|
||||
* @mrioc: Adapter instance reference
|
||||
*
|
||||
* Free memory allocated during encloure add.
|
||||
*
|
||||
* Return nothing.
|
||||
*/
|
||||
void mpi3mr_free_enclosure_list(struct mpi3mr_ioc *mrioc)
|
||||
{
|
||||
struct mpi3mr_enclosure_node *enclosure_dev, *enclosure_dev_next;
|
||||
|
||||
list_for_each_entry_safe(enclosure_dev,
|
||||
enclosure_dev_next, &mrioc->enclosure_list, list) {
|
||||
list_del(&enclosure_dev->list);
|
||||
kfree(enclosure_dev);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* mpi3mr_enclosure_find_by_handle - enclosure search by handle
|
||||
* @mrioc: Adapter instance reference
|
||||
|
|
Loading…
Add table
Reference in a new issue