Skip to content

Commit

Permalink
Phonet: modules auto-loading support
Browse files Browse the repository at this point in the history
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rémi Denis-Courmont authored and David S. Miller committed Oct 5, 2008
1 parent 7afb9dc commit 2553282
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions net/phonet/af_phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
}

pnp = phonet_proto_get(protocol);
#ifdef CONFIG_KMOD
if (pnp == NULL &&
request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0)
pnp = phonet_proto_get(protocol);
#endif
if (pnp == NULL)
return -EPROTONOSUPPORT;
if (sock->type != pnp->sock_type) {
Expand Down Expand Up @@ -94,7 +99,7 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
}

static struct net_proto_family phonet_proto_family = {
.family = AF_PHONET,
.family = PF_PHONET,
.create = pn_socket_create,
.owner = THIS_MODULE,
};
Expand Down Expand Up @@ -447,7 +452,7 @@ static int __init phonet_init(void)

err:
phonet_sysctl_exit();
sock_unregister(AF_PHONET);
sock_unregister(PF_PHONET);
dev_remove_pack(&phonet_packet_type);
phonet_device_exit();
return err;
Expand All @@ -457,7 +462,7 @@ static void __exit phonet_exit(void)
{
isi_unregister();
phonet_sysctl_exit();
sock_unregister(AF_PHONET);
sock_unregister(PF_PHONET);
dev_remove_pack(&phonet_packet_type);
phonet_device_exit();
}
Expand All @@ -466,3 +471,4 @@ module_init(phonet_init);
module_exit(phonet_exit);
MODULE_DESCRIPTION("Phonet protocol stack for Linux");
MODULE_LICENSE("GPL");
MODULE_ALIAS_NETPROTO(PF_PHONET);

0 comments on commit 2553282

Please sign in to comment.