Commit c06c0462 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

cnic: Add cnic_free_uio()

to free all UIO related structures.
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fdf24086
...@@ -770,20 +770,15 @@ static void cnic_free_context(struct cnic_dev *dev) ...@@ -770,20 +770,15 @@ static void cnic_free_context(struct cnic_dev *dev)
} }
} }
static void cnic_free_resc(struct cnic_dev *dev) static void __cnic_free_uio(struct cnic_dev *dev)
{ {
struct cnic_local *cp = dev->cnic_priv; struct cnic_local *cp = dev->cnic_priv;
int i = 0;
if (cp->cnic_uinfo) { if (cp->cnic_uinfo)
while (cp->uio_dev != -1 && i < 15) {
msleep(100);
i++;
}
uio_unregister_device(cp->cnic_uinfo); uio_unregister_device(cp->cnic_uinfo);
kfree(cp->cnic_uinfo); kfree(cp->cnic_uinfo);
cp->cnic_uinfo = NULL; cp->cnic_uinfo = NULL;
}
if (cp->l2_buf) { if (cp->l2_buf) {
dma_free_coherent(&dev->pcidev->dev, cp->l2_buf_size, dma_free_coherent(&dev->pcidev->dev, cp->l2_buf_size,
...@@ -796,6 +791,28 @@ static void cnic_free_resc(struct cnic_dev *dev) ...@@ -796,6 +791,28 @@ static void cnic_free_resc(struct cnic_dev *dev)
cp->l2_ring, cp->l2_ring_map); cp->l2_ring, cp->l2_ring_map);
cp->l2_ring = NULL; cp->l2_ring = NULL;
} }
}
static void cnic_free_uio(struct cnic_dev *dev)
{
if (!dev)
return;
__cnic_free_uio(dev);
}
static void cnic_free_resc(struct cnic_dev *dev)
{
struct cnic_local *cp = dev->cnic_priv;
int i = 0;
if (cp->cnic_uinfo) {
while (cp->uio_dev != -1 && i < 15) {
msleep(100);
i++;
}
cnic_free_uio(dev);
}
cnic_free_context(dev); cnic_free_context(dev);
kfree(cp->ctx_arr); kfree(cp->ctx_arr);
......
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