Commit 4eb9eda6 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

net/af_iucv: clean up a try_then_request_module()

Use IS_ENABLED(CONFIG_IUCV) to determine whether the iucv_if symbol
is available, and let depmod deal with the module dependency.

This was introduced back with commit 6fcd61f7 ("af_iucv: use
loadable iucv interface"). And to avoid sprinkling IS_ENABLED() over
all the code, we're keeping the indirection through pr_iucv->...().
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 10d6393d
...@@ -2278,7 +2278,7 @@ static int __init afiucv_init(void) ...@@ -2278,7 +2278,7 @@ static int __init afiucv_init(void)
{ {
int err; int err;
if (MACHINE_IS_VM) { if (MACHINE_IS_VM && IS_ENABLED(CONFIG_IUCV)) {
cpcmd("QUERY USERID", iucv_userid, sizeof(iucv_userid), &err); cpcmd("QUERY USERID", iucv_userid, sizeof(iucv_userid), &err);
if (unlikely(err)) { if (unlikely(err)) {
WARN_ON(err); WARN_ON(err);
...@@ -2286,11 +2286,7 @@ static int __init afiucv_init(void) ...@@ -2286,11 +2286,7 @@ static int __init afiucv_init(void)
goto out; goto out;
} }
pr_iucv = try_then_request_module(symbol_get(iucv_if), "iucv"); pr_iucv = &iucv_if;
if (!pr_iucv) {
printk(KERN_WARNING "iucv_if lookup failed\n");
memset(&iucv_userid, 0, sizeof(iucv_userid));
}
} else { } else {
memset(&iucv_userid, 0, sizeof(iucv_userid)); memset(&iucv_userid, 0, sizeof(iucv_userid));
pr_iucv = NULL; pr_iucv = NULL;
...@@ -2324,17 +2320,13 @@ static int __init afiucv_init(void) ...@@ -2324,17 +2320,13 @@ static int __init afiucv_init(void)
out_proto: out_proto:
proto_unregister(&iucv_proto); proto_unregister(&iucv_proto);
out: out:
if (pr_iucv)
symbol_put(iucv_if);
return err; return err;
} }
static void __exit afiucv_exit(void) static void __exit afiucv_exit(void)
{ {
if (pr_iucv) { if (pr_iucv)
afiucv_iucv_exit(); afiucv_iucv_exit();
symbol_put(iucv_if);
}
unregister_netdevice_notifier(&afiucv_netdev_notifier); unregister_netdevice_notifier(&afiucv_netdev_notifier);
dev_remove_pack(&iucv_packet_type); dev_remove_pack(&iucv_packet_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment