net_sched: avoid casting void pointer
authorWANG Cong <xiyou.wangcong@gmail.com>
Fri, 10 Jan 2014 00:14:03 +0000 (16:14 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Jan 2014 19:50:15 +0000 (11:50 -0800)
tp->root is a void* pointer, no need to cast it.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_basic.c
net/sched/cls_fw.c
net/sched/cls_route.c
net/sched/cls_tcindex.c
net/sched/cls_u32.c

index af6bea1..e98ca99 100644 (file)
@@ -38,7 +38,7 @@ static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp,
                          struct tcf_result *res)
 {
        int r;
-       struct basic_head *head = (struct basic_head *) tp->root;
+       struct basic_head *head = tp->root;
        struct basic_filter *f;
 
        list_for_each_entry(f, &head->flist, link) {
@@ -56,7 +56,7 @@ static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 static unsigned long basic_get(struct tcf_proto *tp, u32 handle)
 {
        unsigned long l = 0UL;
-       struct basic_head *head = (struct basic_head *) tp->root;
+       struct basic_head *head = tp->root;
        struct basic_filter *f;
 
        if (head == NULL)
@@ -107,7 +107,7 @@ static void basic_destroy(struct tcf_proto *tp)
 
 static int basic_delete(struct tcf_proto *tp, unsigned long arg)
 {
-       struct basic_head *head = (struct basic_head *) tp->root;
+       struct basic_head *head = tp->root;
        struct basic_filter *t, *f = (struct basic_filter *) arg;
 
        list_for_each_entry(t, &head->flist, link)
@@ -164,7 +164,7 @@ static int basic_change(struct net *net, struct sk_buff *in_skb,
                        struct nlattr **tca, unsigned long *arg)
 {
        int err;
-       struct basic_head *head = (struct basic_head *) tp->root;
+       struct basic_head *head = tp->root;
        struct nlattr *tb[TCA_BASIC_MAX + 1];
        struct basic_filter *f = (struct basic_filter *) *arg;
 
@@ -225,7 +225,7 @@ errout:
 
 static void basic_walk(struct tcf_proto *tp, struct tcf_walker *arg)
 {
-       struct basic_head *head = (struct basic_head *) tp->root;
+       struct basic_head *head = tp->root;
        struct basic_filter *f;
 
        list_for_each_entry(f, &head->flist, link) {
index ca662aa..ed00e8c 100644 (file)
@@ -75,7 +75,7 @@ static inline int fw_hash(u32 handle)
 static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp,
                          struct tcf_result *res)
 {
-       struct fw_head *head = (struct fw_head *)tp->root;
+       struct fw_head *head = tp->root;
        struct fw_filter *f;
        int r;
        u32 id = skb->mark;
@@ -111,7 +111,7 @@ static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 
 static unsigned long fw_get(struct tcf_proto *tp, u32 handle)
 {
-       struct fw_head *head = (struct fw_head *)tp->root;
+       struct fw_head *head = tp->root;
        struct fw_filter *f;
 
        if (head == NULL)
@@ -160,7 +160,7 @@ static void fw_destroy(struct tcf_proto *tp)
 
 static int fw_delete(struct tcf_proto *tp, unsigned long arg)
 {
-       struct fw_head *head = (struct fw_head *)tp->root;
+       struct fw_head *head = tp->root;
        struct fw_filter *f = (struct fw_filter *)arg;
        struct fw_filter **fp;
 
@@ -190,7 +190,7 @@ static int
 fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f,
        struct nlattr **tb, struct nlattr **tca, unsigned long base)
 {
-       struct fw_head *head = (struct fw_head *)tp->root;
+       struct fw_head *head = tp->root;
        struct tcf_exts e;
        u32 mask;
        int err;
@@ -237,7 +237,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,
                     struct nlattr **tca,
                     unsigned long *arg)
 {
-       struct fw_head *head = (struct fw_head *)tp->root;
+       struct fw_head *head = tp->root;
        struct fw_filter *f = (struct fw_filter *) *arg;
        struct nlattr *opt = tca[TCA_OPTIONS];
        struct nlattr *tb[TCA_FW_MAX + 1];
@@ -300,7 +300,7 @@ errout:
 
 static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg)
 {
-       struct fw_head *head = (struct fw_head *)tp->root;
+       struct fw_head *head = tp->root;
        int h;
 
        if (head == NULL)
@@ -329,7 +329,7 @@ static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg)
 static int fw_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
                   struct sk_buff *skb, struct tcmsg *t)
 {
-       struct fw_head *head = (struct fw_head *)tp->root;
+       struct fw_head *head = tp->root;
        struct fw_filter *f = (struct fw_filter *)fh;
        unsigned char *b = skb_tail_pointer(skb);
        struct nlattr *nest;
index c913613..1ad3068 100644 (file)
@@ -123,7 +123,7 @@ static inline int route4_hash_wild(void)
 static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp,
                           struct tcf_result *res)
 {
-       struct route4_head *head = (struct route4_head *)tp->root;
+       struct route4_head *head = tp->root;
        struct dst_entry *dst;
        struct route4_bucket *b;
        struct route4_filter *f;
@@ -213,7 +213,7 @@ static inline u32 from_hash(u32 id)
 
 static unsigned long route4_get(struct tcf_proto *tp, u32 handle)
 {
-       struct route4_head *head = (struct route4_head *)tp->root;
+       struct route4_head *head = tp->root;
        struct route4_bucket *b;
        struct route4_filter *f;
        unsigned int h1, h2;
@@ -284,7 +284,7 @@ static void route4_destroy(struct tcf_proto *tp)
 
 static int route4_delete(struct tcf_proto *tp, unsigned long arg)
 {
-       struct route4_head *head = (struct route4_head *)tp->root;
+       struct route4_head *head = tp->root;
        struct route4_filter **fp, *f = (struct route4_filter *)arg;
        unsigned int h = 0;
        struct route4_bucket *b;
index f575353..eed8404 100644 (file)
@@ -24,9 +24,6 @@
 #define DEFAULT_HASH_SIZE      64      /* optimized for diffserv */
 
 
-#define        PRIV(tp)        ((struct tcindex_data *) (tp)->root)
-
-
 struct tcindex_filter_result {
        struct tcf_exts         exts;
        struct tcf_result       res;
@@ -77,7 +74,7 @@ tcindex_lookup(struct tcindex_data *p, u16 key)
 static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp,
                            struct tcf_result *res)
 {
-       struct tcindex_data *p = PRIV(tp);
+       struct tcindex_data *p = tp->root;
        struct tcindex_filter_result *f;
        int key = (skb->tc_index & p->mask) >> p->shift;
 
@@ -102,7 +99,7 @@ static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 
 static unsigned long tcindex_get(struct tcf_proto *tp, u32 handle)
 {
-       struct tcindex_data *p = PRIV(tp);
+       struct tcindex_data *p = tp->root;
        struct tcindex_filter_result *r;
 
        pr_debug("tcindex_get(tp %p,handle 0x%08x)\n", tp, handle);
@@ -140,7 +137,7 @@ static int tcindex_init(struct tcf_proto *tp)
 static int
 __tcindex_delete(struct tcf_proto *tp, unsigned long arg, int lock)
 {
-       struct tcindex_data *p = PRIV(tp);
+       struct tcindex_data *p = tp->root;
        struct tcindex_filter_result *r = (struct tcindex_filter_result *) arg;
        struct tcindex_filter *f = NULL;
 
@@ -338,7 +335,7 @@ tcindex_change(struct net *net, struct sk_buff *in_skb,
 {
        struct nlattr *opt = tca[TCA_OPTIONS];
        struct nlattr *tb[TCA_TCINDEX_MAX + 1];
-       struct tcindex_data *p = PRIV(tp);
+       struct tcindex_data *p = tp->root;
        struct tcindex_filter_result *r = (struct tcindex_filter_result *) *arg;
        int err;
 
@@ -360,7 +357,7 @@ tcindex_change(struct net *net, struct sk_buff *in_skb,
 
 static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker)
 {
-       struct tcindex_data *p = PRIV(tp);
+       struct tcindex_data *p = tp->root;
        struct tcindex_filter *f, *next;
        int i;
 
@@ -407,7 +404,7 @@ static int tcindex_destroy_element(struct tcf_proto *tp,
 
 static void tcindex_destroy(struct tcf_proto *tp)
 {
-       struct tcindex_data *p = PRIV(tp);
+       struct tcindex_data *p = tp->root;
        struct tcf_walker walker;
 
        pr_debug("tcindex_destroy(tp %p),p %p\n", tp, p);
@@ -425,7 +422,7 @@ static void tcindex_destroy(struct tcf_proto *tp)
 static int tcindex_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
     struct sk_buff *skb, struct tcmsg *t)
 {
-       struct tcindex_data *p = PRIV(tp);
+       struct tcindex_data *p = tp->root;
        struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh;
        unsigned char *b = skb_tail_pointer(skb);
        struct nlattr *nest;
index f509b79..84c28da 100644 (file)
@@ -95,7 +95,7 @@ static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct
                unsigned int      off;
        } stack[TC_U32_MAXDEPTH];
 
-       struct tc_u_hnode *ht = (struct tc_u_hnode *)tp->root;
+       struct tc_u_hnode *ht = tp->root;
        unsigned int off = skb_network_offset(skb);
        struct tc_u_knode *n;
        int sdepth = 0;