Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11ca9624 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by Greg Kroah-Hartman
Browse files

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 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>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1c748815
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -2455,7 +2455,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);
@@ -2463,11 +2463,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;
@@ -2501,17 +2497,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);