diff options
| author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-17 02:01:49 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2008-11-17 02:01:49 -0500 |
| commit | 4d24b52ac5085ef8a264d044f1b302b7c029887a (patch) | |
| tree | 3842c484d49f97bc441ef9e6a31de09fa2f683f5 | |
| parent | 6eba6a372b501aa3cdfb7df21a8364099125b9c4 (diff) | |
ematch: simpler tcf_em_unregister()
Simply delete ops from list and let list debugging do the job.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/net/pkt_cls.h | 2 | ||||
| -rw-r--r-- | net/sched/ematch.c | 18 |
2 files changed, 4 insertions, 16 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index aa9e282db48..d1ca3144464 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
| @@ -246,7 +246,7 @@ struct tcf_ematch_ops | |||
| 246 | }; | 246 | }; |
| 247 | 247 | ||
| 248 | extern int tcf_em_register(struct tcf_ematch_ops *); | 248 | extern int tcf_em_register(struct tcf_ematch_ops *); |
| 249 | extern int tcf_em_unregister(struct tcf_ematch_ops *); | 249 | extern void tcf_em_unregister(struct tcf_ematch_ops *); |
| 250 | extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, | 250 | extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, |
| 251 | struct tcf_ematch_tree *); | 251 | struct tcf_ematch_tree *); |
| 252 | extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); | 252 | extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); |
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index e82519e548d..aab59409728 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
| @@ -71,7 +71,7 @@ | |||
| 71 | * | 71 | * |
| 72 | * static void __exit exit_my_ematch(void) | 72 | * static void __exit exit_my_ematch(void) |
| 73 | * { | 73 | * { |
| 74 | * return tcf_em_unregister(&my_ops); | 74 | * tcf_em_unregister(&my_ops); |
| 75 | * } | 75 | * } |
| 76 | * | 76 | * |
| 77 | * module_init(init_my_ematch); | 77 | * module_init(init_my_ematch); |
| @@ -154,23 +154,11 @@ EXPORT_SYMBOL(tcf_em_register); | |||
| 154 | * | 154 | * |
| 155 | * Returns -ENOENT if no matching ematch was found. | 155 | * Returns -ENOENT if no matching ematch was found. |
| 156 | */ | 156 | */ |
| 157 | int tcf_em_unregister(struct tcf_ematch_ops *ops) | 157 | void tcf_em_unregister(struct tcf_ematch_ops *ops) |
| 158 | { | 158 | { |
| 159 | int err = 0; | ||
| 160 | struct tcf_ematch_ops *e; | ||
| 161 | |||
| 162 | write_lock(&ematch_mod_lock); | 159 | write_lock(&ematch_mod_lock); |
| 163 | list_for_each_entry(e, &ematch_ops, link) { | 160 | list_del(&ops->link); |
| 164 | if (e == ops) { | ||
| 165 | list_del(&e->link); | ||
| 166 | goto out; | ||
| 167 | } | ||
| 168 | } | ||
| 169 | |||
| 170 | err = -ENOENT; | ||
| 171 | out: | ||
| 172 | write_unlock(&ematch_mod_lock); | 161 | write_unlock(&ematch_mod_lock); |
| 173 | return err; | ||
| 174 | } | 162 | } |
| 175 | EXPORT_SYMBOL(tcf_em_unregister); | 163 | EXPORT_SYMBOL(tcf_em_unregister); |
| 176 | 164 | ||
