Skip to content

Commit

Permalink
net/af_iucv: clean up a try_then_request_module()
Browse files Browse the repository at this point in the history
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 6fcd61f ("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: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
julianwiedmann authored and davem330 committed Aug 9, 2021
1 parent 10d6393 commit 4eb9eda
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions net/iucv/af_iucv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2278,19 +2278,15 @@ static int __init afiucv_init(void)
{
int err;

if (MACHINE_IS_VM) {
if (MACHINE_IS_VM && IS_ENABLED(CONFIG_IUCV)) {
cpcmd("QUERY USERID", iucv_userid, sizeof(iucv_userid), &err);
if (unlikely(err)) {
WARN_ON(err);
err = -EPROTONOSUPPORT;
goto out;
}

pr_iucv = try_then_request_module(symbol_get(iucv_if), "iucv");
if (!pr_iucv) {
printk(KERN_WARNING "iucv_if lookup failed\n");
memset(&iucv_userid, 0, sizeof(iucv_userid));
}
pr_iucv = &iucv_if;
} else {
memset(&iucv_userid, 0, sizeof(iucv_userid));
pr_iucv = NULL;
Expand Down Expand Up @@ -2324,17 +2320,13 @@ static int __init afiucv_init(void)
out_proto:
proto_unregister(&iucv_proto);
out:
if (pr_iucv)
symbol_put(iucv_if);
return err;
}

static void __exit afiucv_exit(void)
{
if (pr_iucv) {
if (pr_iucv)
afiucv_iucv_exit();
symbol_put(iucv_if);
}

unregister_netdevice_notifier(&afiucv_netdev_notifier);
dev_remove_pack(&iucv_packet_type);
Expand Down

0 comments on commit 4eb9eda

Please sign in to comment.