diff options
-rw-r--r-- | include/linux/idr.h | 3 | ||||
-rw-r--r-- | lib/idr.c | 15 | ||||
-rw-r--r-- | net/sched/act_api.c | 2 | ||||
-rw-r--r-- | net/sched/cls_basic.c | 2 | ||||
-rw-r--r-- | net/sched/cls_bpf.c | 2 | ||||
-rw-r--r-- | net/sched/cls_flower.c | 2 | ||||
-rw-r--r-- | net/sched/cls_u32.c | 2 |
7 files changed, 9 insertions, 19 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h index 118987a17ada..f1299c4dc45f 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
@@ -136,8 +136,7 @@ int idr_for_each(const struct idr *, | |||
136 | int (*fn)(int id, void *p, void *data), void *data); | 136 | int (*fn)(int id, void *p, void *data), void *data); |
137 | void *idr_get_next(struct idr *, int *nextid); | 137 | void *idr_get_next(struct idr *, int *nextid); |
138 | void *idr_get_next_ext(struct idr *idr, unsigned long *nextid); | 138 | void *idr_get_next_ext(struct idr *idr, unsigned long *nextid); |
139 | void *idr_replace(struct idr *, void *, int id); | 139 | void *idr_replace(struct idr *, void *, unsigned long id); |
140 | void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id); | ||
141 | void idr_destroy(struct idr *); | 140 | void idr_destroy(struct idr *); |
142 | 141 | ||
143 | static inline void *idr_remove(struct idr *idr, unsigned long id) | 142 | static inline void *idr_remove(struct idr *idr, unsigned long id) |
@@ -147,18 +147,9 @@ EXPORT_SYMBOL(idr_get_next_ext); | |||
147 | * the one being replaced!). | 147 | * the one being replaced!). |
148 | * | 148 | * |
149 | * Returns: the old value on success. %-ENOENT indicates that @id was not | 149 | * Returns: the old value on success. %-ENOENT indicates that @id was not |
150 | * found. %-EINVAL indicates that @id or @ptr were not valid. | 150 | * found. %-EINVAL indicates that @ptr was not valid. |
151 | */ | 151 | */ |
152 | void *idr_replace(struct idr *idr, void *ptr, int id) | 152 | void *idr_replace(struct idr *idr, void *ptr, unsigned long id) |
153 | { | ||
154 | if (id < 0) | ||
155 | return ERR_PTR(-EINVAL); | ||
156 | |||
157 | return idr_replace_ext(idr, ptr, id); | ||
158 | } | ||
159 | EXPORT_SYMBOL(idr_replace); | ||
160 | |||
161 | void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id) | ||
162 | { | 153 | { |
163 | struct radix_tree_node *node; | 154 | struct radix_tree_node *node; |
164 | void __rcu **slot = NULL; | 155 | void __rcu **slot = NULL; |
@@ -175,7 +166,7 @@ void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id) | |||
175 | 166 | ||
176 | return entry; | 167 | return entry; |
177 | } | 168 | } |
178 | EXPORT_SYMBOL(idr_replace_ext); | 169 | EXPORT_SYMBOL(idr_replace); |
179 | 170 | ||
180 | /** | 171 | /** |
181 | * DOC: IDA description | 172 | * DOC: IDA description |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index be5b2b455371..1572466be031 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -348,7 +348,7 @@ void tcf_idr_insert(struct tc_action_net *tn, struct tc_action *a) | |||
348 | struct tcf_idrinfo *idrinfo = tn->idrinfo; | 348 | struct tcf_idrinfo *idrinfo = tn->idrinfo; |
349 | 349 | ||
350 | spin_lock_bh(&idrinfo->lock); | 350 | spin_lock_bh(&idrinfo->lock); |
351 | idr_replace_ext(&idrinfo->action_idr, a, a->tcfa_index); | 351 | idr_replace(&idrinfo->action_idr, a, a->tcfa_index); |
352 | spin_unlock_bh(&idrinfo->lock); | 352 | spin_unlock_bh(&idrinfo->lock); |
353 | } | 353 | } |
354 | EXPORT_SYMBOL(tcf_idr_insert); | 354 | EXPORT_SYMBOL(tcf_idr_insert); |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 121dff0a1763..588c635f195e 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -235,7 +235,7 @@ static int basic_change(struct net *net, struct sk_buff *in_skb, | |||
235 | *arg = fnew; | 235 | *arg = fnew; |
236 | 236 | ||
237 | if (fold) { | 237 | if (fold) { |
238 | idr_replace_ext(&head->handle_idr, fnew, fnew->handle); | 238 | idr_replace(&head->handle_idr, fnew, fnew->handle); |
239 | list_replace_rcu(&fold->link, &fnew->link); | 239 | list_replace_rcu(&fold->link, &fnew->link); |
240 | tcf_unbind_filter(tp, &fold->res); | 240 | tcf_unbind_filter(tp, &fold->res); |
241 | tcf_exts_get_net(&fold->exts); | 241 | tcf_exts_get_net(&fold->exts); |
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index e45137e3f567..8cb3a33b1afd 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -526,7 +526,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, | |||
526 | prog->gen_flags |= TCA_CLS_FLAGS_NOT_IN_HW; | 526 | prog->gen_flags |= TCA_CLS_FLAGS_NOT_IN_HW; |
527 | 527 | ||
528 | if (oldprog) { | 528 | if (oldprog) { |
529 | idr_replace_ext(&head->handle_idr, prog, handle); | 529 | idr_replace(&head->handle_idr, prog, handle); |
530 | list_replace_rcu(&oldprog->link, &prog->link); | 530 | list_replace_rcu(&oldprog->link, &prog->link); |
531 | tcf_unbind_filter(tp, &oldprog->res); | 531 | tcf_unbind_filter(tp, &oldprog->res); |
532 | tcf_exts_get_net(&oldprog->exts); | 532 | tcf_exts_get_net(&oldprog->exts); |
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index e098e8ab76c9..0d1b0c11de34 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -967,7 +967,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, | |||
967 | 967 | ||
968 | if (fold) { | 968 | if (fold) { |
969 | fnew->handle = handle; | 969 | fnew->handle = handle; |
970 | idr_replace_ext(&head->handle_idr, fnew, fnew->handle); | 970 | idr_replace(&head->handle_idr, fnew, fnew->handle); |
971 | list_replace_rcu(&fold->list, &fnew->list); | 971 | list_replace_rcu(&fold->list, &fnew->list); |
972 | tcf_unbind_filter(tp, &fold->res); | 972 | tcf_unbind_filter(tp, &fold->res); |
973 | tcf_exts_get_net(&fold->exts); | 973 | tcf_exts_get_net(&fold->exts); |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index bd55ed783cb1..5b256da985b1 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -848,7 +848,7 @@ static void u32_replace_knode(struct tcf_proto *tp, struct tc_u_common *tp_c, | |||
848 | if (pins->handle == n->handle) | 848 | if (pins->handle == n->handle) |
849 | break; | 849 | break; |
850 | 850 | ||
851 | idr_replace_ext(&ht->handle_idr, n, n->handle); | 851 | idr_replace(&ht->handle_idr, n, n->handle); |
852 | RCU_INIT_POINTER(n->next, pins->next); | 852 | RCU_INIT_POINTER(n->next, pins->next); |
853 | rcu_assign_pointer(*ins, n); | 853 | rcu_assign_pointer(*ins, n); |
854 | } | 854 | } |