diff options
author | Florian Westphal <fw@strlen.de> | 2017-12-02 21:44:08 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-04 11:32:53 -0500 |
commit | 16feebcf2350aa369001a529f50ce33f2472c01c (patch) | |
tree | dadfbed703d39870e77cd6625453c5c8126f9962 /net/core/rtnetlink.c | |
parent | c1c502b511503ee5de55382744859b622411f32b (diff) | |
download | lwn-16feebcf2350aa369001a529f50ce33f2472c01c.tar.gz lwn-16feebcf2350aa369001a529f50ce33f2472c01c.zip |
rtnetlink: remove __rtnl_register
This removes __rtnl_register and switches callers to either
rtnl_register or rtnl_register_module.
Also, rtnl_register() will now print an error if memory allocation
failed rather than panic the kernel.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index de6390365c90..fb2d61df1e2f 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -238,7 +238,7 @@ int rtnl_register_module(struct module *owner, EXPORT_SYMBOL_GPL(rtnl_register_module); /** - * __rtnl_register - Register a rtnetlink message type + * rtnl_register - Register a rtnetlink message type * @protocol: Protocol family or PF_UNSPEC * @msgtype: rtnetlink message type * @doit: Function pointer called for each request message @@ -252,35 +252,18 @@ EXPORT_SYMBOL_GPL(rtnl_register_module); * The special protocol family PF_UNSPEC may be used to define fallback * function pointers for the case when no entry for the specific protocol * family exists. - * - * Returns 0 on success or a negative error code. - */ -int __rtnl_register(int protocol, int msgtype, - rtnl_doit_func doit, rtnl_dumpit_func dumpit, - unsigned int flags) -{ - return rtnl_register_internal(NULL, protocol, msgtype, - doit, dumpit, flags); -} -EXPORT_SYMBOL_GPL(__rtnl_register); - -/** - * rtnl_register - Register a rtnetlink message type - * - * Identical to __rtnl_register() but panics on failure. This is useful - * as failure of this function is very unlikely, it can only happen due - * to lack of memory when allocating the chain to store all message - * handlers for a protocol. Meant for use in init functions where lack - * of memory implies no sense in continuing. */ void rtnl_register(int protocol, int msgtype, rtnl_doit_func doit, rtnl_dumpit_func dumpit, unsigned int flags) { - if (__rtnl_register(protocol, msgtype, doit, dumpit, flags) < 0) - panic("Unable to register rtnetlink message handler, " - "protocol = %d, message type = %d\n", - protocol, msgtype); + int err; + + err = rtnl_register_internal(NULL, protocol, msgtype, doit, dumpit, + flags); + if (err) + pr_err("Unable to register rtnetlink message handler, " + "protocol = %d, message type = %d\n", protocol, msgtype); } EXPORT_SYMBOL_GPL(rtnl_register); |