From patchwork Fri Oct 3 14:09:34 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 2557 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id C3298DE142 for ; Sat, 4 Oct 2008 00:09:52 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752223AbYJCOJp (ORCPT ); Fri, 3 Oct 2008 10:09:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752206AbYJCOJp (ORCPT ); Fri, 3 Oct 2008 10:09:45 -0400 Received: from smtp.nokia.com ([192.100.122.230]:32206 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752143AbYJCOJn (ORCPT ); Fri, 3 Oct 2008 10:09:43 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id m93E9MYH013730 for ; Fri, 3 Oct 2008 17:09:40 +0300 Received: from vaebh102.NOE.Nokia.com ([10.160.244.23]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 3 Oct 2008 17:09:39 +0300 Received: from localhost.localdomain ([172.21.41.96]) by vaebh102.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 3 Oct 2008 17:09:39 +0300 From: Remi Denis-Courmont To: netdev@vger.kernel.org Subject: [PATCH 1/6] Phonet: modules auto-loading support Date: Fri, 3 Oct 2008 17:09:34 +0300 Message-Id: <1223042979-21124-1-git-send-email-remi.denis-courmont@nokia.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <200810031709.11828.remi.denis-courmont@nokia.com> References: <200810031709.11828.remi.denis-courmont@nokia.com> MIME-Version: 1.0 X-OriginalArrivalTime: 03 Oct 2008 14:09:39.0971 (UTC) FILETIME=[ACE7FD30:01C92561] X-Nokia-AV: Clean Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: RĂ©mi Denis-Courmont --- 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 1d8df6b..0a74aea 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) } 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) { @@ -94,7 +99,7 @@ out: } static struct net_proto_family phonet_proto_family = { - .family = AF_PHONET, + .family = PF_PHONET, .create = pn_socket_create, .owner = THIS_MODULE, }; @@ -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; @@ -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(); } @@ -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);