diff options
author | Michael Chan <mchan@broadcom.com> | 2010-10-13 10:06:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-14 13:45:54 -0400 |
commit | c06c0462250a5dbc9e58d00caab4cd7e6675128c (patch) | |
tree | 639bda566e12598100ed191123f24554b592ef3a /drivers/net/cnic.c | |
parent | fdf24086f4752aee5dfb40143c736250df017820 (diff) |
cnic: Add cnic_free_uio()
to free all UIO related structures.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r-- | drivers/net/cnic.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index b12bba795f2e..739ffcb9bff0 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -770,20 +770,15 @@ static void cnic_free_context(struct cnic_dev *dev) | |||
770 | } | 770 | } |
771 | } | 771 | } |
772 | 772 | ||
773 | static void cnic_free_resc(struct cnic_dev *dev) | 773 | static void __cnic_free_uio(struct cnic_dev *dev) |
774 | { | 774 | { |
775 | struct cnic_local *cp = dev->cnic_priv; | 775 | struct cnic_local *cp = dev->cnic_priv; |
776 | int i = 0; | ||
777 | 776 | ||
778 | if (cp->cnic_uinfo) { | 777 | if (cp->cnic_uinfo) |
779 | while (cp->uio_dev != -1 && i < 15) { | ||
780 | msleep(100); | ||
781 | i++; | ||
782 | } | ||
783 | uio_unregister_device(cp->cnic_uinfo); | 778 | uio_unregister_device(cp->cnic_uinfo); |
784 | kfree(cp->cnic_uinfo); | 779 | |
785 | cp->cnic_uinfo = NULL; | 780 | kfree(cp->cnic_uinfo); |
786 | } | 781 | cp->cnic_uinfo = NULL; |
787 | 782 | ||
788 | if (cp->l2_buf) { | 783 | if (cp->l2_buf) { |
789 | dma_free_coherent(&dev->pcidev->dev, cp->l2_buf_size, | 784 | dma_free_coherent(&dev->pcidev->dev, cp->l2_buf_size, |
@@ -796,6 +791,28 @@ static void cnic_free_resc(struct cnic_dev *dev) | |||
796 | cp->l2_ring, cp->l2_ring_map); | 791 | cp->l2_ring, cp->l2_ring_map); |
797 | cp->l2_ring = NULL; | 792 | cp->l2_ring = NULL; |
798 | } | 793 | } |
794 | } | ||
795 | |||
796 | static void cnic_free_uio(struct cnic_dev *dev) | ||
797 | { | ||
798 | if (!dev) | ||
799 | return; | ||
800 | |||
801 | __cnic_free_uio(dev); | ||
802 | } | ||
803 | |||
804 | static void cnic_free_resc(struct cnic_dev *dev) | ||
805 | { | ||
806 | struct cnic_local *cp = dev->cnic_priv; | ||
807 | int i = 0; | ||
808 | |||
809 | if (cp->cnic_uinfo) { | ||
810 | while (cp->uio_dev != -1 && i < 15) { | ||
811 | msleep(100); | ||
812 | i++; | ||
813 | } | ||
814 | cnic_free_uio(dev); | ||
815 | } | ||
799 | 816 | ||
800 | cnic_free_context(dev); | 817 | cnic_free_context(dev); |
801 | kfree(cp->ctx_arr); | 818 | kfree(cp->ctx_arr); |