From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Thu, 15 Oct 2015 06:55:22 -0700 Subject: parameter of module_init() and module_exit() must not be a macro In-Reply-To: <6D83E89737156549AEA25EF9ED712C5D159818@DEFTHW99EK1MSX.ww902.siemens.net> References: <6D83E89737156549AEA25EF9ED712C5D159818@DEFTHW99EK1MSX.ww902.siemens.net> Message-ID: <20151015135522.GA8230@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Thu, Oct 15, 2015 at 09:48:53AM +0000, Warlich, Christof wrote: > I'd just like to get some feedback on the following issue and if the patch that I'm suggesting would be appropriate to be considered for upstream submission: > > While writing a driver template, I just came across an issue with the module_init() and module_exit() macros: They don't work properly when the parameter being passed to them is a macro itself. Here is a minimal example that shows the issue: > > $ cat test.c > #include > #define DRIVER_INIT test_init > static int __init DRIVER_INIT(void) > { > return 0; > } > //module_init(test_init); // This works, ... > module_init(DRIVER_INIT); // ... but this doesn't. I'll ask, why would you ever want to pass a macro to module_init()? We don't like functions to be macros in the kernel, do you have a real-world need for this somewhere? If so, can you show the code? thanks, greg k-h