diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2008-10-05 14:14:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-05 14:14:27 -0400 |
commit | 25532824fb727744a302edb25c6a6ac10b82cb63 (patch) | |
tree | a5befc555aa10352c8407639f2a97ea026a3b247 | |
parent | 7afb9dc9a5663befea612b03615efc694d5c3ce7 (diff) |
Phonet: modules auto-loading support
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/phonet/af_phonet.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index 1d8df6b7e3df..0a74aeaf5adf 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c | |||
@@ -64,6 +64,11 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol) | |||
64 | } | 64 | } |
65 | 65 | ||
66 | pnp = phonet_proto_get(protocol); | 66 | pnp = phonet_proto_get(protocol); |
67 | #ifdef CONFIG_KMOD | ||
68 | if (pnp == NULL && | ||
69 | request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0) | ||
70 | pnp = phonet_proto_get(protocol); | ||
71 | #endif | ||
67 | if (pnp == NULL) | 72 | if (pnp == NULL) |
68 | return -EPROTONOSUPPORT; | 73 | return -EPROTONOSUPPORT; |
69 | if (sock->type != pnp->sock_type) { | 74 | if (sock->type != pnp->sock_type) { |
@@ -94,7 +99,7 @@ out: | |||
94 | } | 99 | } |
95 | 100 | ||
96 | static struct net_proto_family phonet_proto_family = { | 101 | static struct net_proto_family phonet_proto_family = { |
97 | .family = AF_PHONET, | 102 | .family = PF_PHONET, |
98 | .create = pn_socket_create, | 103 | .create = pn_socket_create, |
99 | .owner = THIS_MODULE, | 104 | .owner = THIS_MODULE, |
100 | }; | 105 | }; |
@@ -447,7 +452,7 @@ static int __init phonet_init(void) | |||
447 | 452 | ||
448 | err: | 453 | err: |
449 | phonet_sysctl_exit(); | 454 | phonet_sysctl_exit(); |
450 | sock_unregister(AF_PHONET); | 455 | sock_unregister(PF_PHONET); |
451 | dev_remove_pack(&phonet_packet_type); | 456 | dev_remove_pack(&phonet_packet_type); |
452 | phonet_device_exit(); | 457 | phonet_device_exit(); |
453 | return err; | 458 | return err; |
@@ -457,7 +462,7 @@ static void __exit phonet_exit(void) | |||
457 | { | 462 | { |
458 | isi_unregister(); | 463 | isi_unregister(); |
459 | phonet_sysctl_exit(); | 464 | phonet_sysctl_exit(); |
460 | sock_unregister(AF_PHONET); | 465 | sock_unregister(PF_PHONET); |
461 | dev_remove_pack(&phonet_packet_type); | 466 | dev_remove_pack(&phonet_packet_type); |
462 | phonet_device_exit(); | 467 | phonet_device_exit(); |
463 | } | 468 | } |
@@ -466,3 +471,4 @@ module_init(phonet_init); | |||
466 | module_exit(phonet_exit); | 471 | module_exit(phonet_exit); |
467 | MODULE_DESCRIPTION("Phonet protocol stack for Linux"); | 472 | MODULE_DESCRIPTION("Phonet protocol stack for Linux"); |
468 | MODULE_LICENSE("GPL"); | 473 | MODULE_LICENSE("GPL"); |
474 | MODULE_ALIAS_NETPROTO(PF_PHONET); | ||