Skip to content

Commit 4eb9eda

Browse files
julianwiedmanndavem330
authored andcommitted
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 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>
1 parent 10d6393 commit 4eb9eda

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

net/iucv/af_iucv.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,19 +2278,15 @@ static int __init afiucv_init(void)
22782278
{
22792279
int err;
22802280

2281-
if (MACHINE_IS_VM) {
2281+
if (MACHINE_IS_VM && IS_ENABLED(CONFIG_IUCV)) {
22822282
cpcmd("QUERY USERID", iucv_userid, sizeof(iucv_userid), &err);
22832283
if (unlikely(err)) {
22842284
WARN_ON(err);
22852285
err = -EPROTONOSUPPORT;
22862286
goto out;
22872287
}
22882288

2289-
pr_iucv = try_then_request_module(symbol_get(iucv_if), "iucv");
2290-
if (!pr_iucv) {
2291-
printk(KERN_WARNING "iucv_if lookup failed\n");
2292-
memset(&iucv_userid, 0, sizeof(iucv_userid));
2293-
}
2289+
pr_iucv = &iucv_if;
22942290
} else {
22952291
memset(&iucv_userid, 0, sizeof(iucv_userid));
22962292
pr_iucv = NULL;
@@ -2324,17 +2320,13 @@ static int __init afiucv_init(void)
23242320
out_proto:
23252321
proto_unregister(&iucv_proto);
23262322
out:
2327-
if (pr_iucv)
2328-
symbol_put(iucv_if);
23292323
return err;
23302324
}
23312325

23322326
static void __exit afiucv_exit(void)
23332327
{
2334-
if (pr_iucv) {
2328+
if (pr_iucv)
23352329
afiucv_iucv_exit();
2336-
symbol_put(iucv_if);
2337-
}
23382330

23392331
unregister_netdevice_notifier(&afiucv_netdev_notifier);
23402332
dev_remove_pack(&iucv_packet_type);

0 commit comments

Comments
 (0)