diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2014-01-09 19:14:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-13 14:50:15 -0500 |
commit | a8701a6c7ae0142393d0fe87a1e7778bd04d1ac7 (patch) | |
tree | 0e14b5dba8e73d59b6dec9969fc275ae6d7301cd | |
parent | 2519a602c273c5254781bc55b6e678a17e469a12 (diff) |
net_sched: avoid casting void pointer
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>
-rw-r--r-- | net/sched/cls_basic.c | 10 | ||||
-rw-r--r-- | net/sched/cls_fw.c | 14 | ||||
-rw-r--r-- | net/sched/cls_route.c | 6 | ||||
-rw-r--r-- | net/sched/cls_tcindex.c | 17 | ||||
-rw-r--r-- | net/sched/cls_u32.c | 2 |
5 files changed, 23 insertions, 26 deletions
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index af6bea1a6a54..e98ca99c202b 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -38,7 +38,7 @@ static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |||
38 | struct tcf_result *res) | 38 | struct tcf_result *res) |
39 | { | 39 | { |
40 | int r; | 40 | int r; |
41 | struct basic_head *head = (struct basic_head *) tp->root; | 41 | struct basic_head *head = tp->root; |
42 | struct basic_filter *f; | 42 | struct basic_filter *f; |
43 | 43 | ||
44 | list_for_each_entry(f, &head->flist, link) { | 44 | 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, | |||
56 | static unsigned long basic_get(struct tcf_proto *tp, u32 handle) | 56 | static unsigned long basic_get(struct tcf_proto *tp, u32 handle) |
57 | { | 57 | { |
58 | unsigned long l = 0UL; | 58 | unsigned long l = 0UL; |
59 | struct basic_head *head = (struct basic_head *) tp->root; | 59 | struct basic_head *head = tp->root; |
60 | struct basic_filter *f; | 60 | struct basic_filter *f; |
61 | 61 | ||
62 | if (head == NULL) | 62 | if (head == NULL) |
@@ -107,7 +107,7 @@ static void basic_destroy(struct tcf_proto *tp) | |||
107 | 107 | ||
108 | static int basic_delete(struct tcf_proto *tp, unsigned long arg) | 108 | static int basic_delete(struct tcf_proto *tp, unsigned long arg) |
109 | { | 109 | { |
110 | struct basic_head *head = (struct basic_head *) tp->root; | 110 | struct basic_head *head = tp->root; |
111 | struct basic_filter *t, *f = (struct basic_filter *) arg; | 111 | struct basic_filter *t, *f = (struct basic_filter *) arg; |
112 | 112 | ||
113 | list_for_each_entry(t, &head->flist, link) | 113 | list_for_each_entry(t, &head->flist, link) |
@@ -164,7 +164,7 @@ static int basic_change(struct net *net, struct sk_buff *in_skb, | |||
164 | struct nlattr **tca, unsigned long *arg) | 164 | struct nlattr **tca, unsigned long *arg) |
165 | { | 165 | { |
166 | int err; | 166 | int err; |
167 | struct basic_head *head = (struct basic_head *) tp->root; | 167 | struct basic_head *head = tp->root; |
168 | struct nlattr *tb[TCA_BASIC_MAX + 1]; | 168 | struct nlattr *tb[TCA_BASIC_MAX + 1]; |
169 | struct basic_filter *f = (struct basic_filter *) *arg; | 169 | struct basic_filter *f = (struct basic_filter *) *arg; |
170 | 170 | ||
@@ -225,7 +225,7 @@ errout: | |||
225 | 225 | ||
226 | static void basic_walk(struct tcf_proto *tp, struct tcf_walker *arg) | 226 | static void basic_walk(struct tcf_proto *tp, struct tcf_walker *arg) |
227 | { | 227 | { |
228 | struct basic_head *head = (struct basic_head *) tp->root; | 228 | struct basic_head *head = tp->root; |
229 | struct basic_filter *f; | 229 | struct basic_filter *f; |
230 | 230 | ||
231 | list_for_each_entry(f, &head->flist, link) { | 231 | list_for_each_entry(f, &head->flist, link) { |
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index ca662aaa5eb4..ed00e8c21cea 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -75,7 +75,7 @@ static inline int fw_hash(u32 handle) | |||
75 | static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 75 | static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
76 | struct tcf_result *res) | 76 | struct tcf_result *res) |
77 | { | 77 | { |
78 | struct fw_head *head = (struct fw_head *)tp->root; | 78 | struct fw_head *head = tp->root; |
79 | struct fw_filter *f; | 79 | struct fw_filter *f; |
80 | int r; | 80 | int r; |
81 | u32 id = skb->mark; | 81 | u32 id = skb->mark; |
@@ -111,7 +111,7 @@ static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |||
111 | 111 | ||
112 | static unsigned long fw_get(struct tcf_proto *tp, u32 handle) | 112 | static unsigned long fw_get(struct tcf_proto *tp, u32 handle) |
113 | { | 113 | { |
114 | struct fw_head *head = (struct fw_head *)tp->root; | 114 | struct fw_head *head = tp->root; |
115 | struct fw_filter *f; | 115 | struct fw_filter *f; |
116 | 116 | ||
117 | if (head == NULL) | 117 | if (head == NULL) |
@@ -160,7 +160,7 @@ static void fw_destroy(struct tcf_proto *tp) | |||
160 | 160 | ||
161 | static int fw_delete(struct tcf_proto *tp, unsigned long arg) | 161 | static int fw_delete(struct tcf_proto *tp, unsigned long arg) |
162 | { | 162 | { |
163 | struct fw_head *head = (struct fw_head *)tp->root; | 163 | struct fw_head *head = tp->root; |
164 | struct fw_filter *f = (struct fw_filter *)arg; | 164 | struct fw_filter *f = (struct fw_filter *)arg; |
165 | struct fw_filter **fp; | 165 | struct fw_filter **fp; |
166 | 166 | ||
@@ -190,7 +190,7 @@ static int | |||
190 | fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f, | 190 | fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f, |
191 | struct nlattr **tb, struct nlattr **tca, unsigned long base) | 191 | struct nlattr **tb, struct nlattr **tca, unsigned long base) |
192 | { | 192 | { |
193 | struct fw_head *head = (struct fw_head *)tp->root; | 193 | struct fw_head *head = tp->root; |
194 | struct tcf_exts e; | 194 | struct tcf_exts e; |
195 | u32 mask; | 195 | u32 mask; |
196 | int err; | 196 | int err; |
@@ -237,7 +237,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb, | |||
237 | struct nlattr **tca, | 237 | struct nlattr **tca, |
238 | unsigned long *arg) | 238 | unsigned long *arg) |
239 | { | 239 | { |
240 | struct fw_head *head = (struct fw_head *)tp->root; | 240 | struct fw_head *head = tp->root; |
241 | struct fw_filter *f = (struct fw_filter *) *arg; | 241 | struct fw_filter *f = (struct fw_filter *) *arg; |
242 | struct nlattr *opt = tca[TCA_OPTIONS]; | 242 | struct nlattr *opt = tca[TCA_OPTIONS]; |
243 | struct nlattr *tb[TCA_FW_MAX + 1]; | 243 | struct nlattr *tb[TCA_FW_MAX + 1]; |
@@ -300,7 +300,7 @@ errout: | |||
300 | 300 | ||
301 | static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg) | 301 | static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg) |
302 | { | 302 | { |
303 | struct fw_head *head = (struct fw_head *)tp->root; | 303 | struct fw_head *head = tp->root; |
304 | int h; | 304 | int h; |
305 | 305 | ||
306 | if (head == NULL) | 306 | if (head == NULL) |
@@ -329,7 +329,7 @@ static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg) | |||
329 | static int fw_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, | 329 | static int fw_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, |
330 | struct sk_buff *skb, struct tcmsg *t) | 330 | struct sk_buff *skb, struct tcmsg *t) |
331 | { | 331 | { |
332 | struct fw_head *head = (struct fw_head *)tp->root; | 332 | struct fw_head *head = tp->root; |
333 | struct fw_filter *f = (struct fw_filter *)fh; | 333 | struct fw_filter *f = (struct fw_filter *)fh; |
334 | unsigned char *b = skb_tail_pointer(skb); | 334 | unsigned char *b = skb_tail_pointer(skb); |
335 | struct nlattr *nest; | 335 | struct nlattr *nest; |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index c9136136727b..1ad3068f2ce1 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -123,7 +123,7 @@ static inline int route4_hash_wild(void) | |||
123 | static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 123 | static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
124 | struct tcf_result *res) | 124 | struct tcf_result *res) |
125 | { | 125 | { |
126 | struct route4_head *head = (struct route4_head *)tp->root; | 126 | struct route4_head *head = tp->root; |
127 | struct dst_entry *dst; | 127 | struct dst_entry *dst; |
128 | struct route4_bucket *b; | 128 | struct route4_bucket *b; |
129 | struct route4_filter *f; | 129 | struct route4_filter *f; |
@@ -213,7 +213,7 @@ static inline u32 from_hash(u32 id) | |||
213 | 213 | ||
214 | static unsigned long route4_get(struct tcf_proto *tp, u32 handle) | 214 | static unsigned long route4_get(struct tcf_proto *tp, u32 handle) |
215 | { | 215 | { |
216 | struct route4_head *head = (struct route4_head *)tp->root; | 216 | struct route4_head *head = tp->root; |
217 | struct route4_bucket *b; | 217 | struct route4_bucket *b; |
218 | struct route4_filter *f; | 218 | struct route4_filter *f; |
219 | unsigned int h1, h2; | 219 | unsigned int h1, h2; |
@@ -284,7 +284,7 @@ static void route4_destroy(struct tcf_proto *tp) | |||
284 | 284 | ||
285 | static int route4_delete(struct tcf_proto *tp, unsigned long arg) | 285 | static int route4_delete(struct tcf_proto *tp, unsigned long arg) |
286 | { | 286 | { |
287 | struct route4_head *head = (struct route4_head *)tp->root; | 287 | struct route4_head *head = tp->root; |
288 | struct route4_filter **fp, *f = (struct route4_filter *)arg; | 288 | struct route4_filter **fp, *f = (struct route4_filter *)arg; |
289 | unsigned int h = 0; | 289 | unsigned int h = 0; |
290 | struct route4_bucket *b; | 290 | struct route4_bucket *b; |
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index f57535354243..eed8404443d8 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -24,9 +24,6 @@ | |||
24 | #define DEFAULT_HASH_SIZE 64 /* optimized for diffserv */ | 24 | #define DEFAULT_HASH_SIZE 64 /* optimized for diffserv */ |
25 | 25 | ||
26 | 26 | ||
27 | #define PRIV(tp) ((struct tcindex_data *) (tp)->root) | ||
28 | |||
29 | |||
30 | struct tcindex_filter_result { | 27 | struct tcindex_filter_result { |
31 | struct tcf_exts exts; | 28 | struct tcf_exts exts; |
32 | struct tcf_result res; | 29 | struct tcf_result res; |
@@ -77,7 +74,7 @@ tcindex_lookup(struct tcindex_data *p, u16 key) | |||
77 | static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 74 | static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
78 | struct tcf_result *res) | 75 | struct tcf_result *res) |
79 | { | 76 | { |
80 | struct tcindex_data *p = PRIV(tp); | 77 | struct tcindex_data *p = tp->root; |
81 | struct tcindex_filter_result *f; | 78 | struct tcindex_filter_result *f; |
82 | int key = (skb->tc_index & p->mask) >> p->shift; | 79 | int key = (skb->tc_index & p->mask) >> p->shift; |
83 | 80 | ||
@@ -102,7 +99,7 @@ static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |||
102 | 99 | ||
103 | static unsigned long tcindex_get(struct tcf_proto *tp, u32 handle) | 100 | static unsigned long tcindex_get(struct tcf_proto *tp, u32 handle) |
104 | { | 101 | { |
105 | struct tcindex_data *p = PRIV(tp); | 102 | struct tcindex_data *p = tp->root; |
106 | struct tcindex_filter_result *r; | 103 | struct tcindex_filter_result *r; |
107 | 104 | ||
108 | pr_debug("tcindex_get(tp %p,handle 0x%08x)\n", tp, handle); | 105 | pr_debug("tcindex_get(tp %p,handle 0x%08x)\n", tp, handle); |
@@ -140,7 +137,7 @@ static int tcindex_init(struct tcf_proto *tp) | |||
140 | static int | 137 | static int |
141 | __tcindex_delete(struct tcf_proto *tp, unsigned long arg, int lock) | 138 | __tcindex_delete(struct tcf_proto *tp, unsigned long arg, int lock) |
142 | { | 139 | { |
143 | struct tcindex_data *p = PRIV(tp); | 140 | struct tcindex_data *p = tp->root; |
144 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) arg; | 141 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) arg; |
145 | struct tcindex_filter *f = NULL; | 142 | struct tcindex_filter *f = NULL; |
146 | 143 | ||
@@ -338,7 +335,7 @@ tcindex_change(struct net *net, struct sk_buff *in_skb, | |||
338 | { | 335 | { |
339 | struct nlattr *opt = tca[TCA_OPTIONS]; | 336 | struct nlattr *opt = tca[TCA_OPTIONS]; |
340 | struct nlattr *tb[TCA_TCINDEX_MAX + 1]; | 337 | struct nlattr *tb[TCA_TCINDEX_MAX + 1]; |
341 | struct tcindex_data *p = PRIV(tp); | 338 | struct tcindex_data *p = tp->root; |
342 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) *arg; | 339 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) *arg; |
343 | int err; | 340 | int err; |
344 | 341 | ||
@@ -360,7 +357,7 @@ tcindex_change(struct net *net, struct sk_buff *in_skb, | |||
360 | 357 | ||
361 | static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker) | 358 | static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker) |
362 | { | 359 | { |
363 | struct tcindex_data *p = PRIV(tp); | 360 | struct tcindex_data *p = tp->root; |
364 | struct tcindex_filter *f, *next; | 361 | struct tcindex_filter *f, *next; |
365 | int i; | 362 | int i; |
366 | 363 | ||
@@ -407,7 +404,7 @@ static int tcindex_destroy_element(struct tcf_proto *tp, | |||
407 | 404 | ||
408 | static void tcindex_destroy(struct tcf_proto *tp) | 405 | static void tcindex_destroy(struct tcf_proto *tp) |
409 | { | 406 | { |
410 | struct tcindex_data *p = PRIV(tp); | 407 | struct tcindex_data *p = tp->root; |
411 | struct tcf_walker walker; | 408 | struct tcf_walker walker; |
412 | 409 | ||
413 | pr_debug("tcindex_destroy(tp %p),p %p\n", tp, p); | 410 | pr_debug("tcindex_destroy(tp %p),p %p\n", tp, p); |
@@ -425,7 +422,7 @@ static void tcindex_destroy(struct tcf_proto *tp) | |||
425 | static int tcindex_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, | 422 | static int tcindex_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, |
426 | struct sk_buff *skb, struct tcmsg *t) | 423 | struct sk_buff *skb, struct tcmsg *t) |
427 | { | 424 | { |
428 | struct tcindex_data *p = PRIV(tp); | 425 | struct tcindex_data *p = tp->root; |
429 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; | 426 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; |
430 | unsigned char *b = skb_tail_pointer(skb); | 427 | unsigned char *b = skb_tail_pointer(skb); |
431 | struct nlattr *nest; | 428 | struct nlattr *nest; |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index f509b7907f8d..84c28daff848 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -95,7 +95,7 @@ static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct | |||
95 | unsigned int off; | 95 | unsigned int off; |
96 | } stack[TC_U32_MAXDEPTH]; | 96 | } stack[TC_U32_MAXDEPTH]; |
97 | 97 | ||
98 | struct tc_u_hnode *ht = (struct tc_u_hnode *)tp->root; | 98 | struct tc_u_hnode *ht = tp->root; |
99 | unsigned int off = skb_network_offset(skb); | 99 | unsigned int off = skb_network_offset(skb); |
100 | struct tc_u_knode *n; | 100 | struct tc_u_knode *n; |
101 | int sdepth = 0; | 101 | int sdepth = 0; |