/* Returns -EEXISTS if an ematch of the same kind has already registered.  */
int tcf_em_register(struct tcf_ematch_ops *ops)
/* Returns -EEXISTS if an ematch of the same kind has already registered.  */
int tcf_em_register(struct tcf_ematch_ops *ops)
{
	int err = -EEXIST;
	struct tcf_ematch_ops *e;
	if (ops->match == NULL)
		return -EINVAL;
	write_lock(&ematch_mod_lock);
	list_for_each_entry(e, &ematch_ops, link)
		if (ops->kind == e->kind)
			goto errout;
	list_add_tail(&ops->link, &ematch_ops);
	err = 0;
errout:
	write_unlock(&ematch_mod_lock);
	return err;
}