diff options
author | Julian Wiedmann <jwi@linux.ibm.com> | 2021-08-09 10:30:47 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-02-23 08:12:54 +0100 |
commit | 8811188205406ce59c34fabc18e2421b38c03fdd (patch) | |
tree | 843300e086cfe6caa613a5d2ae2a52df8ce80d76 | |
parent | 1d769e2dc5444c3ab3010887d7c3cda76a0310e7 (diff) | |
download | linux-stable-8811188205406ce59c34fabc18e2421b38c03fdd.tar.gz linux-stable-8811188205406ce59c34fabc18e2421b38c03fdd.tar.bz2 linux-stable-8811188205406ce59c34fabc18e2421b38c03fdd.zip |
net/af_iucv: clean up a try_then_request_module()
[ Upstream commit 4eb9eda6ba64114d98827e2870e024d5ab7cd35b ]
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 6fcd61f7bf5d ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | net/iucv/af_iucv.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index d59f2341bfec..1ff2860dd3ff 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c @@ -2477,7 +2477,7 @@ 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); @@ -2485,11 +2485,7 @@ static int __init afiucv_init(void) 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; @@ -2523,17 +2519,13 @@ out_sock: 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); |