From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751617AbdBHTf6 (ORCPT ); Wed, 8 Feb 2017 14:35:58 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:57304 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751370AbdBHTf4 (ORCPT ); Wed, 8 Feb 2017 14:35:56 -0500 Date: Wed, 08 Feb 2017 14:29:18 -0500 (EST) Message-Id: <20170208.142918.491209108288972402.davem@davemloft.net> To: shannon.nelson@oracle.com Cc: netdev@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 net-next 1/9] sunvnet: make sunvnet common code dynamically loadable From: David Miller In-Reply-To: <1486505582-76823-2-git-send-email-shannon.nelson@oracle.com> References: <1486505582-76823-1-git-send-email-shannon.nelson@oracle.com> <1486505582-76823-2-git-send-email-shannon.nelson@oracle.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 08 Feb 2017 10:30:20 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shannon Nelson Date: Tue, 7 Feb 2017 14:12:54 -0800 > +static int __init sunvnet_common_init(void) > +{ > + pr_info("%s\n", version); > + return 0; > +} > +module_init(sunvnet_common_init); > + > +static void __exit sunvnet_common_exit(void) > +{ > + /* Empty function, just here to fill the exit function pointer > + * slot. In some combinations of older gcc and newer kernel, > + * leaving this undefined results in the kernel marking it as a > + * permanent module; it will show up in lsmod output as [permanent] > + * and not be unloadable. > + */ > +} > +module_exit(sunvnet_common_exit); > + This module is just providing infrastructure for other modules. So skip the init function, and that way you don't need the exit function either. The kernel log message when the real sunvnet driver loads is sufficient, you don't need one here. From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Date: Wed, 08 Feb 2017 19:29:18 +0000 Subject: Re: [PATCH v2 net-next 1/9] sunvnet: make sunvnet common code dynamically loadable Message-Id: <20170208.142918.491209108288972402.davem@davemloft.net> List-Id: References: <1486505582-76823-1-git-send-email-shannon.nelson@oracle.com> <1486505582-76823-2-git-send-email-shannon.nelson@oracle.com> In-Reply-To: <1486505582-76823-2-git-send-email-shannon.nelson@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: shannon.nelson@oracle.com Cc: netdev@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org From: Shannon Nelson Date: Tue, 7 Feb 2017 14:12:54 -0800 > +static int __init sunvnet_common_init(void) > +{ > + pr_info("%s\n", version); > + return 0; > +} > +module_init(sunvnet_common_init); > + > +static void __exit sunvnet_common_exit(void) > +{ > + /* Empty function, just here to fill the exit function pointer > + * slot. In some combinations of older gcc and newer kernel, > + * leaving this undefined results in the kernel marking it as a > + * permanent module; it will show up in lsmod output as [permanent] > + * and not be unloadable. > + */ > +} > +module_exit(sunvnet_common_exit); > + This module is just providing infrastructure for other modules. So skip the init function, and that way you don't need the exit function either. The kernel log message when the real sunvnet driver loads is sufficient, you don't need one here.