From a5b5c958ffd1610545d6b4b8290aa9c5266d10fa Mon Sep 17 00:00:00 2001 From: WANG Cong Date: Tue, 11 Feb 2014 17:07:32 -0800 Subject: net_sched: act: refactor cleanup ops For bindcnt and refcnt etc., they are common for all actions, not need to repeat such operations for their own, they can be unified now. Actions just need to do its specific cleanup if needed. Cc: Jamal Hadi Salim Cc: David S. Miller Signed-off-by: Cong Wang Signed-off-by: Jamal Hadi Salim Signed-off-by: David S. Miller --- net/sched/act_simple.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'net/sched/act_simple.c') diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 11c2922bb900..14b5e362a1d6 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c @@ -47,21 +47,10 @@ static int tcf_simp(struct sk_buff *skb, const struct tc_action *a, return d->tcf_action; } -static int tcf_simp_release(struct tc_action *a, int bind) +static void tcf_simp_release(struct tc_action *a, int bind) { struct tcf_defact *d = to_defact(a); - int ret = 0; - if (d) { - if (bind) - d->tcf_bindcnt--; - d->tcf_refcnt--; - if (d->tcf_bindcnt <= 0 && d->tcf_refcnt <= 0) { - kfree(d->tcfd_defdata); - tcf_hash_destroy(a); - ret = 1; - } - } - return ret; + kfree(d->tcfd_defdata); } static int alloc_defdata(struct tcf_defact *d, char *defdata) @@ -132,7 +121,7 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla, if (bind) return 0; - tcf_simp_release(a, bind); + tcf_hash_release(a, bind); if (!ovr) return -EEXIST; -- cgit v1.2.3