ematch: simpler tcf_em_unregister()
authorAlexey Dobriyan <adobriyan@gmail.com>
Mon, 17 Nov 2008 07:01:49 +0000 (23:01 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Nov 2008 07:01:49 +0000 (23:01 -0800)
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>
include/net/pkt_cls.h
net/sched/ematch.c

index aa9e282db4855ffe0733f72f6e25b3cc89b913bc..d1ca3144464438f6ba1dc442ec36315d6f7e195f 100644 (file)
@@ -246,7 +246,7 @@ struct tcf_ematch_ops
 };
 
 extern int tcf_em_register(struct tcf_ematch_ops *);
-extern int tcf_em_unregister(struct tcf_ematch_ops *);
+extern void tcf_em_unregister(struct tcf_ematch_ops *);
 extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *,
                                struct tcf_ematch_tree *);
 extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *);
index e82519e548d70c747f602bc179ca487f120ef5af..aab59409728b4c50c4c45bc233570c10b8844980 100644 (file)
@@ -71,7 +71,7 @@
  *
  *      static void __exit exit_my_ematch(void)
  *      {
- *             return tcf_em_unregister(&my_ops);
+ *             tcf_em_unregister(&my_ops);
  *      }
  *
  *      module_init(init_my_ematch);
@@ -154,23 +154,11 @@ EXPORT_SYMBOL(tcf_em_register);
  *
  * Returns -ENOENT if no matching ematch was found.
  */
-int tcf_em_unregister(struct tcf_ematch_ops *ops)
+void tcf_em_unregister(struct tcf_ematch_ops *ops)
 {
-       int err = 0;
-       struct tcf_ematch_ops *e;
-
        write_lock(&ematch_mod_lock);
-       list_for_each_entry(e, &ematch_ops, link) {
-               if (e == ops) {
-                       list_del(&e->link);
-                       goto out;
-               }
-       }
-
-       err = -ENOENT;
-out:
+       list_del(&ops->link);
        write_unlock(&ematch_mod_lock);
-       return err;
 }
 EXPORT_SYMBOL(tcf_em_unregister);