From 9140b30d318520e6d7dfe3b48aa62e6a7336b510 Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Mon, 22 May 2017 10:59:25 -0700 Subject: [PATCH] nfp: add nfp_net_pf_free_vnic() function Soon a third place will need to free a struct nfp_net. Add a free counterpart to nfp_net_pf_alloc_vnic(). Signed-off-by: Jakub Kicinski Reviewed-by: Simon Horman Signed-off-by: David S. Miller --- .../net/ethernet/netronome/nfp/nfp_net_main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c index 532371940fd6..5f0c58a56182 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c @@ -268,16 +268,20 @@ static u8 __iomem *nfp_net_pf_map_ctrl_bar(struct nfp_pf *pf) return ctrl_bar; } +static void nfp_net_pf_free_vnic(struct nfp_pf *pf, struct nfp_net *nn) +{ + list_del(&nn->vnic_list); + pf->num_vnics--; + nfp_net_free(nn); +} + static void nfp_net_pf_free_vnics(struct nfp_pf *pf) { struct nfp_net *nn; while (!list_empty(&pf->vnics)) { nn = list_first_entry(&pf->vnics, struct nfp_net, vnic_list); - list_del(&nn->vnic_list); - pf->num_vnics--; - - nfp_net_free(nn); + nfp_net_pf_free_vnic(pf, nn); } } @@ -518,9 +522,7 @@ static void nfp_net_refresh_vnics(struct work_struct *work) nfp_net_debugfs_dir_clean(&nn->debugfs_dir); nfp_net_clean(nn); - list_del(&nn->vnic_list); - pf->num_vnics--; - nfp_net_free(nn); + nfp_net_pf_free_vnic(pf, nn); } if (list_empty(&pf->vnics)) -- 2.20.1