Merge tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[linux/fpc-iii.git] / net / core / netevent.c
blobd76ed7739c70006e8457ed5519135950dd8f4aa7
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Network event notifiers
5 * Authors:
6 * Tom Tucker <tom@opengridcomputing.com>
7 * Steve Wise <swise@opengridcomputing.com>
9 * Fixes:
12 #include <linux/rtnetlink.h>
13 #include <linux/notifier.h>
14 #include <linux/export.h>
15 #include <net/netevent.h>
17 static ATOMIC_NOTIFIER_HEAD(netevent_notif_chain);
19 /**
20 * register_netevent_notifier - register a netevent notifier block
21 * @nb: notifier
23 * Register a notifier to be called when a netevent occurs.
24 * The notifier passed is linked into the kernel structures and must
25 * not be reused until it has been unregistered. A negative errno code
26 * is returned on a failure.
28 int register_netevent_notifier(struct notifier_block *nb)
30 return atomic_notifier_chain_register(&netevent_notif_chain, nb);
32 EXPORT_SYMBOL_GPL(register_netevent_notifier);
34 /**
35 * netevent_unregister_notifier - unregister a netevent notifier block
36 * @nb: notifier
38 * Unregister a notifier previously registered by
39 * register_neigh_notifier(). The notifier is unlinked into the
40 * kernel structures and may then be reused. A negative errno code
41 * is returned on a failure.
44 int unregister_netevent_notifier(struct notifier_block *nb)
46 return atomic_notifier_chain_unregister(&netevent_notif_chain, nb);
48 EXPORT_SYMBOL_GPL(unregister_netevent_notifier);
50 /**
51 * call_netevent_notifiers - call all netevent notifier blocks
52 * @val: value passed unmodified to notifier function
53 * @v: pointer passed unmodified to notifier function
55 * Call all neighbour notifier blocks. Parameters and return value
56 * are as for notifier_call_chain().
59 int call_netevent_notifiers(unsigned long val, void *v)
61 return atomic_notifier_call_chain(&netevent_notif_chain, val, v);
63 EXPORT_SYMBOL_GPL(call_netevent_notifiers);